]> git.pld-linux.org Git - packages/firefox.git/blobdiff - mozilla-firefox.sh
- up to 37.0.2
[packages/firefox.git] / mozilla-firefox.sh
index 96b867f2fc84a098b5c69c7e7318cf5e8646b069..870f8751bc50225d5d97906ec22cd7d0c61709fa 100644 (file)
@@ -1,35 +1,46 @@
 #!/bin/sh
 # based on script by (c) vip at linux.pl, wolf at pld-linux.org
 
-MOZILLA_FIVE_HOME=/usr/lib/mozilla-firefox
-if [ "$1" == "-remote" ]; then
-       /usr/lib/mozilla-firefox/firefox "$@"
+LIBDIR="@LIBDIR@/mozilla-firefox"
+
+# compreg.dat and/or chrome.rdf will screw things up if it's from an
+# older version.  http://bugs.gentoo.org/show_bug.cgi?id=63999
+for f in ~/{.,.mozilla/}firefox/*/{compreg.dat,chrome.rdf,XUL.mfasl}; do
+       if [[ -f ${f} && ${f} -ot /usr/bin/mozilla-firefox ]]; then
+               echo "Removing ${f} leftover from older firefox"
+               rm -f "${f}"
+       fi
+done
+
+FIREFOX="$LIBDIR/firefox"
+PWD=${PWD:-$(pwd)}
+
+if [ "$1" = "-remote" ]; then
+       exec $FIREFOX "$@"
 else
-       PING=`/usr/lib/mozilla-firefox/firefox -remote 'ping()' 2>&1 >/dev/null`
-       if [ -n "$PING" ]; then
-               if [ -f "`pwd`/$1" ]; then
-                       /usr/lib/mozilla-firefox/firefox "file://`pwd`/$1"
+       if ! $FIREFOX -remote 'ping()' 2>/dev/null; then
+               if [ -f "$PWD/$1" ]; then
+                       exec $FIREFOX "file://$PWD/$1"
                else
-                       /usr/lib/mozilla-firefox/firefox "$@"
+                       exec $FIREFOX "$@"
                fi
        else
                if [ -z "$1" ]; then
-                       /usr/lib/mozilla-firefox/firefox -remote 'xfeDoCommand (openBrowser)'
-               elif [ "$1" == "-mail" ]; then
-                       /usr/lib/mozilla-firefox/firefox -remote 'xfeDoCommand (openInbox)'
-               elif [ "$1" == "-compose" ]; then
-                       /usr/lib/mozilla-firefox/firefox -remote 'xfeDoCommand (composeMessage)'
+                       exec $FIREFOX -remote 'xfeDoCommand(openBrowser)'
+               elif [ "$1" = "-mail" ]; then
+                       exec $FIREFOX -remote 'xfeDoCommand(openInbox)'
+               elif [ "$1" = "-compose" ]; then
+                       exec $FIREFOX -remote 'xfeDoCommand(composeMessage)'
                else
-                       if [ -f "`pwd`/$1" ]; then
-                               URL="file://`pwd`/$1"
+                       if [ -f "$PWD/$1" ]; then
+                               URL="file://$PWD/$1"
                        else
                                URL="$1"
                        fi
-                       grep browser.tabs.opentabfor.middleclick ~/.mozilla/firefox/*/prefs.js | grep true > /dev/null
-                       if [ 0 -eq 0 ]; then
-                               /usr/lib/mozilla-firefox/firefox -remote "OpenUrl($URL,new-tab)"
+                       if ! grep -q 'browser\.tabs\.opentabfor\.middleclick.*false' ~/.mozilla/firefox/*/prefs.js ; then
+                               exec $FIREFOX -new-tab "$URL"
                        else
-                               /usr/lib/mozilla-firefox/firefox -remote "OpenUrl($URL,new-window)"
+                               exec $FIREFOX -new-window "$URL"
                        fi
                fi
        fi
This page took 0.074445 seconds and 4 git commands to generate.