- cleanup (no system libs installed now)
[packages/firefox.git] / mozilla-firefox.sh
CommitLineData
763f73fd 1#!/bin/sh
2# based on script by (c) vip at linux.pl, wolf at pld-linux.org
3
bd6004c2 4LIBDIR="@LIBDIR@/mozilla-firefox"
f594d491
MK
5
6MOZILLA_FIVE_HOME=$LIBDIR
7dafdcbe 7
a97d8027 8MOZARGS=
3841e42d 9MOZLOCALE="$(/usr/bin/locale | grep "^LC_MESSAGES=" | \
10 sed -e "s|LC_MESSAGES=||g" -e "s|\"||g" )"
11for MOZLANG in $(echo $LANGUAGE | tr ":" " ") $MOZLOCALE; do
12 eval MOZLANG="$(echo $MOZLANG | sed -e "s|_\([^.]*\).*|-\1|g")"
7dafdcbe 13
3841e42d 14 if [ -f $MOZILLA_FIVE_HOME/chrome/$MOZLANG.jar ]; then
15 MOZARGS="-UILocale $MOZLANG"
16 break
17 fi
18done
19
20if [ -z "$MOZARGS" ]; then
21 # try harder
6576b851
ER
22 for MOZLANG in $(echo $LANGUAGE | tr ":" " ") $MOZLOCALE; do
23 eval MOZLANG="$(echo $MOZLANG | sed -e "s|_.*||g")"
3841e42d 24
6576b851
ER
25 LANGFILE=$(echo ${MOZILLA_FIVE_HOME}/chrome/${MOZLANG}*.jar \
26 | sed 's/\s.*//g' )
27 if [ -f "$LANGFILE" ]; then
28 MOZLANG=$(basename "$LANGFILE" | sed 's/\.jar//')
29 MOZARGS="-UILocale $MOZLANG"
30 break
31 fi
32 done
3841e42d 33fi
7dafdcbe 34
dd339e54
ER
35# compreg.dat and/or chrome.rdf will screw things up if it's from an
36# older version. http://bugs.gentoo.org/show_bug.cgi?id=63999
37for f in ~/{.,.mozilla/}firefox/*/{compreg.dat,chrome.rdf,XUL.mfasl}; do
38 if [[ -f ${f} && ${f} -ot /usr/bin/mozilla-firefox ]]; then
39 echo "Removing ${f} leftover from older firefox"
40 rm -f "${f}"
41 fi
42done
43
7dafdcbe 44if [ -n "$MOZARGS" ]; then
45 FIREFOX="$LIBDIR/firefox $MOZARGS"
46else
47 FIREFOX="$LIBDIR/firefox"
48fi
49
763f73fd 50if [ "$1" == "-remote" ]; then
c88aa5e7 51 exec $FIREFOX "$@"
763f73fd 52else
7dafdcbe 53 PING=`$FIREFOX -remote 'ping()' 2>&1 >/dev/null`
763f73fd 54 if [ -n "$PING" ]; then
55 if [ -f "`pwd`/$1" ]; then
c88aa5e7 56 exec $FIREFOX "file://`pwd`/$1"
763f73fd 57 else
c88aa5e7 58 exec $FIREFOX "$@"
763f73fd 59 fi
60 else
61 if [ -z "$1" ]; then
f176bc86 62 exec $FIREFOX -remote 'xfeDoCommand(openBrowser)'
763f73fd 63 elif [ "$1" == "-mail" ]; then
f176bc86 64 exec $FIREFOX -remote 'xfeDoCommand(openInbox)'
763f73fd 65 elif [ "$1" == "-compose" ]; then
f176bc86 66 exec $FIREFOX -remote 'xfeDoCommand(composeMessage)'
763f73fd 67 else
68 if [ -f "`pwd`/$1" ]; then
69 URL="file://`pwd`/$1"
70 else
71 URL="$1"
72 fi
73 grep browser.tabs.opentabfor.middleclick ~/.mozilla/firefox/*/prefs.js | grep true > /dev/null
74 if [ 0 -eq 0 ]; then
c88aa5e7 75 exec $FIREFOX -remote "OpenUrl($URL,new-tab)"
763f73fd 76 else
c88aa5e7 77 exec $FIREFOX -remote "OpenUrl($URL,new-window)"
763f73fd 78 fi
79 fi
80 fi
81fi
This page took 0.061754 seconds and 4 git commands to generate.