3 # Author: Joe Atzberger, Equinox Software, Inc.
4 # License: GPL v2 or greater.
6 # Based on initial version by Bill Erickson.
9 echo -en "###########\nUpdating source directory: ";
11 if [ -d "./.git" ]; then
13 git svn rebase origin;
22 CLEAN = ${OPT_CLEAN:-no}
23 FULL = ${OPT_FULL:-no}
24 VERBOSE = ${OPT_VERBOSE:-no}
27 OpenSRF repo : ${OSRF:-Missing}
28 OpenILS repo : ${ILS:-Missing}
29 OpenILS install: ${INSTALL:-Missing}
30 XUL install: ${XUL:-Missing}
37 usage: $0 [-e /eg_trunk] [-i /openils_dir] [-s /srf_trunk] [-[cfbvt]]
40 -e specify Evergreen (OpenILS) source repository (default ~/ILS/trunk)
41 -i specify Evergreen installed directory (default /openils)
42 -s specify OpenSRF source repository (default ~/OpenSRF/trunk)
44 All parameters are optional, but you will probably need to use -e and -i.
47 -c clean: run make clean before make
48 -f full: make both packages, do OpenSRF make install (usually not required)
49 -t test: gives feedback but does not run anything
52 The purpose of this script is to consolidate a lot of the annoying
53 and error-prone tasks associated with an upgrade for a developer.
58 * Assumes opensrf has a configured (as in ./configure) both ILS and
59 OpenSRF as svn or git-svn checkouts
64 echo -e "ERROR: ${1:-Unknown}\n" >&2;
69 # ----------------------------------
70 # Prespond to command-line options
71 # ----------------------------------
72 while getopts "cfhtvb:e:i:s:" flag; do
74 "b") OPT_BASEDIR="$OPTARG";; # HIDDEN (undocumented) option.
75 "e") OPT_EGDIR="$OPTARG" ;;
76 "i") OPT_INSTALL="$OPTARG";;
77 "s") OPT_OSRFDIR="$OPTARG";;
82 "h"|*) usage && exit;;
86 # ----------------------------------
87 # DEFAULTS (w/ optional overrides)
88 # ----------------------------------
89 INSTALL=${OPT_INSTALL:-/openils};
90 BASE=~ # default to $HOME (~ doesn't like :- syntax for whatever reason)
91 [ -z "$OPT_BASEDIR" ] || BASE="$OPT_BASEDIR";
93 OSRF=${OPT_OSRFDIR:-$BASE/OpenSRF/trunk};
94 ILS=${OPT_EGDIR:-$BASE/ILS/trunk};
95 XUL="$INSTALL/var/web/xul";
97 # ----------------------------------
98 # TEST and SANITY CHECK
99 # ----------------------------------
100 [ ! -d "$ILS" ] && die_msg "Evergreen Source Directory '$ILS' does not exist!";
101 [ ! -d "$INSTALL" ] && die_msg "Evergreen Install Directory '$INSTALL' does not exist!";
102 [ ! -d "$XUL" ] && die_msg "Evergreen XUL Client Directory '$XUL' does not exist!";
103 [ ! -d "$OSRF" ] && die_msg "OpenSRF Source Directory '$OSRF' does not exist!";
104 which sudo >/dev/null || die_msg "sudo not installed (or in PATH)";
106 if [ ! -z "$OPT_TEST" ] ; then
111 # ----------------------------------
113 # ----------------------------------
114 if [ -z "$OPT_VERBOSE" ] ; then
115 echo "Running with some make output suppressed. To see all output, run $0 with -v (verbose)";
116 echo "This may take a few minutes... ";
117 exec 3>&1 # Save current STDOUT to FD3
118 exec 1>/dev/null # redirect (not close) STDOUT
121 echo -e "Password prompts are triggered by sudo (as this user)\nStopping Apache.";
122 set -x; # echo commands to screen
125 sudo /etc/init.d/apache2 stop;
126 $INSTALL/bin/osrf_ctl.sh -l -a stop_all;
128 # OpenSRF perl directory is not shared. update the drone
129 # ssh 10.5.0.202 "./update_osrf_perl.sh";
131 cd $OSRF; svn_or_git;
134 if [ -n "$OPT_CLEAN" ]; then
135 cd $OSRF && make clean;
136 cd $ILS && make clean;
139 if [ -z "$OPT_FULL" ]; then
142 cd $OSRF && sudo make install;
144 sudo chown -R opensrf:opensrf $INSTALL
146 BID=$(date +"%Y-%m-%dT%H:%M:%S"); # or "current"
147 cd $ILS && sudo make install STAFF_CLIENT_BUILD_ID=$BID;
148 sudo chown -R opensrf:opensrf $INSTALL
150 if [ -z "$OPT_VERBOSE" ] ; then
151 exec 1>&3 # Restore STDOUT
154 cd $XUL || die_msg "Could not cd to $XUL";
156 rm -f ./current-client-build.zip;
157 cp -r "$ILS/Open-ILS/xul/staff_client/build" ./
158 zip -rq current-client-build.zip build;
160 rm -f current; # removing the link to the old build
161 ln -s $BID current; # linking "current" to the new build
162 ln -s current/server server;
164 sudo chown -R opensrf:opensrf $OSRF $ILS
165 $INSTALL/bin/osrf_ctl.sh -l -a start_all
167 cd $INSTALL/bin; ./autogen.sh ../conf/opensrf_core.xml;
168 sudo /etc/init.d/apache2 start;