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

Revision 5157, 6.5 KB checked in by daisuke, 12 years ago (diff)

update to firefox-8.0

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_XUL_DIR="$MOZ_LIB_DIR/firefox"
65MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
66MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
67MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
68MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
69 
70##
71## Set MOZ_GRE_CONF
72##
73MOZ_GRE_CONF=/etc/gre.d/gre.conf
74if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
75  MOZ_GRE_CONF=/etc/gre.d/gre64.conf
76fi
77export MOZ_GRE_CONF
78
79##
80## Set MOZILLA_FIVE_HOME
81##
82MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
83
84export MOZILLA_FIVE_HOME
85
86##
87## Select the propper plugin dir
88## Wrapped plug-ins are located in /lib/mozilla/plugins-wrapped
89##
90if [ -x "/usr/bin/mozilla-plugin-config" ]
91then
92  MOZ_PLUGIN_DIR="plugins-wrapped"
93else
94  MOZ_PLUGIN_DIR="plugins"
95fi
96
97##
98## Make sure that we set the plugin path
99##
100if [ "$MOZ_PLUGIN_PATH" ]
101then
102  MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
103else
104  MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
105fi
106export MOZ_PLUGIN_PATH
107
108##
109## Set MOZ_APP_LAUNCHER for gnome-session
110##
111export MOZ_APP_LAUNCHER="/usr/bin/firefox"
112
113##
114## If plugins are wrapped, check them
115##
116if [ -x "/usr/bin/mozilla-plugin-config" ]
117then
118  /usr/bin/mozilla-plugin-config
119fi
120
121##
122## Set FONTCONFIG_PATH for Xft/fontconfig
123##
124FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
125export FONTCONFIG_PATH
126
127##
128## Set MOZ_DISABLE_PANGO
129## Vine Linux's firefox is build with Pango rendering by default.
130## But Pango rendering cause slower rendering in some pages especially in CJK page.
131## So we disable it by default.
132##
133if [ ! "$MOZ_ENABLE_PANGO" == "1" ]
134then
135  MOZ_DISABLE_PANGO=1
136  export MOZ_DISABLE_PANGO
137fi
138
139##
140## firefox with flash on composite enabled X server
141##
142XLIB_SKIP_ARGB_VISUALS=1
143export XLIB_SKIP_ARGB_VISUALS
144
145##
146## use Pulseaudio on Flash-plugins, if pulseaudio server is available.
147##
148if ( /sbin/pidof pulseauido > /dev/null )
149then
150  FLASH_FORCE_PULSEAUDIO=1
151  export FLASH_FORCE_PULSEAUDIO
152fi
153
154##
155## Disable the GNOME crash dialog, Moz has it's own
156##
157GNOME_DISABLE_CRASH_DIALOG=1
158export GNOME_DISABLE_CRASH_DIALOG
159
160# OK, here's where all the real work gets done
161
162
163##
164## To disable the use of Firefox localization, set MOZ_DISABLE_LANGPACKS=1
165## in your environment before launching Firefox.
166##
167#
168# MOZ_DISABLE_LANGPACKS=1
169# export MOZ_DISABLE_LANGPACKS
170#
171
172##
173## Automatically installed langpacks are tracked by .vine-langpack-install
174## config file.
175##
176VINE_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.vine-langpack-install"
177
178# MOZ_DISABLE_LANGPACKS disables language packs completely
179MOZILLA_DOWN=0
180if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
181    if [ -x $MOZ_XUL_DIR/mozilla-xremote-client ]; then
182        # Is firefox running?
183        $MOZ_XUL_DIR/mozilla-xremote-client -a firefox 'ping()' > /dev/null 2>&1
184        MOZILLA_DOWN=$?
185    fi
186fi
187
188# Modify language pack configuration only when firefox is not running
189# and language packs are not disabled
190if [ $MOZILLA_DOWN -ne 0 ]; then
191
192    # Clear already installed langpacks
193    mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR
194    if [ -f $VINE_LANGPACK_CONFIG ]; then
195        rm `cat $VINE_LANGPACK_CONFIG` > /dev/null 2>&1
196        rm $VINE_LANGPACK_CONFIG > /dev/null 2>&1
197    fi
198
199    # Get locale from system
200    CURRENT_LOCALE=$LC_ALL
201    CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
202    CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
203   
204    # Try without a local variant first, then with a local variant
205    # So that pt-BR doesn't try to use pt for example
206    SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
207    MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
208
209    MOZARGS=""
210
211    function create_langpack_link() {
212        local language=$*
213        local langpack=langpack-${language}@firefox.mozilla.org.xpi
214        if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
215            rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
216            ln -s $MOZ_LANGPACKS_DIR/$langpack \
217                  $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
218            echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $VINE_LANGPACK_CONFIG
219            MOZARGS="-UILocale $MOZLOCALE"
220            return 0
221        fi
222        return 1
223    }
224
225    create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
226fi
227
228# Prepare command line arguments
229script_args=""
230pass_arg_count=0
231while [ $# -gt $pass_arg_count ]
232do
233  case "$1" in
234    -g | --debug)
235      script_args="$script_args -g"
236      debugging=1
237      shift
238      ;;
239    -d | --debugger)
240      if [ $# -gt 1 ]; then
241        script_args="$script_args -d $2"
242        shift 2
243      else
244        shift
245      fi
246      ;;
247    *)
248      # Move the unrecognized argument to the end of the list.
249      arg="$1"
250      shift
251      set -- "$@" "$arg"
252      pass_arg_count=`expr $pass_arg_count + 1`
253      ;;
254  esac
255done
256
257# Run the browser
258debugging=0
259if [ $debugging = 1 ]
260then
261  echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
262fi
263
264exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
Note: See TracBrowser for help on using the repository browser.