new module to enable editing and deleting of bookmarks
[conkeror/arlinius.git] / contrib / install.sh
blob4f21f847abc4691b66a0a612427bf01066069131
1 #! /bin/bash
3 # (C) Copyright 2004-2007 Shawn Betts
4 # (C) Copyright 2007 John J. Foerch
6 # Use, modification, and distribution are subject to the terms specified in the
7 # COPYING file.
9 ## BUILD
11 ## Whether to build the xulapp. This is just a shortcut for developers and hackers.
13 BUILD=""
16 ## PREFIX
18 ## Install prefix. Conkeror will be installed to $PREFIX/lib/conkeror and a
19 ## symlink to the stub binary will be placed in $PREFIX/bin/conkeror
21 PREFIX=${PREFIX:-/usr/local}
23 while [[ "$1" = -* ]]; do
24 case "$1" in
25 -build) BUILD=1 ;;
26 -prefix) PREFIX="${2%/}" ; shift ;;
28 echo "Unrecognized option. Please read the source."
29 exit 1
30 esac
31 shift
32 done
34 function assert () {
35 "$@"
36 if [[ $? != 0 ]]; then
37 echo fail
38 echo command failed: "$@"
39 exit 1
40 else
41 echo ok
45 function assert_conkeror_src () {
46 if [[ ! -e build.sh ]]; then
47 echo "The current directory does not appear to contain the Conkeror source code."
48 exit 1
53 if [[ -n "$BUILD" ]]; then
54 ## -build has been requested.
55 ## assert we are in the conkeror source directory
56 assert_conkeror_src
57 bash build.sh xulapp
60 ### conkeror.xulapp should be in the current directory
61 if [[ ! -e conkeror.xulapp ]]; then
62 echo "conkeror.xulapp not found. install cannot continue."
63 exit 1
67 ### conkeror-spawn-helper should be in the current directory
68 if [[ ! -e conkeror-spawn-helper ]]; then
69 echo " conkeror-spawn-helper not found. install cannot continue."
70 exit 1
75 echo -n "Installing conkeror to $PREFIX/lib/conkeror ..."
76 assert xulrunner --install-app conkeror.xulapp "$PREFIX/lib/"
78 echo -n "Installing conkeror-spawn-helper to $PREFIX/lib/conkeror ..."
79 cp conkeror-spawn-helper $PREFIX/lib/conkeror/
80 echo ok
83 if [[ -e "$PREFIX/bin/conkeror" ]]; then
84 rm "$PREFIX/bin/conkeror"
86 echo -n "Creating symlink to stub binary in $PREFIX/bin ..."
87 pushd "$PREFIX/bin" > /dev/null
88 ln -s ../lib/conkeror/conkeror conkeror
89 popd > /dev/null
90 echo ok
92 echo "Done. If you get an error that the correct GRE version"
93 echo "cannot be found, try one of the following commands:"
94 echo "for system-wide install: xulrunner --register-global"
95 echo "for single-user install: xulrunner --register-user"