Mercurial > hg > config
annotate bin/setdefaultbrowser.sh @ 344:f833aef163c6
minor improvements
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 24 Jun 2013 11:16:35 -0700 |
parents | 4387fa22807f |
children | 0694882a1ad8 |
rev | line source |
---|---|
341
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/bin/bash |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 # sudo update-alternatives --get-selections |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 # http://askubuntu.com/questions/100693/how-can-i-manually-change-the-default-web-browser |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 # http://askubuntu.com/questions/45885/how-do-i-set-a-custom-browser-as-default-in-preferred-applications?rq=1 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 # http://fvue.nl/wiki/Linux:_Default_browser |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 # cat /proc/$(pidof krunner)/environ | tr '\000' '\012' | grep BROWSER |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 if [[ $(whoami) != 'root' ]] |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 then |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 echo "Must be run as root" |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 exit 1 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 fi |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 BROWSER=/home/jhammel/firefox/firefox |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 PREFIX=/usr/bin |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 for LINK in gnome-www-browser x-www-browser |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 do |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 LINKPATH=${PREFIX}/${LINK} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 update-alternatives --install ${LINKPATH} ${LINK} ${BROWSER} 99 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 update-alternatives --install ${LINKPATH} ${LINK} ${BROWSER} 99 |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 update-alternatives --set ${LINK} ${BROWSER} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 update-alternatives --display ${LINK} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 echo |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 unlink ${LINKPATH} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 ln -s ${BROWSER} ${LINKPATH} |
4387fa22807f
what a fuck; http://askubuntu.com/questions/20590/set-default-browser-to-open-browser
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
29 done |