cvsdist cac9c1c
#!/bin/sh
cvsdist cac9c1c
#
cvsdist cac9c1c
# The contents of this file are subject to the Netscape Public
cvsdist cac9c1c
# License Version 1.1 (the "License"); you may not use this file
cvsdist cac9c1c
# except in compliance with the License. You may obtain a copy of
cvsdist cac9c1c
# the License at http://www.mozilla.org/NPL/
cvsdist cac9c1c
#
cvsdist cac9c1c
# Software distributed under the License is distributed on an "AS
cvsdist cac9c1c
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
cvsdist cac9c1c
# implied. See the License for the specific language governing
cvsdist cac9c1c
# rights and limitations under the License.
cvsdist cac9c1c
#
cvsdist cac9c1c
# The Original Code is mozilla.org code.
cvsdist cac9c1c
#
cvsdist cac9c1c
# The Initial Developer of the Original Code is Netscape
cvsdist cac9c1c
# Communications Corporation.  Portions created by Netscape are
cvsdist cac9c1c
# Copyright (C) 1998 Netscape Communications Corporation. All
cvsdist cac9c1c
# Rights Reserved.
cvsdist cac9c1c
#
cvsdist cac9c1c
# Contributor(s): 
cvsdist cac9c1c
#
cvsdist cac9c1c
cvsdist cac9c1c
## 
cvsdist cac9c1c
## Usage:
cvsdist cac9c1c
##
cvsdist cac9c1c
## $ mozilla
cvsdist cac9c1c
##
cvsdist cac9c1c
## This script is meant to run a mozilla program from the mozilla
cvsdist cac9c1c
## rpm installation.
cvsdist cac9c1c
##
cvsdist cac9c1c
## The script will setup all the environment voodoo needed to make
cvsdist cac9c1c
## mozilla work.
cvsdist cac9c1c
cvsdist cac9c1c
cmdname=`basename $0`
cvsdist cac9c1c
cvsdist cac9c1c
##
cvsdist cac9c1c
## Variables
cvsdist cac9c1c
##
fa5aab6
MOZ_ARCH=$(uname -m)
fa5aab6
case $MOZ_ARCH in
fa5aab6
	x86_64 | ia64 | s390 )
fa5aab6
		MOZ_LIB_DIR="/usr/lib64"
fa5aab6
		SECONDARY_LIB_DIR="/usr/lib"
fa5aab6
		;;
fa5aab6
	* )
fa5aab6
		MOZ_LIB_DIR="/usr/lib"
fa5aab6
		SECONDARY_LIB_DIR="/usr/lib64"
fa5aab6
		;;
fa5aab6
esac
fa5aab6
c4be312
if [ ! -x $MOZ_LIB_DIR/firefox-FIREFOX_VERSION/firefox ]; then
c4be312
    if [ ! -x $SECONDARY_LIB_DIR/firefox-FIREFOX_VERSION/firefox ]; then
c4be312
	echo "Error: $MOZ_LIB_DIR/firefox-FIREFOX_VERSION/firefox not found"
fa5aab6
	if [ -d $SECONDARY_LIB_DIR ]; then
c4be312
	    echo "       $SECONDARY_LIB_DIR/firefox-FIREFOX_VERSION/firefox not found"
fa5aab6
	fi
fa5aab6
	exit 1
fa5aab6
    fi
fa5aab6
    MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
74adc9d
fi
74adc9d
MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox-FIREFOX_VERSION"
89a39c8
MOZ_EXTENSIONS_DIR="$MOZ_DIST_BIN/extensions"
2261537
MOZ_PROGRAM="$MOZ_DIST_BIN/firefox"
ee9e9cf
MOZ_LAUCHER="$MOZ_DIST_BIN/run-mozilla.sh"
ee9e9cf
 
cvsdist cac9c1c
##
557e35a
## Set MOZ_GRE_CONF
557e35a
##
557e35a
MOZ_GRE_CONF=/etc/gre.d/gre.conf
557e35a
if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
557e35a
  MOZ_GRE_CONF=/etc/gre.d/gre64.conf
557e35a
fi
557e35a
export MOZ_GRE_CONF
557e35a
557e35a
##
cvsdist cac9c1c
## Set MOZILLA_FIVE_HOME
cvsdist cac9c1c
##
cvsdist cac9c1c
MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
cvsdist cac9c1c
cvsdist cac9c1c
export MOZILLA_FIVE_HOME
cvsdist cac9c1c
15debc1
##
15debc1
## Select the propper plugin dir
15debc1
## Wrapped plug-ins are located in /lib/mozilla/plugins-wrapped
15debc1
##
9ba2f30
if [ -x "/usr/bin/mozilla-plugin-config" ]
15debc1
then
15debc1
  MOZ_PLUGIN_DIR="plugins-wrapped"
15debc1
else
15debc1
  MOZ_PLUGIN_DIR="plugins"
15debc1
fi
cvsdist cac9c1c
cvsdist cac9c1c
##
536c4ad
## Make sure that we set the plugin path
cvsdist cac9c1c
##
cvsdist cac9c1c
if [ "$MOZ_PLUGIN_PATH" ]
cvsdist cac9c1c
then
15debc1
  MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
cvsdist cac9c1c
else
15debc1
  MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
cvsdist cac9c1c
fi
cvsdist cac9c1c
export MOZ_PLUGIN_PATH
cvsdist cac9c1c
383a808
##
9159d3c
## Set MOZ_APP_LAUNCHER for gnome-session
9159d3c
##
9159d3c
export MOZ_APP_LAUNCHER="/usr/bin/firefox"
9159d3c
9159d3c
##
cac1096
## If plugins are wrapped, check them
cac1096
##
cac1096
if [ -x "/usr/bin/mozilla-plugin-config" ]
cac1096
then
cac1096
  /usr/bin/mozilla-plugin-config
cac1096
fi
cac1096
cac1096
##
cvsdist cac9c1c
## Set FONTCONFIG_PATH for Xft/fontconfig
cvsdist cac9c1c
##
cvsdist cac9c1c
FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
cvsdist cac9c1c
export FONTCONFIG_PATH
cvsdist cac9c1c
2ca6e87
##
da97c6e
## In order to better support certain scripts (such as Indic and some CJK 
da97c6e
## scripts), Fedora builds its Firefox, with permission from the Mozilla 
da97c6e
## Corporation, with the Pango system as its text renderer.  This change 
besfahbo 580eb13
## may negatively impact performance on some pages.  To disable the use of
besfahbo 580eb13
## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching
besfahbo 580eb13
## Firefox.
2ca6e87
##
da97c6e
#
da97c6e
# MOZ_DISABLE_PANGO=1
da97c6e
# export MOZ_DISABLE_PANGO
da97c6e
#
f381d84
018bdff
##
018bdff
## Disable the GNOME crash dialog, Moz has it's own
018bdff
##
018bdff
GNOME_DISABLE_CRASH_DIALOG=1
018bdff
export GNOME_DISABLE_CRASH_DIALOG
018bdff
cvsdist cac9c1c
# OK, here's where all the real work gets done
cvsdist cac9c1c
cvsdist cac9c1c
# check system locale
cvsdist cac9c1c
MOZARGS=
6afc94d
# Try without a local variant first, then with a local variant
6afc94d
# So that pt-BR doesn't try to use pt for example
a31088e
SHORTMOZLOCALE=`echo $LC_MESSAGES | sed "s|_\([^.]*\).*||g"`
6afc94d
[ -f $MOZ_EXTENSIONS_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org/chrome/$SHORTMOZLOCALE.jar ] && MOZARGS="-UILocale $SHORTMOZLOCALE"
6afc94d
a31088e
MOZLOCALE=`echo $LC_MESSAGES | sed "s|_\([^.]*\).*|-\1|g"`
6afc94d
[ -f $MOZ_EXTENSIONS_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org/chrome/$MOZLOCALE.jar ] && MOZARGS="-UILocale $MOZLOCALE"
cvsdist cac9c1c
ee9e9cf
# Prepare command line arguments
ee9e9cf
script_args=""
ee9e9cf
pass_arg_count=0
ee9e9cf
while [ $# -gt $pass_arg_count ]
ee9e9cf
do
ee9e9cf
  case "$1" in
ee9e9cf
    -g | --debug)
ee9e9cf
      script_args="$script_args -g"
ee9e9cf
      debugging=1
ee9e9cf
      shift
ee9e9cf
      ;;
ee9e9cf
    -d | --debugger)
e530b2e
      if [ $# -gt 1 ]; then
e530b2e
        script_args="$script_args -d $2"
e530b2e
        shift 2
e530b2e
      else
e530b2e
        shift
e530b2e
      fi
ee9e9cf
      ;;
ee9e9cf
    *)
ee9e9cf
      # Move the unrecognized argument to the end of the list.
ee9e9cf
      arg="$1"
ee9e9cf
      shift
ee9e9cf
      set -- "$@" "$arg"
ee9e9cf
      pass_arg_count=`expr $pass_arg_count + 1`
ee9e9cf
      ;;
ee9e9cf
  esac
ee9e9cf
done
ee9e9cf
cac1096
# Run the browser
ee9e9cf
debugging=0
ee9e9cf
if [ $debugging = 1 ]
ee9e9cf
then
ee9e9cf
  echo $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
ee9e9cf
fi
ee9e9cf
ee9e9cf
exec $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"