dd1d2c
#!/bin/bash
dd1d2c
#
dd1d2c
# The contents of this file are subject to the Netscape Public
dd1d2c
# License Version 1.1 (the "License"); you may not use this file
dd1d2c
# except in compliance with the License. You may obtain a copy of
dd1d2c
# the License at http://www.mozilla.org/NPL/
dd1d2c
#
dd1d2c
# Software distributed under the License is distributed on an "AS
dd1d2c
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
dd1d2c
# implied. See the License for the specific language governing
dd1d2c
# rights and limitations under the License.
dd1d2c
#
dd1d2c
# The Original Code is mozilla.org code.
dd1d2c
#
dd1d2c
# The Initial Developer of the Original Code is Netscape
dd1d2c
# Communications Corporation.  Portions created by Netscape are
dd1d2c
# Copyright (C) 1998 Netscape Communications Corporation. All
dd1d2c
# Rights Reserved.
dd1d2c
#
dd1d2c
# Contributor(s): 
dd1d2c
#
dd1d2c
dd1d2c
## 
dd1d2c
## Usage:
dd1d2c
##
dd1d2c
## $ firefox
dd1d2c
##
dd1d2c
## This script is meant to run a mozilla program from the mozilla
dd1d2c
## rpm installation.
dd1d2c
##
dd1d2c
## The script will setup all the environment voodoo needed to make
dd1d2c
## mozilla work.
dd1d2c
dd1d2c
cmdname=`basename $0`
dd1d2c
dd1d2c
##
dd1d2c
## Variables
dd1d2c
##
dd1d2c
MOZ_ARCH=$(uname -m)
dd1d2c
case $MOZ_ARCH in
dd1d2c
	x86_64 | s390x | sparc64)
dd1d2c
		MOZ_LIB_DIR="%PREFIX%/lib64"
dd1d2c
		SECONDARY_LIB_DIR="%PREFIX%/lib"
dd1d2c
		;;
dd1d2c
	* )
dd1d2c
		MOZ_LIB_DIR="%PREFIX%/lib"
dd1d2c
		SECONDARY_LIB_DIR="%PREFIX%/lib64"
dd1d2c
		;;
dd1d2c
esac
dd1d2c
dd1d2c
MOZ_FIREFOX_FILE="firefox"
dd1d2c
dd1d2c
if [ ! -r $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then
dd1d2c
    if [ ! -r $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then
dd1d2c
	echo "Error: $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found"
dd1d2c
	if [ -d $SECONDARY_LIB_DIR ]; then
dd1d2c
	    echo "       $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found"
dd1d2c
	fi
dd1d2c
	exit 1
dd1d2c
    fi
dd1d2c
    MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
dd1d2c
fi
dd1d2c
MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox"
dd1d2c
MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
dd1d2c
MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
dd1d2c
dd1d2c
##
dd1d2c
## Set MOZ_GRE_CONF
dd1d2c
##
dd1d2c
MOZ_GRE_CONF=/etc/gre.d/gre.conf
dd1d2c
if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
dd1d2c
  MOZ_GRE_CONF=/etc/gre.d/gre64.conf
dd1d2c
fi
dd1d2c
export MOZ_GRE_CONF
dd1d2c
dd1d2c
##
dd1d2c
## Set MOZILLA_FIVE_HOME
dd1d2c
##
dd1d2c
MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
dd1d2c
dd1d2c
export MOZILLA_FIVE_HOME
dd1d2c
dd1d2c
##
dd1d2c
## Make sure that we set the plugin path
dd1d2c
##
dd1d2c
MOZ_PLUGIN_DIR="plugins"
dd1d2c
dd1d2c
if [ "$MOZ_PLUGIN_PATH" ]
dd1d2c
then
dd1d2c
  MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
dd1d2c
else
dd1d2c
  MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
dd1d2c
fi
dd1d2c
export MOZ_PLUGIN_PATH
dd1d2c
dd1d2c
##
dd1d2c
## Set MOZ_APP_LAUNCHER for gnome-session
dd1d2c
##
dd1d2c
export MOZ_APP_LAUNCHER="%PREFIX%/bin/firefox"
dd1d2c
dd1d2c
##
dd1d2c
## In order to better support certain scripts (such as Indic and some CJK 
dd1d2c
## scripts), Fedora builds its Firefox, with permission from the Mozilla 
dd1d2c
## Corporation, with the Pango system as its text renderer.  This change 
dd1d2c
## may negatively impact performance on some pages.  To disable the use of
dd1d2c
## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching
dd1d2c
## Firefox.
dd1d2c
##
dd1d2c
#
dd1d2c
# MOZ_DISABLE_PANGO=1
dd1d2c
# export MOZ_DISABLE_PANGO
dd1d2c
#
dd1d2c
dd1d2c
##
dd1d2c
## Disable the GNOME crash dialog, Moz has it's own
dd1d2c
##
dd1d2c
GNOME_DISABLE_CRASH_DIALOG=1
dd1d2c
export GNOME_DISABLE_CRASH_DIALOG
dd1d2c
dd1d2c
##
dd1d2c
## Disable the SLICE allocator (rhbz#1014858)
dd1d2c
##
dd1d2c
export G_SLICE=always-malloc
dd1d2c
dd1d2c
##
dd1d2c
## Enable Xinput2 (mozbz#1207973)
dd1d2c
##
dd1d2c
export MOZ_USE_XINPUT2=1
dd1d2c
dd1d2c
# BEAST fix (rhbz#1005611)
dd1d2c
NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1}
dd1d2c
export NSS_SSL_CBC_RANDOM_IV
dd1d2c
dd1d2c
# Prepare command line arguments
dd1d2c
script_args=""
dd1d2c
pass_arg_count=0
dd1d2c
while [ $# -gt $pass_arg_count ]
dd1d2c
do
dd1d2c
  case "$1" in
dd1d2c
    -g | --debug)
dd1d2c
      script_args="$script_args -g"
dd1d2c
      debugging=1
dd1d2c
      shift
dd1d2c
      ;;
dd1d2c
    -d | --debugger)
dd1d2c
      if [ $# -gt 1 ]; then
dd1d2c
        script_args="$script_args -d $2"
dd1d2c
        shift 2
dd1d2c
      else
dd1d2c
        shift
dd1d2c
      fi
dd1d2c
      ;;
dd1d2c
    *)
dd1d2c
      # Move the unrecognized argument to the end of the list.
dd1d2c
      arg="$1"
dd1d2c
      shift
dd1d2c
      set -- "$@" "$arg"
dd1d2c
      pass_arg_count=`expr $pass_arg_count + 1`
dd1d2c
      ;;
dd1d2c
  esac
dd1d2c
done
dd1d2c
dd1d2c
# Linux version specific environment variables
dd1d2c
%RHEL_ENV_VARS%
dd1d2c
dd1d2c
# Don't throw "old profile" dialog box.
dd1d2c
export MOZ_ALLOW_DOWNGRADE=1
dd1d2c
dd1d2c
# Run the browser
dd1d2c
exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"