MozillaFirefox/mozilla.sh.in
author Wolfgang Rosenauer <wr@rosenauer.org>
Thu, 28 Jan 2021 23:39:24 +0100
branchfirefox85
changeset 1154 71a92b4d0527
parent 1138 4ac678bd2a26
permissions -rw-r--r--
Firefox 85.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
#!/bin/sh
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
# ***** BEGIN LICENSE BLOCK *****
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
# The contents of this file are subject to the Mozilla Public License Version
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
# 1.1 (the "License"); you may not use this file except in compliance with
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
# the License. You may obtain a copy of the License at
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
# http://www.mozilla.org/MPL/
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
# Software distributed under the License is distributed on an "AS IS" basis,
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
# for the specific language governing rights and limitations under the
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
# License.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
# The Original Code is mozilla.org Code.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
# The Initial Developer of the Original Code is
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
# Netscape Communications Corporation.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
# Portions created by the Initial Developer are Copyright (C) 1998
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
# the Initial Developer. All Rights Reserved.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
#
212
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    23
# Contributor(s):
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
#    Wolfgang Rosenauer <wolfgang.rosenauer@suse.de>
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
#                       <wr@rosenauer.org>
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
# Alternatively, the contents of this file may be used under the terms of
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
# either the GNU General Public License Version 2 or later (the "GPL"), or
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
# in which case the provisions of the GPL or the LGPL are applicable instead
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
# of those above. If you wish to allow use of your version of this file only
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
# under the terms of either the GPL or the LGPL, and not to allow others to
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
# use your version of this file under the terms of the MPL, indicate your
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
# decision by deleting the provisions above and replace them with the notice
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
# and other provisions required by the GPL or the LGPL. If you do not delete
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
# the provisions above, a recipient may use your version of this file under
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
# the terms of any one of the MPL, the GPL or the LGPL.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
#
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
# ***** END LICENSE BLOCK *****
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
212
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    41
##
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
## Usage:
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
##
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
## $ mozilla [args]
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
##
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
## This script is meant to run a mozilla program from the mozilla
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
## rpm installation.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
##
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
## The script will setup all the environment voodoo needed to make
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
## mozilla work.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
cmdname=`basename $0`
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
##
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
## Variables
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
##
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
MOZ_DIST_BIN="%PREFIX"
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
MOZ_DIST_LIB="%PROGDIR"
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
MOZ_APPNAME="%APPNAME"
502
ba1be580e369 start firefox (not firefox-bin) anymore as it's the same binary anyway
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 465
diff changeset
    60
MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME"
1138
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    61
MOZ_LANGPACKS_DIR="$MOZ_DIST_LIB/langpacks"
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    62
MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
212
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    64
MOZ_APP_LAUNCHER="$MOZ_DIST_LIB/$MOZ_APPNAME.sh"
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    65
if [ "$0" = "$MOZ_APP_LAUNCHER" ]; then
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    66
  [ -h "/usr/bin/$MOZ_APPNAME" ] && \
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    67
   _link=$(readlink -f "/usr/bin/$MOZ_APPNAME")
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    68
  if [ "$_link" = "$MOZ_APP_LAUNCHER" ]; then
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    69
    export MOZ_APP_LAUNCHER="/usr/bin/$MOZ_APPNAME"
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    70
  fi
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    71
else
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    72
  export MOZ_APP_LAUNCHER="/usr/bin/$MOZ_APPNAME"
f25759227036 put some more logic into MOZ_APP_LAUNCHER setting
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 5
diff changeset
    73
fi
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
264
73231d44ef1f fix startscript for non standalone glue
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 212
diff changeset
    75
MOZILLA_FIVE_HOME="$MOZ_DIST_LIB"
73231d44ef1f fix startscript for non standalone glue
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 212
diff changeset
    76
export MOZILLA_FIVE_HOME
73231d44ef1f fix startscript for non standalone glue
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 212
diff changeset
    77
LD_LIBRARY_PATH=$MOZ_DIST_LIB${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
73231d44ef1f fix startscript for non standalone glue
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 212
diff changeset
    78
export LD_LIBRARY_PATH
73231d44ef1f fix startscript for non standalone glue
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 212
diff changeset
    79
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
# needed for SUN Java under Xorg >= 7.2
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
export LIBXCB_ALLOW_SLOPPY_LOCK=1
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
# disable Gnome crash dialog (doesn't make sense anyway)
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
export GNOME_DISABLE_CRASH_DIALOG=1
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
1122
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    86
# Wayland
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    87
# $XDG_SESSION_TYPE should contain either x11 or wayland
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    88
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    89
  export MOZ_ENABLE_WAYLAND=1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    90
fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    91
1138
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    92
##
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    93
## Use D-Bus remote exclusively when there's Wayland display.
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    94
##
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    95
if [ "$WAYLAND_DISPLAY" ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    96
  export MOZ_DBUS_REMOTE=1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    97
fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    98
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
    99
# xinput2 (boo#1173320)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   100
source /etc/os-release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   101
if [ "$ID" = "opensuse-tumbleweed" ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   102
  export MOZ_USE_XINPUT2=1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   103
fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   104
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   105
##
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   106
## To disable the use of Firefox localization handling for
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   107
## the home profile, set MOZ_DISABLE_LANGPACKS=1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   108
## in your environment before launching Firefox.
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   109
## currently disabled by default since langpacks
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   110
## are shipped as app sideloading addons
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   111
##
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   112
#
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   113
MOZ_DISABLE_LANGPACKS=1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   114
export MOZ_DISABLE_LANGPACKS
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   115
#
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   116
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   117
##
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   118
## Automatically installed langpacks are tracked by .suse-langpack-install
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   119
## config file.
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   120
##
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   121
SUSE_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.suse-langpack-install"
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   122
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   123
# MOZ_DISABLE_LANGPACKS disables language packs completely
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   124
MOZILLA_DOWN=0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   125
if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   126
    if [ -x $MOZ_PROGRAM ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   127
        # Is firefox running?
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   128
        /bin/pidof %APPNAME% > /dev/null 2>&1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   129
        MOZILLA_DOWN=$?
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   130
    fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   131
fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   132
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   133
# Modify language pack configuration only when firefox is not running
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   134
# and language packs are not disabled
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   135
if [ $MOZILLA_DOWN -ne 0 ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   136
    # Clear already installed langpacks
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   137
    mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   138
    if [ -f $SUSE_LANGPACK_CONFIG ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   139
        rm `cat $SUSE_LANGPACK_CONFIG` > /dev/null 2>&1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   140
        rm $SUSE_LANGPACK_CONFIG > /dev/null 2>&1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   141
        # remove all empty langpacks dirs while they block installation of langpacks
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   142
        rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   143
    fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   144
    # Get locale from system
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   145
    CURRENT_LOCALE=$LC_ALL
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   146
    CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   147
    CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   148
    # Try with a local variant first, then without a local variant
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   149
    SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g" | sed "s|\..*||g"`
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   150
    MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g" | sed "s|\..*||g"`
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   151
    function create_langpack_link() {
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   152
        local language=$*
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   153
        local langpack=langpack-${language}@firefox.mozilla.org.xpi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   154
        if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   155
            rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   156
            # If the target file is a symlink (the fallback langpack),
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   157
            # install the original file instead of the fallback one
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   158
            if [ -h $MOZ_LANGPACKS_DIR/$langpack ]; then
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   159
                langpack=`readlink $MOZ_LANGPACKS_DIR/$langpack`
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   160
            fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   161
            ln -s $MOZ_LANGPACKS_DIR/$langpack \
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   162
                  $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   163
            echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $SUSE_LANGPACK_CONFIG
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   164
            return 0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   165
        fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   166
        return 1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   167
    }
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   168
    create_langpack_link $MOZLOCALE || create_langpack_link $SHORTMOZLOCALE || true
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   169
fi
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1122
diff changeset
   170
956
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 820
diff changeset
   171
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
moz_debug=0
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
script_args=""
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
pass_arg_count=0
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
while [ $# -gt $pass_arg_count ]
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   176
do
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   177
  case "$1" in
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
    -d | --debugger)
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
      moz_debugger=$2;
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
      if [ "${moz_debugger}" != "" ]; then
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
        shift 2
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
        moz_debug=1
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
      else
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
        echo "-d requires an argument"
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
        exit 1
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
      fi
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   187
      ;;
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
    *)
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
      # Move the unrecognized argument to the end of the list.
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
      arg="$1"
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   191
      shift
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
      set -- "$@" "$arg"
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
      pass_arg_count=`expr $pass_arg_count + 1`
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   194
      ;;
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
  esac
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   196
done
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   197
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
if [ $moz_debug -eq 1 ]; then
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
  tmpfile=`mktemp /tmp/mozargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
  trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
820
419e95018725 fix bashism in mozilla.sh script
Led <ledest@gmail.com>
parents: 502
diff changeset
   201
  echo "set args ${1+"$@"}" > $tmpfile
419e95018725 fix bashism in mozilla.sh script
Led <ledest@gmail.com>
parents: 502
diff changeset
   202
  echo "run" >> $tmpfile
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
  echo "$moz_debugger $MOZ_PROGRAM -x $tmpfile"
465
c49024069c9d do not spawn a new shell but use exec (bnc#766006)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 392
diff changeset
   204
  exec $moz_debugger "$MOZ_PROGRAM" -x $tmpfile
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   205
else
465
c49024069c9d do not spawn a new shell but use exec (bnc#766006)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 392
diff changeset
   206
  exec $MOZ_PROGRAM "$@"
5
17b1dd932700 Add MozillaFirefox package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
fi