- rel 1
[packages/firefox.git] / firefox.sh
1 #!/bin/sh
2 # based on script by (c) vip at linux.pl, wolf at pld-linux.org
3
4 LIBDIR="@LIBDIR@/firefox"
5
6 # copy profile from Iceweasel if its available and if no Firefox
7 # profile exists
8 if [ ! -d $HOME/.mozilla/firefox ]; then
9         if [ -d $HOME/.iceweasel ]; then
10                 echo "Copying profile from Iceweasel"
11                 cp -rf $HOME/.iceweasek $HOME/.mozilla/firefox
12         fi
13 fi
14
15 # compreg.dat and/or chrome.rdf will screw things up if it's from an
16 # older version.  http://bugs.gentoo.org/show_bug.cgi?id=63999
17 for f in ~/.mozilla/firefox/*/{compreg.dat,chrome.rdf,XUL.mfasl}; do
18         if [[ -f ${f} && ${f} -ot /usr/bin/firefox ]]; then
19                 echo "Removing ${f} leftover from older firefox"
20                 rm -f "${f}"
21         fi
22 done
23
24 FIREFOX="$LIBDIR/firefox"
25 PWD=${PWD:-$(pwd)}
26
27 if [ -z "$1" ]; then
28         exec $FIREFOX
29 else
30         if [ -f "$PWD/$1" ]; then
31                 URL="file://$PWD/$1"
32         else
33                 URL="$1"
34         fi
35         if ! grep -q browser.tabs.opentabfor.middleclick.*false ~/.firefox/*/prefs.js; then
36                 exec $FIREFOX -new-tab "$URL"
37         else
38                 exec $FIREFOX -new-window "$URL"
39         fi
40 fi
This page took 0.03506 seconds and 3 git commands to generate.