MozillaThunderbird/mozilla.sh.in

142 lines
3.5 KiB
Bash

#!/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"
# enigmail should honor env
export ENIGMAIL_PASS_ENV=http_proxy
# AOSS
AOSS=$(which aoss)
# ignore composite extension
export XLIB_SKIP_ARGB_VISUALS=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*|km*|kn*|ml*|mr*|pa*|ta*|te*) # list of languages which need pango
;;
*)
export MOZ_DISABLE_PANGO=1 # disable by default
;;
esac
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
if [ "$HOME" ] ; then
export MOZ_PLUGIN_PATH=$HOME/$MOZ_PROFILE/plugins:$MOZ_PLUGIN_PATH
fi
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
# mozilla/xpfe/bootstrap/init.d/README
MOZ_PIS_API=2
MOZ_PIS_MOZBINDIR="$MOZ_DIST_LIB"
MOZ_PIS_SESSION_PID="$$"
MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
case "${1}" in
"start")
for curr_pis in "$MOZ_DIST_LIB/init.d"/S* "${HOME}/${MOZ_USER_DIR}/init.d"/S* ; do
if [ -x "${curr_pis}" ] ; then
case "${curr_pis}" in
*.sh) . "${curr_pis}" ;;
*) "${curr_pis}" "start" ;;
esac
fi
done
;;
"stop")
for curr_pis in "${HOME}/${MOZ_USER_DIR}/init.d"/K* "$MOZ_DIST_LIB/init.d"/K* ; do
if [ -x "${curr_pis}" ] ; then
case "${curr_pis}" in
*.sh) . "${curr_pis}" ;;
*) "${curr_pis}" "stop" ;;
esac
fi
done
;;
*)
echo 1>&2 "$0: Internal error in moz_pis_startstop_scripts."
exit 1
;;
esac
}
## Start addon scripts
moz_pis_startstop_scripts "start"
$AOSS $MOZ_PROGRAM $@
## Stop addon scripts
moz_pis_startstop_scripts "stop"
exit 0