[open-ils-commits] r15015 - in trunk/build: . tools (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 23 15:38:45 EST 2009
Author: erickson
Date: 2009-11-23 15:38:40 -0500 (Mon, 23 Nov 2009)
New Revision: 15015
Added:
trunk/build/tools/
trunk/build/tools/update.sh
Log:
Update script patch from Joe Atzberger.
===
The purpose of this script is to consolidate a lot of the annoying and error-prone tasks associated with an upgrade for a developer, including make, make install, the xulrunner client built and autogen.
Considerations:
* Run as user "opensrf"
* opensrf needs sudo (again, targeting developers, not production) for apache stop/start, chown and make install
* Assumes opensrf has two SVN (or git-svn) repos: OpenILS and OpenSRF
* Both repos should be already configured (as in ./configure)
Detailed usage notes available via -h option. Both repo directories and the install directory can be specified on the command line. Try it with -t (test mode) to see feedback without making any changes.
===
TODO. Add option to use brick_ctl.sh instead of osrf_ctl.sh for service start/stop
Added: trunk/build/tools/update.sh
===================================================================
--- trunk/build/tools/update.sh (rev 0)
+++ trunk/build/tools/update.sh 2009-11-23 20:38:40 UTC (rev 15015)
@@ -0,0 +1,169 @@
+#!/bin/bash
+#
+# Author: Joe Atzberger, Equinox Software, Inc.
+# License: GPL v2 or greater.
+#
+# Based on initial version by Bill Erickson.
+
+function svn_or_git {
+ echo -en "###########\nUpdating source directory: ";
+ pwd;
+ if [ -d "./.git" ]; then
+ git svn fetch;
+ git svn rebase origin;
+ else
+ svn update;
+ fi
+}
+
+function feedback {
+cat <<END_OF_FEEDBACK
+Running with options:
+ CLEAN = ${OPT_CLEAN:-no}
+ FULL = ${OPT_FULL:-no}
+ VERBOSE = ${OPT_VERBOSE:-no}
+
+Using Directories --
+ OpenSRF repo : ${OSRF:-Missing}
+ OpenILS repo : ${ILS:-Missing}
+ OpenILS install: ${INSTALL:-Missing}
+ XUL install: ${XUL:-Missing}
+
+END_OF_FEEDBACK
+}
+
+function usage {
+ cat <<END_OF_USAGE
+usage: $0 [-e /eg_trunk] [-i /openils_dir] [-s /srf_trunk] [-[cfbvt]]
+
+PARAMETERS:
+ -e specify Evergreen (OpenILS) source repository (default ~/ILS/trunk)
+ -i specify Evergreen installed directory (default /openils)
+ -s specify OpenSRF source repository (default ~/OpenSRF/trunk)
+
+All parameters are optional, but you will probably need to use -e and -i.
+
+OPTIONS:
+ -c clean: run make clean before make
+ -f full: make both packages, do OpenSRF make install (usually not required)
+ -t test: gives feedback but does not run anything
+ -v verbose
+
+The purpose of this script is to consolidate a lot of the annoying
+and error-prone tasks associated with an upgrade for a developer.
+
+Considerations:
+ * Run as opensrf.
+ * opensrf needs sudo
+ * Assumes opensrf has a configured (as in ./configure) both ILS and
+ OpenSRF as svn or git-svn checkouts
+END_OF_USAGE
+}
+
+function die_msg {
+ echo -e "ERROR: ${1:-Unknown}\n" >&2;
+ usage;
+ exit 1;
+}
+
+# ----------------------------------
+# Prespond to command-line options
+# ----------------------------------
+while getopts "cfhtvb:e:i:s:" flag; do
+ case $flag in
+ "b") OPT_BASEDIR="$OPTARG";; # HIDDEN (undocumented) option.
+ "e") OPT_EGDIR="$OPTARG" ;;
+ "i") OPT_INSTALL="$OPTARG";;
+ "s") OPT_OSRFDIR="$OPTARG";;
+ "c") OPT_CLEAN=1 ;;
+ "f") OPT_FULL=1 ;;
+ "t") OPT_TEST=1 ;;
+ "v") OPT_VERBOSE=1;;
+ "h"|*) usage && exit;;
+ esac;
+done
+
+# ----------------------------------
+# DEFAULTS (w/ optional overrides)
+# ----------------------------------
+INSTALL=${OPT_INSTALL:-/openils};
+BASE=~ # default to $HOME (~ doesn't like :- syntax for whatever reason)
+[ -z "$OPT_BASEDIR" ] || BASE="$OPT_BASEDIR";
+
+OSRF=${OPT_OSRFDIR:-$BASE/OpenSRF/trunk};
+ILS=${OPT_EGDIR:-$BASE/ILS/trunk};
+XUL="$INSTALL/var/web/xul";
+
+# ----------------------------------
+# TEST and SANITY CHECK
+# ----------------------------------
+[ ! -d "$ILS" ] && die_msg "Evergreen Source Directory '$ILS' does not exist!";
+[ ! -d "$INSTALL" ] && die_msg "Evergreen Install Directory '$INSTALL' does not exist!";
+[ ! -d "$XUL" ] && die_msg "Evergreen XUL Client Directory '$XUL' does not exist!";
+[ ! -d "$OSRF" ] && die_msg "OpenSRF Source Directory '$OSRF' does not exist!";
+which sudo >/dev/null || die_msg "sudo not installed (or in PATH)";
+
+if [ ! -z "$OPT_TEST" ] ; then
+ feedback;
+ exit;
+fi
+
+# ----------------------------------
+# MAIN
+# ----------------------------------
+if [ -z "$OPT_VERBOSE" ] ; then
+ echo "Running with some make output suppressed. To see all output, run $0 with -v (verbose)";
+ echo "This may take a few minutes... ";
+ exec 3>&1 # Save current STDOUT to FD3
+ exec 1>/dev/null # redirect (not close) STDOUT
+else
+ feedback;
+ echo -e "Password prompts are triggered by sudo (as this user)\nStopping Apache.";
+ set -x; # echo commands to screen
+fi
+
+sudo /etc/init.d/apache2 stop;
+$INSTALL/bin/osrf_ctl.sh -l -a stop_all;
+
+# OpenSRF perl directory is not shared. update the drone
+# ssh 10.5.0.202 "./update_osrf_perl.sh";
+
+cd $OSRF; svn_or_git;
+cd $ILS; svn_or_git;
+
+if [ -n "$OPT_CLEAN" ]; then
+ cd $OSRF && make clean;
+ cd $ILS && make clean;
+fi
+
+if [ -z "$OPT_FULL" ]; then
+ cd $OSRF && make;
+ cd $ILS && make;
+ cd $OSRF && sudo make install;
+fi
+sudo chown -R opensrf:opensrf $INSTALL
+
+BID=$(date +"%Y-%m-%dT%H:%M:%S"); # or "current"
+cd $ILS && sudo make install STAFF_CLIENT_BUILD_ID=$BID;
+sudo chown -R opensrf:opensrf $INSTALL
+
+if [ -z "$OPT_VERBOSE" ] ; then
+ exec 1>&3 # Restore STDOUT
+fi
+
+cd $XUL || die_msg "Could not cd to $XUL";
+pwd;
+rm -f ./current-client-build.zip;
+cp -r "$ILS/Open-ILS/xul/staff_client/build" ./
+zip -rq current-client-build.zip build;
+rm -rf ./build;
+rm -f current; # removing the link to the old build
+ln -s $BID current; # linking "current" to the new build
+ln -s current/server server;
+
+sudo chown -R opensrf:opensrf $OSRF $ILS
+$INSTALL/bin/osrf_ctl.sh -l -a start_all
+sleep 2;
+cd $INSTALL/bin; ./autogen.sh ../conf/opensrf_core.xml;
+sudo /etc/init.d/apache2 start;
+
Property changes on: trunk/build/tools/update.sh
___________________________________________________________________
Name: svn:executable
+ *
More information about the open-ils-commits
mailing list