|
|
29a772 |
#!/bin/sh
|
|
|
29a772 |
#
|
|
|
29a772 |
# The contents of this file are subject to the Netscape Public
|
|
|
29a772 |
# License Version 1.1 (the "License"); you may not use this file
|
|
|
29a772 |
# except in compliance with the License. You may obtain a copy of
|
|
|
29a772 |
# the License at http://www.mozilla.org/NPL/
|
|
|
29a772 |
#
|
|
|
29a772 |
# Software distributed under the License is distributed on an "AS
|
|
|
29a772 |
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
29a772 |
# implied. See the License for the specific language governing
|
|
|
29a772 |
# rights and limitations under the License.
|
|
|
29a772 |
#
|
|
|
29a772 |
# The Original Code is mozilla.org code.
|
|
|
29a772 |
#
|
|
|
29a772 |
# The Initial Developer of the Original Code is Netscape
|
|
|
29a772 |
# Communications Corporation. Portions created by Netscape are
|
|
|
29a772 |
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
29a772 |
# Rights Reserved.
|
|
|
29a772 |
#
|
|
|
29a772 |
# Contributor(s):
|
|
|
29a772 |
#
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Usage:
|
|
|
29a772 |
##
|
|
|
29a772 |
## $ firefox
|
|
|
29a772 |
##
|
|
|
29a772 |
## This script is meant to run a mozilla program from the mozilla
|
|
|
29a772 |
## rpm installation.
|
|
|
29a772 |
##
|
|
|
29a772 |
## The script will setup all the environment voodoo needed to make
|
|
|
29a772 |
## mozilla work.
|
|
|
29a772 |
|
|
|
29a772 |
cmdname=`basename $0`
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Variables
|
|
|
29a772 |
##
|
|
|
29a772 |
MOZ_ARCH=$(uname -m)
|
|
|
29a772 |
case $MOZ_ARCH in
|
|
|
29a772 |
x86_64 | s390x | sparc64)
|
|
|
29a772 |
MOZ_LIB_DIR="/usr/lib64"
|
|
|
29a772 |
SECONDARY_LIB_DIR="/usr/lib"
|
|
|
29a772 |
;;
|
|
|
29a772 |
* )
|
|
|
29a772 |
MOZ_LIB_DIR="/usr/lib"
|
|
|
29a772 |
SECONDARY_LIB_DIR="/usr/lib64"
|
|
|
29a772 |
;;
|
|
|
29a772 |
esac
|
|
|
29a772 |
|
|
|
29a772 |
MOZ_FIREFOX_FILE="firefox"
|
|
|
29a772 |
|
|
|
29a772 |
if [ ! -r $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then
|
|
|
29a772 |
if [ ! -r $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then
|
|
|
29a772 |
echo "Error: $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found"
|
|
|
29a772 |
if [ -d $SECONDARY_LIB_DIR ]; then
|
|
|
29a772 |
echo " $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found"
|
|
|
29a772 |
fi
|
|
|
29a772 |
exit 1
|
|
|
29a772 |
fi
|
|
|
29a772 |
MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
|
|
|
29a772 |
fi
|
|
|
29a772 |
MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox"
|
|
|
29a772 |
MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
|
|
|
29a772 |
MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
|
|
29a772 |
MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
|
|
|
29a772 |
MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Set MOZ_GRE_CONF
|
|
|
29a772 |
##
|
|
|
29a772 |
MOZ_GRE_CONF=/etc/gre.d/gre.conf
|
|
|
29a772 |
if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
|
|
|
29a772 |
MOZ_GRE_CONF=/etc/gre.d/gre64.conf
|
|
|
29a772 |
fi
|
|
|
29a772 |
export MOZ_GRE_CONF
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Set MOZILLA_FIVE_HOME
|
|
|
29a772 |
##
|
|
|
29a772 |
MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
|
|
|
29a772 |
|
|
|
29a772 |
export MOZILLA_FIVE_HOME
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Select the propper plugin dir
|
|
|
29a772 |
## Wrapped plug-ins are located in /lib/mozilla/plugins-wrapped
|
|
|
29a772 |
##
|
|
|
29a772 |
if [ -x "/usr/bin/mozilla-plugin-config" ]
|
|
|
29a772 |
then
|
|
|
29a772 |
MOZ_PLUGIN_DIR="plugins-wrapped"
|
|
|
29a772 |
else
|
|
|
29a772 |
MOZ_PLUGIN_DIR="plugins"
|
|
|
29a772 |
fi
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Make sure that we set the plugin path
|
|
|
29a772 |
##
|
|
|
29a772 |
if [ "$MOZ_PLUGIN_PATH" ]
|
|
|
29a772 |
then
|
|
|
29a772 |
MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
|
|
|
29a772 |
else
|
|
|
29a772 |
MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
|
|
|
29a772 |
fi
|
|
|
29a772 |
export MOZ_PLUGIN_PATH
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Set MOZ_APP_LAUNCHER for gnome-session
|
|
|
29a772 |
##
|
|
|
29a772 |
export MOZ_APP_LAUNCHER="/usr/bin/firefox"
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## If plugins are wrapped, check them
|
|
|
29a772 |
##
|
|
|
29a772 |
if [ -x "/usr/bin/mozilla-plugin-config" ]
|
|
|
29a772 |
then
|
|
|
29a772 |
/usr/bin/mozilla-plugin-config
|
|
|
29a772 |
fi
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Set FONTCONFIG_PATH for Xft/fontconfig
|
|
|
29a772 |
##
|
|
|
29a772 |
FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
|
|
|
29a772 |
export FONTCONFIG_PATH
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## In order to better support certain scripts (such as Indic and some CJK
|
|
|
29a772 |
## scripts), Fedora builds its Firefox, with permission from the Mozilla
|
|
|
29a772 |
## Corporation, with the Pango system as its text renderer. This change
|
|
|
29a772 |
## may negatively impact performance on some pages. To disable the use of
|
|
|
29a772 |
## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching
|
|
|
29a772 |
## Firefox.
|
|
|
29a772 |
##
|
|
|
29a772 |
#
|
|
|
29a772 |
# MOZ_DISABLE_PANGO=1
|
|
|
29a772 |
# export MOZ_DISABLE_PANGO
|
|
|
29a772 |
#
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Disable the GNOME crash dialog, Moz has it's own
|
|
|
29a772 |
##
|
|
|
29a772 |
GNOME_DISABLE_CRASH_DIALOG=1
|
|
|
29a772 |
export GNOME_DISABLE_CRASH_DIALOG
|
|
|
29a772 |
|
|
|
29a772 |
# OK, here's where all the real work gets done
|
|
|
29a772 |
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## To disable the use of Firefox localization, set MOZ_DISABLE_LANGPACKS=1
|
|
|
29a772 |
## in your environment before launching Firefox.
|
|
|
29a772 |
##
|
|
|
29a772 |
#
|
|
|
29a772 |
# MOZ_DISABLE_LANGPACKS=1
|
|
|
29a772 |
# export MOZ_DISABLE_LANGPACKS
|
|
|
29a772 |
#
|
|
|
29a772 |
|
|
|
29a772 |
##
|
|
|
29a772 |
## Automatically installed langpacks are tracked by .fedora-langpack-install
|
|
|
29a772 |
## config file.
|
|
|
29a772 |
##
|
|
|
29a772 |
FEDORA_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.fedora-langpack-install"
|
|
|
29a772 |
|
|
|
29a772 |
# MOZ_DISABLE_LANGPACKS disables language packs completely
|
|
|
29a772 |
MOZILLA_DOWN=0
|
|
|
29a772 |
if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
|
|
|
6ca8db |
if [ -x $MOZ_DIST_BIN/mozilla-xremote-client ]; then
|
|
|
29a772 |
# Is firefox running?
|
|
|
6ca8db |
$MOZ_DIST_BIN/mozilla-xremote-client -a firefox 'ping()' > /dev/null 2>&1
|
|
|
29a772 |
MOZILLA_DOWN=$?
|
|
|
29a772 |
fi
|
|
|
29a772 |
fi
|
|
|
29a772 |
|
|
|
29a772 |
# Modify language pack configuration only when firefox is not running
|
|
|
29a772 |
# and language packs are not disabled
|
|
|
29a772 |
if [ $MOZILLA_DOWN -ne 0 ]; then
|
|
|
29a772 |
|
|
|
29a772 |
# Clear already installed langpacks
|
|
|
29a772 |
mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR
|
|
|
29a772 |
if [ -f $FEDORA_LANGPACK_CONFIG ]; then
|
|
|
29a772 |
rm `cat $FEDORA_LANGPACK_CONFIG` > /dev/null 2>&1
|
|
|
29a772 |
rm $FEDORA_LANGPACK_CONFIG > /dev/null 2>&1
|
|
|
9a1d2e |
# remove all empty langpacks dirs while they block installation of langpacks
|
|
|
9a1d2e |
# (rhbz#1067343)
|
|
|
9a1d2e |
rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1
|
|
|
29a772 |
fi
|
|
|
29a772 |
|
|
|
29a772 |
# Get locale from system
|
|
|
29a772 |
CURRENT_LOCALE=$LC_ALL
|
|
|
29a772 |
CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
|
|
|
29a772 |
CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
|
|
|
29a772 |
|
|
|
29a772 |
# Try without a local variant first, then with a local variant
|
|
|
29a772 |
# So that pt-BR doesn't try to use pt for example
|
|
|
29a772 |
SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
|
|
|
29a772 |
MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
|
|
|
29a772 |
|
|
|
29a772 |
function create_langpack_link() {
|
|
|
29a772 |
local language=$*
|
|
|
29a772 |
local langpack=langpack-${language}@firefox.mozilla.org.xpi
|
|
|
29a772 |
if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
|
|
|
29a772 |
rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
|
|
|
29a772 |
ln -s $MOZ_LANGPACKS_DIR/$langpack \
|
|
|
29a772 |
$MOZ_EXTENSIONS_PROFILE_DIR/$langpack
|
|
|
29a772 |
echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG
|
|
|
29a772 |
return 0
|
|
|
29a772 |
fi
|
|
|
29a772 |
return 1
|
|
|
29a772 |
}
|
|
|
29a772 |
|
|
|
29a772 |
create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
|
|
|
29a772 |
fi
|
|
|
29a772 |
|
|
|
29a772 |
# BEAST fix (rhbz#838879)
|
|
|
29a772 |
NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1}
|
|
|
29a772 |
export NSS_SSL_CBC_RANDOM_IV
|
|
|
29a772 |
|
|
|
29a772 |
# Prepare command line arguments
|
|
|
29a772 |
script_args=""
|
|
|
29a772 |
pass_arg_count=0
|
|
|
29a772 |
while [ $# -gt $pass_arg_count ]
|
|
|
29a772 |
do
|
|
|
29a772 |
case "$1" in
|
|
|
29a772 |
-g | --debug)
|
|
|
29a772 |
script_args="$script_args -g"
|
|
|
29a772 |
debugging=1
|
|
|
29a772 |
shift
|
|
|
29a772 |
;;
|
|
|
29a772 |
-d | --debugger)
|
|
|
29a772 |
if [ $# -gt 1 ]; then
|
|
|
29a772 |
script_args="$script_args -d $2"
|
|
|
29a772 |
shift 2
|
|
|
29a772 |
else
|
|
|
29a772 |
shift
|
|
|
29a772 |
fi
|
|
|
29a772 |
;;
|
|
|
29a772 |
*)
|
|
|
29a772 |
# Move the unrecognized argument to the end of the list.
|
|
|
29a772 |
arg="$1"
|
|
|
29a772 |
shift
|
|
|
29a772 |
set -- "$@" "$arg"
|
|
|
29a772 |
pass_arg_count=`expr $pass_arg_count + 1`
|
|
|
29a772 |
;;
|
|
|
29a772 |
esac
|
|
|
29a772 |
done
|
|
|
29a772 |
|
|
|
29a772 |
# Run the browser
|
|
|
29a772 |
debugging=0
|
|
|
29a772 |
if [ $debugging = 1 ]
|
|
|
29a772 |
then
|
|
|
29a772 |
echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
|
|
|
29a772 |
fi
|
|
|
29a772 |
|
|
|
29a772 |
exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
|