@@ -0,0 +1,330 @@
+#!/bin/sh
+#
+# 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):
+# Wolfgang Rosenauer <wolfgang.rosenauer@suse.de>
+#
+
+##
+## Usage:
+##
+## $ mozilla
+##
+## 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_DIST_BIN="%PREFIX"
+MOZ_DIST_LIB="%PROGDIR"
+MOZ_APPNAME="%APPNAME"
+MOZ_PROFILE="%PROFILE"
+MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME-bin"
+MOZ_CLIENT_PROGRAM="$MOZ_DIST_LIB/mozilla-xremote-client -a $MOZ_APPNAME"
+
+mozilla_lib=`file $MOZ_PROGRAM`
+LIB=lib
+echo $mozilla_lib | grep -q -E 'x86-64|s390x|ppc64' && LIB=lib64
+
+BROWSER_PLUGIN_DIR=/usr/$LIB/browser-plugins
+if [ ! -d $BROWSER_PLUGIN_DIR ]; then
+ BROWSER_PLUGIN_DIR=/opt/netscape/plugins
+fi
+
+# AOSS
+AOSS=$(which aoss)
+
+# enigmail should honor env
+export ENIGMAIL_PASS_ENV=http_proxy
+
+# Force use of GTK+ 2.0 for Flash player to get better performance
+# (no impact when using mozilla gtk1 build
+#
+export FLASH_GTK_LIBRARY=libgtk-x11-2.0.so.0
+
+# ignore composite extension (needed for Flash)
+export XLIB_SKIP_ARGB_VISUALS=1
+
+# needed for SUN Java under Xorg >= 7.2
+export LIBXCB_ALLOW_SLOPPY_LOCK=1
+
+# Pango support
+if [ -z "$MOZ_ENABLE_PANGO" -a -z "$MOZ_DISABLE_PANGO" ]; then
+ case "${LC_ALL-${LC_CTYPE-${LANG-en_US}}}" in
+ bn*|gu*|hi*|ja*|km*|kn*|ml*|mr*|pa*|ta*|te*) # list of languages which need pango
+ ;;
+ *)
+ export MOZ_DISABLE_PANGO=1 # disable by default
+ ;;
+ esac
+fi
+
+if [ -z "$MOZ_DEBUG" ]; then
+ DEBUG=0
+else
+ DEBUG=$MOZ_DEBUG
+fi
+
+##
+## Set MOZILLA_FIVE_HOME
+##
+MOZILLA_FIVE_HOME="$MOZ_DIST_LIB"
+export MOZILLA_FIVE_HOME
+
+##
+## Set LD_LIBRARY_PATH
+##
+if [ "$LD_LIBRARY_PATH" ]
+then
+ LD_LIBRARY_PATH=$MOZ_DIST_LIB/plugins:$MOZ_DIST_LIB:$LD_LIBRARY_PATH
+else
+ LD_LIBRARY_PATH=$MOZ_DIST_LIB/plugins:$MOZ_DIST_LIB
+fi
+export LD_LIBRARY_PATH
+
+## Make sure that we set the plugin path for backwards compatibility
+## Set MOZ_PLUGIN_PATH to $HOME/.mozilla/plugins if not set
+##
+if [ -z "$MOZ_PLUGIN_PATH" ]; then
+ export MOZ_PLUGIN_PATH=$MOZILLA_FIVE_HOME/plugins:$BROWSER_PLUGIN_DIR
+ if [ "$HOME" ] ; then
+ export MOZ_PLUGIN_PATH=$HOME/$MOZ_PROFILE/plugins:$MOZ_PLUGIN_PATH
+ fi
+else
+ # make sure that BROWSER_PLUGIN_DIR is in MOZ_PLUGIN_PATH
+ echo "$MOZ_PLUGIN_PATH" | grep "$BROWSER_PLUGIN_DIR" 2>&1 >/dev/null
+ _retval=$?
+ if [ ${_retval} -ne 0 ]; then
+ export MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$BROWSER_PLUGIN_DIR
+ fi
+fi
+
+##
+## Autodetect UI language
+##
+grep -q $HOME/$MOZ_PROFILE $HOME/$MOZ_PROFILE/appreg > /dev/null 2>/dev/null
+SET_LANG=$?
+if [ "$HOME" -a "$LANG" -a "$SET_LANG" != "0" -a -r "$MOZILLA_FIVE_HOME/chrome/locale.alias" ]; then
+ MOZ_LANG=`grep -E "^$LANG[[:space:]]" $MOZILLA_FIVE_HOME/chrome/locale.alias | tr -s "[:blank:]" | cut -d' ' -f 2`
+ MOZ_LOC=${MOZ_LANG#*-}
+ for i in "$@";do
+ [ "$i" = "-UILocale" ] && MOZ_LANG=""
+ done
+ if [ "$MOZ_LANG" -a -r "$MOZILLA_FIVE_HOME/chrome/$MOZ_LANG.jar" ]; then
+ MOZ_LANG="-UILocale $MOZ_LANG -ContentLocale $MOZ_LOC"
+ else
+ unset MOZ_LANG
+ fi
+fi
+
+bail ()
+{
+ ## Stop addon scripts
+ moz_pis_startstop_scripts "stop"
+ exit "$1"
+}
+
+
+function check_running() {
+ # this should only check for instances on the same display
+ # as long a --display is not used
+ RETURN_VAL=2
+ if [ -n "$X_DISPLAY" -o ${DISPLAY:0:1} = ":" ] ; then
+ $MOZ_CLIENT_PROGRAM $X_DISPLAY 'ping()' 2>/dev/null >/dev/null
+ RETURN_VAL=$?
+ fi
+
+ if [ $RETURN_VAL -eq 2 ]; then
+ # not running
+ echo 0
+ return 0
+ elif [ $RETURN_VAL -eq 1 ]; then
+ # DISPLAY unusable
+ echo 2
+ return 2
+ else
+ # running
+ echo 1
+ return 1
+ fi
+}
+
+function open_mail() {
+ if [ ${ALREADY_RUNNING} -eq 1 ]; then
+ $MOZ_CLIENT_PROGRAM $X_DISPLAY 'xfeDoCommand(openInbox)'
+ bail $?
+ else
+ $AOSS $MOZ_PROGRAM $MOZ_LANG "$@"
+ bail $?
+ fi
+}
+
+function open_compose() {
+ if [ ${ALREADY_RUNNING} -eq 1 ]; then
+ MAILTO=`echo $2 | awk 'BEGIN{FS=":"} $1 ~ /mailto/ {print $2}'`
+ $MOZ_CLIENT_PROGRAM $X_DISPLAY "mailto($MAILTO)"
+ bail $?
+ else
+ $AOSS $MOZ_PROGRAM $MOZ_LANG "$@"
+ bail $?
+ fi
+}
+
+moz_pis_startstop_scripts()
+{
+ MOZ_USER_DIR="$MOZ_PROFILE"
+ # MOZ_PIS_ is the name space for "Mozilla Plugable Init Scripts"
+ # These variables and there meaning are specified in
|