| 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 |
## Set MOZ_APP_LAUNCHER for gnome-session
|
| 106 |
##
|
| 107 |
export MOZ_APP_LAUNCHER="/usr/bin/firefox"
|
| 108 |
|
| 109 |
##
|
| 110 |
## If plugins are wrapped, check them
|
| 111 |
##
|
| 112 |
if [ -x "/usr/bin/mozilla-plugin-config" ]
|
| 113 |
then
|
| 114 |
/usr/bin/mozilla-plugin-config
|
| 115 |
fi
|
| 116 |
|
| 117 |
##
|
| 118 |
## Set FONTCONFIG_PATH for Xft/fontconfig
|
| 119 |
##
|
| 120 |
FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
|
| 121 |
export FONTCONFIG_PATH
|
| 122 |
|
| 123 |
##
|
| 124 |
## In order to better support certain scripts (such as Indic and some CJK
|
| 125 |
## scripts), Fedora builds its Firefox, with permission from the Mozilla
|
| 126 |
## Corporation, with the Pango system as its text renderer. This change
|
| 127 |
## may negatively impact performance on some pages. To disable the use of
|
| 128 |
## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching
|
| 129 |
## Firefox.
|
| 130 |
##
|
| 131 |
#
|
| 132 |
# MOZ_DISABLE_PANGO=1
|
| 133 |
# export MOZ_DISABLE_PANGO
|
| 134 |
#
|
| 135 |
|
| 136 |
##
|
| 137 |
## Disable the GNOME crash dialog, Moz has it's own
|
| 138 |
##
|
| 139 |
GNOME_DISABLE_CRASH_DIALOG=1
|
| 140 |
export GNOME_DISABLE_CRASH_DIALOG
|
| 141 |
|
| 142 |
# OK, here's where all the real work gets done
|
| 143 |
|
| 144 |
# check system locale
|
| 145 |
MOZARGS=
|
| 146 |
# Try without a local variant first, then with a local variant
|
| 147 |
# So that pt-BR doesn't try to use pt for example
|
| 148 |
SHORTMOZLOCALE=`echo $LC_MESSAGES | sed "s|_\([^.]*\).*||g"`
|
| 149 |
[ -f $MOZ_EXTENSIONS_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org/chrome/$SHORTMOZLOCALE.jar ] && MOZARGS="-UILocale $SHORTMOZLOCALE"
|
| 150 |
|
| 151 |
MOZLOCALE=`echo $LC_MESSAGES | sed "s|_\([^.]*\).*|-\1|g"`
|
| 152 |
[ -f $MOZ_EXTENSIONS_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org/chrome/$MOZLOCALE.jar ] && MOZARGS="-UILocale $MOZLOCALE"
|
| 153 |
|
| 154 |
# Prepare command line arguments
|
| 155 |
script_args=""
|
| 156 |
pass_arg_count=0
|
| 157 |
while [ $# -gt $pass_arg_count ]
|
| 158 |
do
|
| 159 |
case "$1" in
|
| 160 |
-g | --debug)
|
| 161 |
script_args="$script_args -g"
|
| 162 |
debugging=1
|
| 163 |
shift
|
| 164 |
;;
|
| 165 |
-d | --debugger)
|
| 166 |
if [ $# -gt 1 ]; then
|
| 167 |
script_args="$script_args -d $2"
|
| 168 |
shift 2
|
| 169 |
else
|
| 170 |
shift
|
| 171 |
fi
|
| 172 |
;;
|
| 173 |
*)
|
| 174 |
# Move the unrecognized argument to the end of the list.
|
| 175 |
arg="$1"
|
| 176 |
shift
|
| 177 |
set -- "$@" "$arg"
|
| 178 |
pass_arg_count=`expr $pass_arg_count + 1`
|
| 179 |
;;
|
| 180 |
esac
|
| 181 |
done
|
| 182 |
|
| 183 |
# Run the browser
|
| 184 |
debugging=0
|
| 185 |
if [ $debugging = 1 ]
|
| 186 |
then
|
| 187 |
echo $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
|
| 188 |
fi
|
| 189 |
|
| 190 |
exec $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
|