[1237] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # The contents of this file are subject to the Netscape Public |
---|
| 4 | # License Version 1.1 (the "License"); you may not use this file |
---|
| 5 | # except in compliance with the License. You may obtain a copy of |
---|
| 6 | # the License at http://www.mozilla.org/NPL/ |
---|
| 7 | # |
---|
| 8 | # Software distributed under the License is distributed on an "AS |
---|
| 9 | # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
---|
| 10 | # implied. See the License for the specific language governing |
---|
| 11 | # rights and limitations under the License. |
---|
| 12 | # |
---|
| 13 | # The Original Code is mozilla.org code. |
---|
| 14 | # |
---|
| 15 | # The Initial Developer of the Original Code is Netscape |
---|
| 16 | # Communications Corporation. Portions created by Netscape are |
---|
| 17 | # Copyright (C) 1998 Netscape Communications Corporation. All |
---|
| 18 | # Rights Reserved. |
---|
| 19 | # |
---|
| 20 | # Contributor(s): |
---|
| 21 | # |
---|
| 22 | |
---|
| 23 | ## |
---|
| 24 | ## Usage: |
---|
| 25 | ## |
---|
| 26 | ## $ mozilla |
---|
| 27 | ## |
---|
| 28 | ## This script is meant to run a mozilla program from the mozilla |
---|
| 29 | ## rpm installation. |
---|
| 30 | ## |
---|
| 31 | ## The script will setup all the environment voodoo needed to make |
---|
| 32 | ## mozilla work. |
---|
| 33 | |
---|
| 34 | cmdname=`basename $0` |
---|
| 35 | |
---|
| 36 | ## |
---|
| 37 | ## Variables |
---|
| 38 | ## |
---|
| 39 | MOZ_ARCH=$(uname -m) |
---|
| 40 | case $MOZ_ARCH in |
---|
| 41 | x86_64 | ia64 | s390 ) |
---|
| 42 | MOZ_LIB_DIR="/usr/lib64" |
---|
| 43 | SECONDARY_LIB_DIR="/usr/lib" |
---|
| 44 | ;; |
---|
| 45 | * ) |
---|
| 46 | MOZ_LIB_DIR="/usr/lib" |
---|
| 47 | SECONDARY_LIB_DIR="/usr/lib64" |
---|
| 48 | ;; |
---|
| 49 | esac |
---|
| 50 | |
---|
| 51 | if [ ! -x $MOZ_LIB_DIR/firefox-FIREFOX_VERSION/firefox ]; then |
---|
| 52 | if [ ! -x $SECONDARY_LIB_DIR/firefox-FIREFOX_VERSION/firefox ]; then |
---|
| 53 | echo "Error: $MOZ_LIB_DIR/firefox-FIREFOX_VERSION/firefox not found" |
---|
| 54 | if [ -d $SECONDARY_LIB_DIR ]; then |
---|
| 55 | echo " $SECONDARY_LIB_DIR/firefox-FIREFOX_VERSION/firefox not found" |
---|
| 56 | fi |
---|
| 57 | exit 1 |
---|
| 58 | fi |
---|
| 59 | MOZ_LIB_DIR="$SECONDARY_LIB_DIR" |
---|
| 60 | fi |
---|
| 61 | MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox-FIREFOX_VERSION" |
---|
| 62 | MOZ_EXTENSIONS_DIR="$MOZ_DIST_BIN/extensions" |
---|
| 63 | MOZ_PROGRAM="$MOZ_DIST_BIN/firefox" |
---|
| 64 | MOZ_LAUCHER="$MOZ_DIST_BIN/run-mozilla.sh" |
---|
| 65 | |
---|
| 66 | ## |
---|
| 67 | ## Set MOZ_GRE_CONF |
---|
| 68 | ## |
---|
| 69 | MOZ_GRE_CONF=/etc/gre.d/gre.conf |
---|
| 70 | if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then |
---|
| 71 | MOZ_GRE_CONF=/etc/gre.d/gre64.conf |
---|
| 72 | fi |
---|
| 73 | export MOZ_GRE_CONF |
---|
| 74 | |
---|
| 75 | ## |
---|
| 76 | ## Set MOZILLA_FIVE_HOME |
---|
| 77 | ## |
---|
| 78 | MOZILLA_FIVE_HOME="$MOZ_DIST_BIN" |
---|
| 79 | |
---|
| 80 | export MOZILLA_FIVE_HOME |
---|
| 81 | |
---|
| 82 | ## |
---|
| 83 | ## Select the propper plugin dir |
---|
| 84 | ## Wrapped plug-ins are located in /lib/mozilla/plugins-wrapped |
---|
| 85 | ## |
---|
| 86 | if [ -x "/usr/bin/mozilla-plugin-config" ] |
---|
| 87 | then |
---|
| 88 | MOZ_PLUGIN_DIR="plugins-wrapped" |
---|
| 89 | else |
---|
| 90 | MOZ_PLUGIN_DIR="plugins" |
---|
| 91 | fi |
---|
| 92 | |
---|
| 93 | ## |
---|
| 94 | ## Make sure that we set the plugin path |
---|
| 95 | ## |
---|
| 96 | if [ "$MOZ_PLUGIN_PATH" ] |
---|
| 97 | then |
---|
| 98 | MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR |
---|
| 99 | else |
---|
| 100 | MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR |
---|
| 101 | fi |
---|
| 102 | export MOZ_PLUGIN_PATH |
---|
| 103 | |
---|
| 104 | ## |
---|
| 105 | ## If plugins are wrapped, check them |
---|
| 106 | ## |
---|
| 107 | if [ -x "/usr/bin/mozilla-plugin-config" ] |
---|
| 108 | then |
---|
| 109 | /usr/bin/mozilla-plugin-config |
---|
| 110 | fi |
---|
| 111 | |
---|
| 112 | ## |
---|
| 113 | ## Set FONTCONFIG_PATH for Xft/fontconfig |
---|
| 114 | ## |
---|
| 115 | FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft" |
---|
| 116 | export FONTCONFIG_PATH |
---|
| 117 | |
---|
| 118 | ## |
---|
| 119 | ## Set MOZ_DISABLE_PANGO |
---|
| 120 | ## Vine Linux's firefox is build with Pango rendering by default. |
---|
| 121 | ## But Pango rendering cause slower rendering in some pages especially in CJK page. |
---|
| 122 | ## So we disable it by default. |
---|
| 123 | ## |
---|
| 124 | if [ ! "$MOZ_ENABLE_PANGO" == "1" ] |
---|
| 125 | then |
---|
| 126 | MOZ_DISABLE_PANGO=1 |
---|
| 127 | export MOZ_DISABLE_PANGO |
---|
| 128 | fi |
---|
| 129 | |
---|
| 130 | ## |
---|
| 131 | ## firefox with flash on composite enabled X server |
---|
| 132 | ## |
---|
| 133 | XLIB_SKIP_ARGB_VISUALS=1 |
---|
| 134 | export XLIB_SKIP_ARGB_VISUALS |
---|
| 135 | |
---|
| 136 | ## |
---|
| 137 | ## use Pulseaudio on Flash-plugins, if pulseaudio server is available. |
---|
| 138 | ## |
---|
| 139 | if ( /sbin/pidof pulseauido > /dev/null ) |
---|
| 140 | then |
---|
| 141 | FLASH_FORCE_PULSEAUDIO=1 |
---|
| 142 | export FLASH_FORCE_PULSEAUDIO |
---|
| 143 | fi |
---|
| 144 | |
---|
| 145 | # OK, here's where all the real work gets done |
---|
| 146 | |
---|
| 147 | # check system locale |
---|
| 148 | MOZARGS= |
---|
| 149 | MOZLOCALE=`echo $LANG | sed "s|_\([^.]*\).*|-\1|g"` |
---|
| 150 | MOZLOCALESHORT=`echo $MOZLOCALE | cut -f1 -d-` |
---|
| 151 | if [ -f $MOZILLA_FIVE_HOME/chrome/$MOZLOCALE.jar ] || [ -f $MOZILLA_FIVE_HOME/chrome/$MOZLOCALESHORT.jar ]; |
---|
| 152 | then |
---|
| 153 | MOZARGS="-UILocale $MOZLOCALE" |
---|
| 154 | else |
---|
| 155 | MOZARGS="-UILocale en-US" |
---|
| 156 | fi |
---|
| 157 | # Prepare command line arguments |
---|
| 158 | script_args="" |
---|
| 159 | pass_arg_count=0 |
---|
| 160 | while [ $# -gt $pass_arg_count ] |
---|
| 161 | do |
---|
| 162 | case "$1" in |
---|
| 163 | -g | --debug) |
---|
| 164 | script_args="$script_args -g" |
---|
| 165 | debugging=1 |
---|
| 166 | shift |
---|
| 167 | ;; |
---|
| 168 | -d | --debugger) |
---|
| 169 | if [ $# -gt 1 ]; then |
---|
| 170 | script_args="$script_args -d $2" |
---|
| 171 | shift 2 |
---|
| 172 | else |
---|
| 173 | shift |
---|
| 174 | fi |
---|
| 175 | ;; |
---|
| 176 | *) |
---|
| 177 | # Move the unrecognized argument to the end of the list. |
---|
| 178 | arg="$1" |
---|
| 179 | shift |
---|
| 180 | set -- "$@" "$arg" |
---|
| 181 | pass_arg_count=`expr $pass_arg_count + 1` |
---|
| 182 | ;; |
---|
| 183 | esac |
---|
| 184 | done |
---|
| 185 | |
---|
| 186 | # Run the browser |
---|
| 187 | debugging=0 |
---|
| 188 | if [ $debugging = 1 ] |
---|
| 189 | then |
---|
| 190 | echo $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@" |
---|
| 191 | fi |
---|
| 192 | |
---|
| 193 | exec $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@" |
---|