install-eg.sh: add update-only flag to exit early on reinstall (but make sure banner...
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Tue, 30 Oct 2018 21:08:33 +0000 (14:08 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Tue, 30 Oct 2018 21:08:33 +0000 (14:08 -0700)
deployment/install-eg.sh

index fd0a938..c32a1bc 100755 (executable)
@@ -28,6 +28,7 @@ while getopts ":pecWbt" opt ; do
     W ) SKIPWEBCLIENT="skipwebclient";;
     b ) USEBUNDLE="usebundle";;
     t ) TARBALL="tarball";;
+    u ) UPDATEONLY="updateonly";;
   esac
 done
 shift $(($OPTIND - 1))
@@ -71,7 +72,6 @@ else
   suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${INSTALL_USER}
 fi
 
 # as root
 cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-xenial
 if [[ ! -n "$TARBALL" ]] ; then
@@ -107,6 +107,51 @@ suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en
 cd ${BUILDDIR} && make STAFF_CLIENT_VERSION=${VERSION} STAFF_CLIENT_STAMP_ID=${STAMP_ID} install
 mv ${INSTALLDIR}/var/web/reports/fm_IDL.xml ${INSTALLDIR}/var/web/reports/fm_IDL.xml.orig && cp ${INSTALLDIR}/conf/fm_IDL.xml ${INSTALLDIR}/var/web/reports/
  
+# setup start page
+if [ ! -d "${INSTALLDIR}/var/web/news" ]
+then
+  mkdir ${INSTALLDIR}/var/web/news
+fi
+if [ ! -d "${INSTALLDIR}/var/web/news/media" ]
+then
+  mkdir ${INSTALLDIR}/var/web/news/media
+fi
+NEWSFILES="index.html style.css media/logo.png media/book.png media/policy.png media/dash.png media/delete.png"
+for NEWSFILE in ${NEWSFILES}
+do
+  if [ -f "${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME}" ]
+  then
+    cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME} ${INSTALLDIR}/var/web/news/${NEWSFILE}
+  fi
+done
+if [[ -n "$PROD" ]] ; then
+  if [ ! -e "${INSTALLDIR}/var/web/news/wikipull.pl" ] ; then cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/wikipull.pl/${HOSTNAME} ${INSTALLDIR}/var/web/news/wikipull.pl ; fi
+  if [ ! -e "/etc/cron.d/news" ] ; then cp ${SITKACONF}/files/etc/cron.d/news/${HOSTNAME} /etc/cron.d/news ; fi
+else
+  # nonprod server, auto-update splash page with install info
+  TODAY=`date +'%A %d %B %Y'`
+  sed -i "s|__THISHOST__|${THISHOST}|g" ${INSTALLDIR}/var/web/news/index.html
+  sed -i "s|__TODAY__|${TODAY}|g" ${INSTALLDIR}/var/web/news/index.html
+  sed -i "s|__VERSION__|${VERSION}|g" ${INSTALLDIR}/var/web/news/index.html
+  sed -i "s|__BRANCH__|${BRANCH}|g" ${INSTALLDIR}/var/web/news/index.html
+fi
+
+# setup/update test server banner
+if [[ ! -n "$PROD" ]] ; then
+  SITECONFIGS="/etc/apache2/sites-available/test-server.conf"
+  for SITECONFIG in ${SITECONFIGS} ; do
+    cp ${SITKACONF}/files/${SITECONFIG}/${HOSTNAME} ${SITECONFIG}
+    sed -i "s|__NONPROD__|${THISHOST}|g" ${SITECONFIG}
+    sed -i "s|__VERSION__|${VERSION}|g" ${SITECONFIG}
+  done
+  a2ensite test-server.conf
+fi
+
+# if we are just updating an existing EG install, we're all done!
+if [[ -n "$UPDATEONLY" ]] ; then
+    exit 0
+fi
+
 # Apache stuff (as root):
 APACHEFILES="/etc/apache2/mods-available/mpm_prefork.conf"
 for APACHEFILE in ${APACHEFILES}
@@ -127,13 +172,6 @@ chown -R opensrf:opensrf /var/lock/apache2
 
 # More Apache stuff for non-production sites
 if [[ ! -n "$PROD" ]] ; then
-  SITECONFIGS="/etc/apache2/sites-available/test-server.conf"
-  for SITECONFIG in ${SITECONFIGS} ; do
-    cp ${SITKACONF}/files/${SITECONFIG}/${HOSTNAME} ${SITECONFIG}
-    sed -i "s|__NONPROD__|${THISHOST}|g" ${SITECONFIG}
-    sed -i "s|__VERSION__|${VERSION}|g" ${SITECONFIG}
-  done
-  a2ensite test-server.conf
   a2dissite 000-default
   if [ ! -d "/etc/apache2/ssl/libraries.coop/star.catalogue.libraries.coop" ]
   then
@@ -308,35 +346,6 @@ if [[ -n "$EDI" ]] ; then
   cp -b ${SYSADMIN}/files/var/lib/gems/2.3.0/gems/openils-mapper-0.9.9/lib/edi/mapper.rb /var/lib/gems/2.3.0/gems/openils-mapper-0.9.9/lib/edi/mapper.rb
 fi
 
-# 8. setup start page
-if [ ! -d "${INSTALLDIR}/var/web/news" ]
-then
-  mkdir ${INSTALLDIR}/var/web/news
-fi
-if [ ! -d "${INSTALLDIR}/var/web/news/media" ]
-then
-  mkdir ${INSTALLDIR}/var/web/news/media
-fi
-NEWSFILES="index.html style.css media/logo.png media/book.png media/policy.png media/dash.png media/delete.png"
-for NEWSFILE in ${NEWSFILES}
-do
-  if [ -f "${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME}" ]
-  then
-    cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME} ${INSTALLDIR}/var/web/news/${NEWSFILE}
-  fi
-done
-if [[ -n "$PROD" ]] ; then
-  if [ ! -e "${INSTALLDIR}/var/web/news/wikipull.pl" ] ; then cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/wikipull.pl/${HOSTNAME} ${INSTALLDIR}/var/web/news/wikipull.pl ; fi
-  if [ ! -e "/etc/cron.d/news" ] ; then cp ${SITKACONF}/files/etc/cron.d/news/${HOSTNAME} /etc/cron.d/news ; fi
-else
-  # nonprod server, auto-update splash page with install info
-  TODAY=`date +'%A %d %B %Y'`
-  sed -i "s|__THISHOST__|${THISHOST}|g" ${INSTALLDIR}/var/web/news/index.html
-  sed -i "s|__TODAY__|${TODAY}|g" ${INSTALLDIR}/var/web/news/index.html
-  sed -i "s|__VERSION__|${VERSION}|g" ${INSTALLDIR}/var/web/news/index.html
-  sed -i "s|__BRANCH__|${BRANCH}|g" ${INSTALLDIR}/var/web/news/index.html
-fi
-
 # 8.5 offline patron list
 if [ ! -d "${INSTALLDIR}/var/data/offline/blocked" ] ; then 
   # TODO: handle prod - an NFS share should exist