source: projects/specs/trunk/f/firefox/firefox.vine.sh.in @ 11974

Revision 11974, 7.0 KB checked in by tomop, 5 years ago (diff)

modified files for firefox

Line 
1#!/bin/sh
2#
3# The contents of this file are subject to the Netscape Public
4# License Version 1.1 (the "License"); you may not use this file
5# except in compliance with the License. You may obtain a copy of
6# the License at http://www.mozilla.org/NPL/
7#
8# Software distributed under the License is distributed on an "AS
9# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10# implied. See the License for the specific language governing
11# rights and limitations under the License.
12#
13# The Original Code is mozilla.org code.
14#
15# The Initial Developer of the Original Code is Netscape
16# Communications Corporation.  Portions created by Netscape are
17# Copyright (C) 1998 Netscape Communications Corporation. All
18# Rights Reserved.
19#
20# Contributor(s):
21#
22
23##
24## Usage:
25##
26## $ firefox
27##
28## This script is meant to run a mozilla program from the mozilla
29## rpm installation.
30##
31## The script will setup all the environment voodoo needed to make
32## mozilla work.
33
34cmdname=`basename $0`
35
36##
37## Variables
38##
39MOZ_ARCH=$(uname -m)
40case $MOZ_ARCH in
41        x86_64 | s390x | sparc64)
42                MOZ_LIB_DIR="/usr/lib64"
43                SECONDARY_LIB_DIR="/usr/lib"
44                ;;
45        * )
46                MOZ_LIB_DIR="/usr/lib"
47                SECONDARY_LIB_DIR="/usr/lib64"
48                ;;
49esac
50
51MOZ_FIREFOX_FILE="firefox"
52
53if [ ! -r $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then
54    if [ ! -r $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then
55        echo "Error: $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found"
56        if [ -d $SECONDARY_LIB_DIR ]; then
57            echo "       $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found"
58        fi
59        exit 1
60    fi
61    MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
62fi
63MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox"
64MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
65MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
66MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
67MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
68
69##
70## Set MOZ_GRE_CONF
71##
72MOZ_GRE_CONF=/etc/gre.d/gre.conf
73if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
74  MOZ_GRE_CONF=/etc/gre.d/gre64.conf
75fi
76export MOZ_GRE_CONF
77
78##
79## Set MOZILLA_FIVE_HOME
80##
81MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
82
83export MOZILLA_FIVE_HOME
84
85##
86## Make sure that we set the plugin path
87##
88MOZ_PLUGIN_DIR="plugins"
89
90if [ "$MOZ_PLUGIN_PATH" ]
91then
92  MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
93else
94  MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
95fi
96export MOZ_PLUGIN_PATH
97
98##
99## Set MOZ_APP_LAUNCHER for gnome-session
100##
101export MOZ_APP_LAUNCHER="/usr/bin/firefox"
102
103##
104## Set FONTCONFIG_PATH for Xft/fontconfig
105##
106FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
107export FONTCONFIG_PATH
108
109##
110## Set MOZ_DISABLE_PANGO
111## Vine Linux's firefox is build with Pango rendering by default.
112## But Pango rendering cause slower rendering in some pages especially in CJK page.
113## So we disable it by default.
114##
115if [ ! "$MOZ_ENABLE_PANGO" == "1" ]
116then
117  MOZ_DISABLE_PANGO=1
118  export MOZ_DISABLE_PANGO
119fi
120
121##
122## firefox with flash on composite enabled X server
123##
124XLIB_SKIP_ARGB_VISUALS=1
125export XLIB_SKIP_ARGB_VISUALS
126
127##
128## use Pulseaudio on Flash-plugins, if pulseaudio server is available.
129##
130if ( /sbin/pidof pulseauido > /dev/null )
131then
132  FLASH_FORCE_PULSEAUDIO=1
133  export FLASH_FORCE_PULSEAUDIO
134fi
135
136##
137## Disable the GNOME crash dialog, Moz has it's own
138##
139GNOME_DISABLE_CRASH_DIALOG=1
140export GNOME_DISABLE_CRASH_DIALOG
141
142# OK, here's where all the real work gets done
143
144
145##
146## To disable the use of Firefox localization, set MOZ_DISABLE_LANGPACKS=1
147## in your environment before launching Firefox.
148##
149#
150# MOZ_DISABLE_LANGPACKS=1
151# export MOZ_DISABLE_LANGPACKS
152#
153
154##
155## Automatically installed langpacks are tracked by .vine-langpack-install
156## config file.
157##
158VINE_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.vine-langpack-install"
159
160# Since Firefox 60 the installation of individual langpack cannot be done by
161# copying xpi file to the home directory, because the langpack is loaded
162# as to the available languages after the language has been decided and
163# for the first run it won't be in language according to the locale.
164#
165# The current workaround is to put all langpacks to the location
166# for system wide extensions. So we set MOZ_DISABLE_LANGPACKS=1 for this moment
167export MOZ_DISABLE_LANGPACKS=1
168# MOZ_DISABLE_LANGPACKS disables language packs completely
169MOZILLA_DOWN=0
170if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
171    if [ -x $MOZ_DIST_BIN/$MOZ_FIREFOX_FILE ]; then
172        # Is firefox running?
173        /usr/bin/pidof firefox > /dev/null 2>&1
174        MOZILLA_DOWN=$?
175    fi
176fi
177
178# Modify language pack configuration only when firefox is not running
179# and language packs are not disabled
180if [ $MOZILLA_DOWN -ne 0 ]; then
181
182    # Clear already installed langpacks
183    mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR
184    if [ -f $VINE_LANGPACK_CONFIG ]; then
185        rm `cat $VINE_LANGPACK_CONFIG` > /dev/null 2>&1
186        rm $VINE_LANGPACK_CONFIG > /dev/null 2>&1
187        # remove all empty langpacks dirs while they block installation of langpacks
188        rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1
189    fi
190
191    # Get locale from system
192    CURRENT_LOCALE=$LC_ALL
193    CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
194    CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
195
196    # Try with a local variant first, then without a local variant
197    SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
198    MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
199
200    function create_langpack_link() {
201        local language=$*
202        local langpack=langpack-${language}@firefox.mozilla.org.xpi
203        if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
204            rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
205            # If the target file is a symlink (the fallback langpack),
206            # install the original file instead of the fallback one
207            if [ -h $MOZ_LANGPACKS_DIR/$langpack ]; then
208                langpack=`readlink $MOZ_LANGPACKS_DIR/$langpack`
209            fi
210            ln -s $MOZ_LANGPACKS_DIR/$langpack \
211                  $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
212            echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $VINE_LANGPACK_CONFIG
213            return 0
214        fi
215        return 1
216    }
217
218    create_langpack_link $MOZLOCALE || create_langpack_link $SHORTMOZLOCALE || true
219fi
220
221# BEAST fix (rhbz#1005611)
222NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1}
223export NSS_SSL_CBC_RANDOM_IV
224
225# Prepare command line arguments
226script_args=""
227pass_arg_count=0
228while [ $# -gt $pass_arg_count ]
229do
230  case "$1" in
231    -g | --debug)
232      script_args="$script_args -g"
233      debugging=1
234      shift
235      ;;
236    -d | --debugger)
237      if [ $# -gt 1 ]; then
238        script_args="$script_args -d $2"
239        shift 2
240      else
241        shift
242      fi
243      ;;
244    *)
245      # Move the unrecognized argument to the end of the list.
246      arg="$1"
247      shift
248      set -- "$@" "$arg"
249      pass_arg_count=`expr $pass_arg_count + 1`
250      ;;
251  esac
252done
253
254# Run the browser
255debugging=0
256if [ $debugging = 1 ]
257then
258  echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
259fi
260
261exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
Note: See TracBrowser for help on using the repository browser.