1#!/bin/sh 2# 3# This Source Code Form is subject to the terms of the Mozilla Public 4# License, v. 2.0. If a copy of the MPL was not distributed with this 5# file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7## 8## Usage: 9## 10## $ mozilla [args] 11## 12## This script is meant to run the application binary from mozilla/dist/bin. 13## 14## The script will setup all the environment voodoo needed to make 15## the application binary to work. 16## 17 18#uncomment for debugging 19#set -x 20 21moz_libdir=%MOZAPPDIR% 22 23# Use run-mozilla.sh in the current dir if it exists 24# If not, then start resolving symlinks until we find run-mozilla.sh 25found=0 26progname="$0" 27curdir=`dirname "$progname"` 28progbase=`basename "$progname"` 29run_moz="$curdir/run-mozilla.sh" 30if test -x "$run_moz"; then 31 dist_bin="$curdir" 32 found=1 33else 34 here=`/bin/pwd` 35 while [ -h "$progname" ]; do 36 bn=`basename "$progname"` 37 cd `dirname "$progname"` 38 # Resolve symlink of dirname 39 cd `/bin/pwd` 40 progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' ` 41 progbase=`basename "$progname"` 42 if [ ! -x "$progname" ]; then 43 break 44 fi 45 curdir=`dirname "$progname"` 46 run_moz="$curdir/run-mozilla.sh" 47 if [ -x "$run_moz" ]; then 48 cd "$curdir" 49 dist_bin=`/bin/pwd` 50 run_moz="$dist_bin/run-mozilla.sh" 51 found=1 52 break 53 fi 54 done 55 cd "$here" 56fi 57if [ $found = 0 ]; then 58 # Check default compile-time libdir 59 if [ -x "$moz_libdir/run-mozilla.sh" ]; then 60 dist_bin="$moz_libdir" 61 run_moz="$moz_libdir/run-mozilla.sh" 62 else 63 echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting." 64 exit 1 65 fi 66fi 67 68script_args="" 69debugging=0 70MOZILLA_BIN="${progbase}-bin" 71 72if [ "$OSTYPE" = "beos" ]; then 73 mimeset -F "$MOZILLA_BIN" 74fi 75 76pass_arg_count=0 77while [ $# -gt $pass_arg_count ] 78do 79 case "$1" in 80 -p | --pure | -pure) 81 MOZILLA_BIN="${MOZILLA_BIN}.pure" 82 shift 83 ;; 84 -g | --debug) 85 script_args="$script_args -g" 86 debugging=1 87 shift 88 ;; 89 -d | --debugger) 90 script_args="$script_args -d $2" 91 shift 2 92 ;; 93 *) 94 # Move the unrecognized argument to the end of the list. 95 arg="$1" 96 shift 97 set -- "$@" "$arg" 98 pass_arg_count=`expr $pass_arg_count + 1` 99 ;; 100 esac 101done 102 103if [ $debugging = 1 ] 104then 105 echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@" 106fi 107exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@" 108# EOF. 109