install-eg.sh: install upstream release from tarball
authortwirlip <twirlip@twirlip.org>
Tue, 17 Apr 2018 22:59:24 +0000 (15:59 -0700)
committertwirlip <twirlip@twirlip.org>
Tue, 17 Apr 2018 22:59:24 +0000 (15:59 -0700)
deployment/install-eg.sh

index 364eaab..0398758 100755 (executable)
@@ -4,8 +4,6 @@
 HOSTNAME="nonprod"
 DEFAULT_USER="opensrf"
 INSTALL_USER="opensrf"
-#EGRELEASE="Evergreen-ILS-3.1.0"
-#BUILDDIR="/home/${INSTALL_USER}/${EGRELEASE}"
 BUILDDIR="/home/${INSTALL_USER}/evergreen"
 INSTALLDIR="/srv/openils"
 BRANCH="user/jeffdavis/upgrade-310-tpac"
@@ -22,13 +20,14 @@ suwrap() {
   su -s /bin/bash -c "source ~/.bashrc ; $1" $2
 }
 
-while getopts ":pecwb" opt ; do
+while getopts ":pecwbt" opt ; do
   case $opt in
     p ) PROD="prod";;
     e ) EDI="edi";;
     c ) CRONTAB="crontab";;
     w ) WEBCLIENT="webclient";;
     b ) USEBUNDLE="usebundle";;
+    t ) TARBALL="tarball";;
   esac
 done
 shift $(($OPTIND - 1))
@@ -50,16 +49,25 @@ then
 fi
 suwrap "cd ${SITKACONF} && git fetch origin && git checkout ${SITKACONF_BRANCH} && git pull" ${DEFAULT_USER}
 
-# checkout EG source
-if [ ! -d "${BUILDDIR}" ]
-then
-  suwrap "cd /home/${INSTALL_USER} && git clone git://git.sitka.bclibraries.ca/sitka/evergreen evergreen" ${INSTALL_USER}
+if [[ -n "$TARBALL" ]] ; then
+  EGRELEASE="Evergreen-ILS-${VERSION}"
+  BUILDDIR="/home/${INSTALL_USER}/${EGRELEASE}"
+  echo 'installing packaged upstream release ${VERSION}'
+  # download and unpack EG release
+  rm -rf ${BUILDDIR}
+  if [ ! -f "/home/${INSTALL_USER}/${EGRELEASE}.tar.gz" ] ; then
+    suwrap "cd /home/${INSTALL_USER} && wget http://open-ils.org/downloads/${EGRELEASE}.tar.gz" ${INSTALL_USER} || { echo "Could not download EG release tarball ${EGRELEASE}.tar.gz" ; exit 1; }
+  fi
+  suwrap "cd /home/${INSTALL_USER} && tar xzf ${EGRELEASE}.tar.gz" ${INSTALL_USER}
+else
+  # checkout EG source
+  if [ ! -d "${BUILDDIR}" ]
+  then
+    suwrap "cd /home/${INSTALL_USER} && git clone git://git.sitka.bclibraries.ca/sitka/evergreen evergreen" ${INSTALL_USER}
+  fi
+  suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${INSTALL_USER}
 fi
-suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${INSTALL_USER}
 
-# download and unpack EG release
-#rm -rf ${BUILDDIR}
-#suwrap "cd /home/${INSTALL_USER} && wget http://open-ils.org/downloads/${EGRELEASE}.tar.gz && tar xzf ${EGRELEASE}.tar.gz" ${INSTALL_USER}
  
 # as root
 cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-trusty
@@ -69,7 +77,7 @@ fi
 # by default, CPAN needs some manual input at this point; you can just accept all defaults
  
 # web client
-if [[ -n "$WEBCLIENT" ]] ; then
+if [[ -n "$WEBCLIENT" && ! -n "$TARBALL" ]] ; then
   if [[ -n "$USEBUNDLE" ]] ; then
     # use bundled web client dependencies from upstream
     if [ ! -d "/home/${INSTALL_USER}/web-client-deps" ] ; then