MozillaFirefox/mozilla.sh.in
branchfirefox78
changeset 1138 4ac678bd2a26
parent 1122 a9cd24eaa361
child 1157 57fc0524b50c
equal deleted inserted replaced
1137:909f866430ee 1138:4ac678bd2a26
    56 ##
    56 ##
    57 MOZ_DIST_BIN="%PREFIX"
    57 MOZ_DIST_BIN="%PREFIX"
    58 MOZ_DIST_LIB="%PROGDIR"
    58 MOZ_DIST_LIB="%PROGDIR"
    59 MOZ_APPNAME="%APPNAME"
    59 MOZ_APPNAME="%APPNAME"
    60 MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME"
    60 MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME"
       
    61 MOZ_LANGPACKS_DIR="$MOZ_DIST_LIB/langpacks"
       
    62 MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
    61 
    63 
    62 MOZ_APP_LAUNCHER="$MOZ_DIST_LIB/$MOZ_APPNAME.sh"
    64 MOZ_APP_LAUNCHER="$MOZ_DIST_LIB/$MOZ_APPNAME.sh"
    63 if [ "$0" = "$MOZ_APP_LAUNCHER" ]; then
    65 if [ "$0" = "$MOZ_APP_LAUNCHER" ]; then
    64   [ -h "/usr/bin/$MOZ_APPNAME" ] && \
    66   [ -h "/usr/bin/$MOZ_APPNAME" ] && \
    65    _link=$(readlink -f "/usr/bin/$MOZ_APPNAME")
    67    _link=$(readlink -f "/usr/bin/$MOZ_APPNAME")
    85 # $XDG_SESSION_TYPE should contain either x11 or wayland
    87 # $XDG_SESSION_TYPE should contain either x11 or wayland
    86 if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
    88 if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
    87   export MOZ_ENABLE_WAYLAND=1
    89   export MOZ_ENABLE_WAYLAND=1
    88 fi
    90 fi
    89 
    91 
    90 # enable xinput2 (boo#1032003)
    92 ##
    91 # breaks too many things right now (boo#1053959)
    93 ## Use D-Bus remote exclusively when there's Wayland display.
    92 #export MOZ_USE_XINPUT2=1
    94 ##
       
    95 if [ "$WAYLAND_DISPLAY" ]; then
       
    96   export MOZ_DBUS_REMOTE=1
       
    97 fi
       
    98 
       
    99 # xinput2 (boo#1173320)
       
   100 source /etc/os-release
       
   101 if [ "$ID" = "opensuse-tumbleweed" ]; then
       
   102   export MOZ_USE_XINPUT2=1
       
   103 fi
       
   104 
       
   105 ##
       
   106 ## To disable the use of Firefox localization handling for
       
   107 ## the home profile, set MOZ_DISABLE_LANGPACKS=1
       
   108 ## in your environment before launching Firefox.
       
   109 ## currently disabled by default since langpacks
       
   110 ## are shipped as app sideloading addons
       
   111 ##
       
   112 #
       
   113 MOZ_DISABLE_LANGPACKS=1
       
   114 export MOZ_DISABLE_LANGPACKS
       
   115 #
       
   116 
       
   117 ##
       
   118 ## Automatically installed langpacks are tracked by .suse-langpack-install
       
   119 ## config file.
       
   120 ##
       
   121 SUSE_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.suse-langpack-install"
       
   122 
       
   123 # MOZ_DISABLE_LANGPACKS disables language packs completely
       
   124 MOZILLA_DOWN=0
       
   125 if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
       
   126     if [ -x $MOZ_PROGRAM ]; then
       
   127         # Is firefox running?
       
   128         /bin/pidof %APPNAME% > /dev/null 2>&1
       
   129         MOZILLA_DOWN=$?
       
   130     fi
       
   131 fi
       
   132 
       
   133 # Modify language pack configuration only when firefox is not running
       
   134 # and language packs are not disabled
       
   135 if [ $MOZILLA_DOWN -ne 0 ]; then
       
   136     # Clear already installed langpacks
       
   137     mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR
       
   138     if [ -f $SUSE_LANGPACK_CONFIG ]; then
       
   139         rm `cat $SUSE_LANGPACK_CONFIG` > /dev/null 2>&1
       
   140         rm $SUSE_LANGPACK_CONFIG > /dev/null 2>&1
       
   141         # remove all empty langpacks dirs while they block installation of langpacks
       
   142         rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1
       
   143     fi
       
   144     # Get locale from system
       
   145     CURRENT_LOCALE=$LC_ALL
       
   146     CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
       
   147     CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
       
   148     # Try with a local variant first, then without a local variant
       
   149     SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g" | sed "s|\..*||g"`
       
   150     MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g" | sed "s|\..*||g"`
       
   151     function create_langpack_link() {
       
   152         local language=$*
       
   153         local langpack=langpack-${language}@firefox.mozilla.org.xpi
       
   154         if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
       
   155             rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
       
   156             # If the target file is a symlink (the fallback langpack),
       
   157             # install the original file instead of the fallback one
       
   158             if [ -h $MOZ_LANGPACKS_DIR/$langpack ]; then
       
   159                 langpack=`readlink $MOZ_LANGPACKS_DIR/$langpack`
       
   160             fi
       
   161             ln -s $MOZ_LANGPACKS_DIR/$langpack \
       
   162                   $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
       
   163             echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $SUSE_LANGPACK_CONFIG
       
   164             return 0
       
   165         fi
       
   166         return 1
       
   167     }
       
   168     create_langpack_link $MOZLOCALE || create_langpack_link $SHORTMOZLOCALE || true
       
   169 fi
       
   170 
    93 
   171 
    94 moz_debug=0
   172 moz_debug=0
    95 script_args=""
   173 script_args=""
    96 pass_arg_count=0
   174 pass_arg_count=0
    97 while [ $# -gt $pass_arg_count ]
   175 while [ $# -gt $pass_arg_count ]