|
|
a8a561 |
#!/bin/bash
|
|
|
a8a561 |
#
|
|
|
a8a561 |
# Startup script for the fedora.us Thunderbird RPM
|
|
|
a8a561 |
# (based on the Mozilla RPM launch script)
|
|
|
a8a561 |
#
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## Variables
|
|
|
a8a561 |
##
|
|
|
a8a561 |
MOZ_ARCH=$(uname -m)
|
|
|
a8a561 |
case $MOZ_ARCH in
|
|
|
a8a561 |
x86_64 | s390x | sparc64 )
|
|
|
a8a561 |
MOZ_LIB_DIR="/usr/lib64"
|
|
|
a8a561 |
SECONDARY_LIB_DIR="/usr/lib"
|
|
|
a8a561 |
;;
|
|
|
a8a561 |
* )
|
|
|
a8a561 |
MOZ_LIB_DIR="/usr/lib"
|
|
|
a8a561 |
SECONDARY_LIB_DIR="/usr/lib64"
|
|
|
a8a561 |
;;
|
|
|
a8a561 |
esac
|
|
|
a8a561 |
|
|
|
a8a561 |
if [ ! -x $MOZ_LIB_DIR/thunderbird/thunderbird ]; then
|
|
|
a8a561 |
if [ ! -x $SECONDARY_LIB_DIR/thunderbird/thunderbird ]; then
|
|
|
a8a561 |
echo "Error: $MOZ_LIB_DIR/thunderbird/thunderbird not found"
|
|
|
a8a561 |
if [ -d $SECONDARY_LIB_DIR ]; then
|
|
|
a8a561 |
echo " $SECONDARY_LIB_DIR/thunderbird/thunderbird not found"
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
exit 1
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
|
|
|
a8a561 |
MOZ_DIST_BIN="$MOZ_LIB_DIR/thunderbird"
|
|
|
a8a561 |
MOZ_PROGRAM="$MOZ_DIST_BIN/thunderbird"
|
|
|
a8a561 |
MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
|
|
|
a8a561 |
MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{3550f703-e582-4d05-9a08-453d09bdfdc6}"
|
|
|
a8a561 |
MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## Set MOZ_ENABLE_PANGO is no longer used because Pango is enabled by default
|
|
|
a8a561 |
## you may use MOZ_DISABLE_PANGO=1 to force disabling of pango
|
|
|
a8a561 |
##
|
|
|
a8a561 |
#MOZ_DISABLE_PANGO=1
|
|
|
a8a561 |
#export MOZ_DISABLE_PANGO
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## Set MOZ_APP_LAUNCHER for gnome-session
|
|
|
a8a561 |
##
|
|
|
a8a561 |
export MOZ_APP_LAUNCHER="/usr/bin/thunderbird"
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## Disable the GNOME crash dialog, Moz has it's own
|
|
|
a8a561 |
##
|
|
|
a8a561 |
GNOME_DISABLE_CRASH_DIALOG=1
|
|
|
a8a561 |
export GNOME_DISABLE_CRASH_DIALOG
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## Disable the SLICE allocator (rhbz#1014858)
|
|
|
a8a561 |
##
|
|
|
a8a561 |
export G_SLICE=always-malloc
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## To disable the use of Firefox localization, set MOZ_DISABLE_LANGPACKS=1
|
|
|
a8a561 |
## in your environment before launching Firefox.
|
|
|
a8a561 |
##
|
|
|
a8a561 |
#
|
|
|
a8a561 |
# MOZ_DISABLE_LANGPACKS=1
|
|
|
a8a561 |
# export MOZ_DISABLE_LANGPACKS
|
|
|
a8a561 |
#
|
|
|
a8a561 |
|
|
|
a8a561 |
##
|
|
|
a8a561 |
## Automatically installed langpacks are tracked by .fedora-langpack-install
|
|
|
a8a561 |
## config file.
|
|
|
a8a561 |
##
|
|
|
a8a561 |
FEDORA_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.fedora-langpack-install"
|
|
|
a8a561 |
|
|
|
a8a561 |
# MOZ_DISABLE_LANGPACKS disables language packs completelly
|
|
|
a8a561 |
MOZILLA_DOWN=0
|
|
|
a8a561 |
if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
|
|
|
a8a561 |
pidof thunderbird > /dev/null 2>&1
|
|
|
a8a561 |
MOZILLA_DOWN=$?
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
|
|
|
a8a561 |
# Modify language pack configuration only when thunderbird is not running
|
|
|
a8a561 |
# and language packs are not disabled
|
|
|
a8a561 |
if [ $MOZILLA_DOWN -ne 0 ]; then
|
|
|
a8a561 |
|
|
|
a8a561 |
# Clear already installed langpacks
|
|
|
a8a561 |
mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR
|
|
|
a8a561 |
if [ -f $FEDORA_LANGPACK_CONFIG ]; then
|
|
|
a8a561 |
rm `cat $FEDORA_LANGPACK_CONFIG` > /dev/null 2>&1
|
|
|
a8a561 |
rm $FEDORA_LANGPACK_CONFIG > /dev/null 2>&1
|
|
|
a8a561 |
# remove all empty langpacks dirs while they block installation of langpacks
|
|
|
a8a561 |
rmdir $MOZ_EXTENSIONS_PROFILE_DIR/lang* > /dev/null 2>&1
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
|
|
|
a8a561 |
# Get locale from system
|
|
|
a8a561 |
CURRENT_LOCALE=$LC_ALL
|
|
|
a8a561 |
CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
|
|
|
a8a561 |
CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
|
|
|
a8a561 |
|
|
|
a8a561 |
# Try without a local variant first, then with a local variant
|
|
|
a8a561 |
# So that pt-BR doesn't try to use pt for example
|
|
|
a8a561 |
SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
|
|
|
a8a561 |
MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
|
|
|
a8a561 |
|
|
|
a8a561 |
function create_langpack_link() {
|
|
|
a8a561 |
local language=$*
|
|
|
a8a561 |
local langpack=langpack-${language}@thunderbird.mozilla.org.xpi
|
|
|
a8a561 |
if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
|
|
|
a8a561 |
rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
|
|
|
a8a561 |
ln -s $MOZ_LANGPACKS_DIR/$langpack \
|
|
|
a8a561 |
$MOZ_EXTENSIONS_PROFILE_DIR/$langpack
|
|
|
a8a561 |
echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG
|
|
|
a8a561 |
return 0
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
return 1
|
|
|
a8a561 |
}
|
|
|
a8a561 |
|
|
|
a8a561 |
create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
|
|
|
a8a561 |
# BEAST fix (rhbz#1005611)
|
|
|
a8a561 |
NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1}
|
|
|
a8a561 |
export NSS_SSL_CBC_RANDOM_IV
|
|
|
a8a561 |
|
|
|
a8a561 |
# Prepare command line arguments
|
|
|
a8a561 |
script_args=""
|
|
|
a8a561 |
pass_arg_count=0
|
|
|
a8a561 |
while [ $# -gt $pass_arg_count ]
|
|
|
a8a561 |
do
|
|
|
a8a561 |
case "$1" in
|
|
|
a8a561 |
-g | --debug)
|
|
|
a8a561 |
script_args="$script_args -g"
|
|
|
a8a561 |
debugging=1
|
|
|
a8a561 |
shift
|
|
|
a8a561 |
;;
|
|
|
a8a561 |
-d | --debugger)
|
|
|
a8a561 |
if [ $# -gt 1 ]; then
|
|
|
a8a561 |
script_args="$script_args -d $2"
|
|
|
a8a561 |
shift 2
|
|
|
a8a561 |
else
|
|
|
a8a561 |
shift
|
|
|
a8a561 |
fi
|
|
|
a8a561 |
;;
|
|
|
a8a561 |
*)
|
|
|
a8a561 |
# Move the unrecognized argument to the end of the list.
|
|
|
a8a561 |
arg="$1"
|
|
|
a8a561 |
shift
|
|
|
a8a561 |
set -- "$@" "$arg"
|
|
|
a8a561 |
pass_arg_count=`expr $pass_arg_count + 1`
|
|
|
a8a561 |
;;
|
|
|
a8a561 |
esac
|
|
|
a8a561 |
done
|
|
|
a8a561 |
|
|
|
a8a561 |
exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
|