EG install scripts: nonprod-28 -> nonprod
[sitka/sitka-tools.git] / deployment / install-eg.sh
index 1d8e5c0..984fd05 100755 (executable)
@@ -1,19 +1,19 @@
 #!/bin/bash
 # IMPORTANT! This script assumes you have already installed OpenSRF.
 
-HOSTNAME="nonprod-28"
+HOSTNAME="nonprod"
 DEFAULT_USER="sitkastaff"
 HOMEDIR="/home/${DEFAULT_USER}"
 #EGRELEASE="Evergreen-ILS-2.8.beta"
 #BUILDDIR="${HOMEDIR}/${EGRELEASE}"
 BUILDDIR="${HOMEDIR}/evergreen"
 INSTALLDIR="/srv/openils"
-BRANCH="upgrade/eg28/final-tpac"
+BRANCH="production/sitka_2_8_tpac"
 STAMP_ID="rel_2_8_1"
 ALT_STAMP_IDS="2_8_1 rel_2_8_beta 2_8_beta rel_2_8_0 2_8_0"
 VERSION="2.8.1.sitka.0"
 SITKACONF="${HOMEDIR}/sysadmin"
-SITKACONF_BRANCH="eg28"
+SITKACONF_BRANCH="master"
 SITKATOOLS="/root/sitka-tools"
 
 suwrap() {
@@ -23,6 +23,7 @@ suwrap() {
 while getopts ":p" opt ; do
   case $opt in
     p ) PROD="prod";;
+    e ) EDI="edi";;
   esac
 done
 shift $(($OPTIND - 1))
@@ -61,7 +62,7 @@ cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-trusty
  
 # as DEFAULT_USER
 suwrap "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER} # not required for release versions
-suwrap "cd ${BUILDDIR} && ./configure -C --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf --with-opensrf-headers=${INSTALLDIR}/include/ --with-opensrf-libs=${INSTALLDIR}/lib/" ${DEFAULT_USER}
+suwrap "PATH=${INSTALLDIR}/bin:\$PATH cd ${BUILDDIR} && PATH=${INSTALLDIR}/bin:\$PATH ./configure -C --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf --with-opensrf-headers=${INSTALLDIR}/include/ --with-opensrf-libs=${INSTALLDIR}/lib/" ${DEFAULT_USER}
 suwrap "cd ${BUILDDIR} && make" ${DEFAULT_USER}
 suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en-CA install" ${DEFAULT_USER}
  
@@ -150,13 +151,28 @@ cd ${INSTALLDIR}/var/web/xul/server/locale/en-CA && mv multiclass_search_help.ht
  
 # 6. deletepatron
 # ensure apache conf contains deletepatron config (location should be ${INSTALLDIR}/var/web/deletepatron)
-#cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
-#cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22 && find . -name "*.pm" | xargs sed -i -e 's|/openils|/srv/openils|g'
+if [[ ! -d "${INSTALLDIR}/var/web/deletepatron" ]] ; then
+  NEW_DELETEPATRON_INSTALL="true"
+  cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
+fi
+cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22
+if [[ -n "$NEW_DELETEPATRON_INSTALL" ]] ; then
+  find ${INSTALLDIR}/var/web/deletepatron -name "*.pm" | xargs sed -i -e 's|/openils|/srv/openils|g'
+fi
 apt-get install -y libcgi-session-perl libhtml-template-perl
 
-# 7. support scripts - XXX deprecated?
-#cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
-#cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
+# 7. support scripts
+cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
+cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
+
+# 7.5 EDI (optional)
+if [[ -n "$EDI" ]] ; then
+  cp -r ${BUILDDIR}/Open-ILS/src/edi_translator ${INSTALLDIR}/var/edi
+  cd ${INSTALLDIR}/var/edi && ./install.sh
+  cp ${BUILDDIR}/Open-ILS/src/support-scripts/edi_pusher.pl ${INSTALLDIR}/bin
+  cp ${BUILDDIR}/Open-ILS/src/support-scripts/edi_fetcher.pl ${INSTALLDIR}/bin
+  cp ${SYSADMIN}/files/${INSTALLDIR}/bin/edi_per_account_fetcher.sh ${INSTALLDIR}/bin/edi_per_account_fetcher.sh
+fi
 
 # 8. setup start page
 if [ ! -d "${INSTALLDIR}/var/web/news" ]
@@ -187,7 +203,7 @@ if [ ! -d "${INSTALLDIR}/var/data/offline/blocked" ] ; then
     mkdir -p ${INSTALLDIR}/var/data/offline/blocked
   fi
 fi
-if [ ! -e "${INSTALLDIR}/var/web/standalone/list.txt" ] ; then ln -s ${INSTALLDIR}/var/data/offline/blocked/patron-block-list.txt ${INSTALLDIR}/var/web/standalone/list.txt ; fi
+if [ ! -e "${INSTALLDIR}/var/web/standalone/list.txt" ] ; then ln -sf ${INSTALLDIR}/var/data/offline/blocked/patron-block-list.txt ${INSTALLDIR}/var/web/standalone/list.txt ; fi
 if [ ! -e "${INSTALLDIR}/bin/update-offline-blocked-list.sh" ] ; then cp ${SITKATOOLS}/maintenance/update-offline-blocked-list.sh ${INSTALLDIR}/bin/update-offline-blocked-list.sh ; fi
 
 cp ${SITKACONF}/files${INSTALLDIR}/var/data/zips.txt/${HOSTNAME} ${INSTALLDIR}/var/data/zips.txt
@@ -195,12 +211,21 @@ cp ${SITKACONF}/files${INSTALLDIR}/var/data/zips.txt/${HOSTNAME} ${INSTALLDIR}/v
 cp -r ${SITKATOOLS}/overdrive-eg-opac/build/* ${INSTALLDIR}/var/web/js/ui/default/opac
 ODAPI_LIBS="bc mb"
 for ODAPI_LIB in ${ODAPI_LIBS} ; do
-  cp ${SYSADMIN}/files/${INSTALLDIR}/var/web/js/ui/default/opac/${ODAPI_LIB}/od_config.js ${INSTALLDIR}/var/web/js/ui/default/opac/${ODAPI_LIB}/od_config.js
+  cp ${SITKACONF}/files/${INSTALLDIR}/var/web/js/ui/default/opac/${ODAPI_LIB}/od_config.js ${INSTALLDIR}/var/web/js/ui/default/opac/${ODAPI_LIB}/od_config.js
 done
 
+# install mobile PAC
+cd ${INSTALLDIR}/var/web/opac/extras && git clone git://git.sitka.bclibraries.ca/sitka/mobile-evergreen-opac.git mobile
+
 # 9. make sure opensrf owns all the stuff we just did
 chown -R opensrf:opensrf ${INSTALLDIR}
 chown -R opensrf:opensrf /home/opensrf
+SKINDIRS="${INSTALLDIR}/var/skins ${INSTALLDIR}/var/web/css/skin"
+for SKINDIR in ${SKINDIRS} ; do
+  if [[ ! -d "${SKINDIR}" ]] ; then mkdir ${SKINDIR} ; fi
+  chmod 777 ${SKINDIR}
+  chown -R sitkastaff:sitkastaff ${SKINDIR}
+done
 
 # 10. staff client stuff
 apt-get install -y nsis unzip
@@ -209,4 +234,4 @@ apt-get install -y nsis unzip
 apt-get install -y libconfig-simple-perl libgit-repository-perl libdate-manip-perl
 
 # 12. paper overdue prereqs
-apt-get install -y python-reportlab python-reportlab-accel
+apt-get install -y python-reportlab python-reportlab-accel unifont