whitespace
[conkeror/arlinius.git] / contrib / run-conkeror
bloba0b0fe62944c29c5f04ca234d446cf8c828ac90e
1 #! /bin/bash
3 # (C) Copyright 2008 John J. Foerch
5 # Use, modification, and distribution are subject to the terms specified in the
6 # COPYING file.
8 # This bash script can be used to launch conkeror on *nix systems that
9 # support symlinking. Create a symlink to this script in a directory
10 # in your executable search path.
12 # For example:
14 # sudo ln -s /path/to/conkeror/contrib/run-conkeror /usr/local/bin/conkeror
17 # Hopefully, it will correctly find your xulrunner installation, and
18 # the location of your conkeror install.
21 ## chase a symlink
22 function chase () {
23 x="$1"
24 while :
25 do
26 last="$x"
27 x=$(find "$x" -maxdepth 0 -printf "%l")
28 [ -z "$x" ] && {
29 echo $last
30 return 1
32 done
35 ## search in a gre dir for the first xulrunner 1.9 install location
37 ## to be robust, we would need to examine each candidate xulrunner and
38 ## find a valid one. for now we just take the first and accept our
39 ## doom.
41 function check-gre () {
42 # this takes the latest version
43 grep -h GRE_PATH $(grep -l '\[1\.9' "${1%/}"/*.conf) | cut -d= -f2 | tail -n 1
46 if [[ -d "$HOME/.gre.d" ]]; then
47 xr=$(check-gre "$HOME/.gre.d" 2>/dev/null)
50 if [[ -z "$xr" ]]; then
51 if [[ -d "/etc/gre.d" ]]; then
52 xr=$(check-gre /etc/gre.d 2>/dev/null)
56 if [[ -z "$xr" ]]; then
57 echo "Xulrunner not found"
58 exit 1
61 thisscript=$(chase $0)
62 contrib=${thisscript%/*}
63 conkeror=${contrib%/*}
65 exec "${xr%/}"/xulrunner "$conkeror"/application.ini "$@"