]> git.pld-linux.org Git - packages/firefox.git/blobdiff - mozilla-firefox.sh
- up to 35.0.1
[packages/firefox.git] / mozilla-firefox.sh
index 05f25ba423f0eaf59a0ea6869a0332b32a3f4519..870f8751bc50225d5d97906ec22cd7d0c61709fa 100644 (file)
@@ -1,41 +1,46 @@
 #!/bin/sh
 # based on script by (c) vip at linux.pl, wolf at pld-linux.org
 
-if [ `arch` == "x86_64" ]; then
-       LIBDIR="/usr/lib64/mozilla-firefox"
-else
-       LIBDIR="/usr/lib/mozilla-firefox"
-fi
+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)}
 
-MOZILLA_FIVE_HOME=$LIBDIR
-if [ "$1" == "-remote" ]; then
-       $LIBDIR/firefox "$@"
+if [ "$1" = "-remote" ]; then
+       exec $FIREFOX "$@"
 else
-       PING=`$LIBDIR/firefox -remote 'ping()' 2>&1 >/dev/null`
-       if [ -n "$PING" ]; then
-               if [ -f "`pwd`/$1" ]; then
-                       $LIBDIR/firefox "file://`pwd`/$1"
+       if ! $FIREFOX -remote 'ping()' 2>/dev/null; then
+               if [ -f "$PWD/$1" ]; then
+                       exec $FIREFOX "file://$PWD/$1"
                else
-                       $LIBDIR/firefox "$@"
+                       exec $FIREFOX "$@"
                fi
        else
                if [ -z "$1" ]; then
-                       $LIBDIR/firefox -remote 'xfeDoCommand (openBrowser)'
-               elif [ "$1" == "-mail" ]; then
-                       $LIBDIR/firefox -remote 'xfeDoCommand (openInbox)'
-               elif [ "$1" == "-compose" ]; then
-                       $LIBDIR/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
-                               $LIBDIR/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
-                               $LIBDIR/firefox -remote "OpenUrl($URL,new-window)"
+                               exec $FIREFOX -new-window "$URL"
                        fi
                fi
        fi
This page took 0.111067 seconds and 4 git commands to generate.