firefox/SOURCES/firefox.sh.in
2022-03-10 14:39:07 +00:00

171 lines
3.9 KiB
Bash

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