install-eg.sh: fix typo in NFS setup
[sitka/sitka-tools.git] / deployment / install-eg.sh
CommitLineData
0155bbac
JD
1#!/bin/bash
2# IMPORTANT! This script assumes you have already installed OpenSRF.
3
79b2efa0 4HOSTNAME="nonprod"
8da49eaf 5DEFAULT_USER="opensrf"
bd4a0e27 6INSTALL_USER="opensrf"
9bb70e10 7BUILDDIR="/home/${INSTALL_USER}/evergreen"
0155bbac 8INSTALLDIR="/srv/openils"
a1c0327b
JD
9REPO="git+ssh://git@git.sitka.bclibraries.ca/sitka/evergreen"
10#REPO="git://git.evergreen-ils.org/working/Evergreen.git"
11#REPO="git://git.evergreen-ils.org/Evergreen.git"
9acc9e5f
JD
12BRANCH="origin/user/jeffdavis/eg37-beta-tpac"
13STAMP_ID="rel_3_7_beta"
14VERSION="3.7.beta.sitka.1"
9bb70e10 15SITKACONF="/home/${DEFAULT_USER}/sysadmin"
7159ed6b 16SITKACONF_BRANCH="ubuntu-focal"
341cf34e 17SITKATOOLS="/root/sitka-tools"
0155bbac 18
605401cc
JD
19THISHOST=`hostname -s`
20
e724d7db 21suwrap() {
e2ad4781 22 su -s /bin/bash -c "source ~/.bashrc ; $1" $2
e724d7db
JD
23}
24
bca2ded5 25while getopts ":pecnWbrtuD" opt ; do
24057702
JD
26 case $opt in
27 p ) PROD="prod";;
f3b555fc 28 e ) EDI="edi";;
286e0b2b 29 c ) CRONTAB="crontab";;
4521aa77 30 n ) NFS="nfs";;
519772ff 31 W ) SKIPWEBCLIENT="skipwebclient";;
fb1e0d9b 32 b ) USEBUILDSERVER="usebuildserver";;
bca2ded5 33 r ) RUNTESTS="runtests";;
be754493 34 t ) TARBALL="tarball";;
ea48fca9 35 u ) UPDATEONLY="updateonly";;
bca2ded5 36 D ) CLEANINSTALL="cleaninstall";;
24057702
JD
37 esac
38done
39shift $(($OPTIND - 1))
40
41if [[ -n "$PROD" ]] ; then
42 echo 'this is a production install'
34f86bbc 43 [ "$HOSTNAME" == "nonprod" ] && HOSTNAME="prod"
24057702
JD
44else
45 echo 'this is NOT a production install'
46fi
47
0155bbac
JD
48# as DEFAULT_USER
49
50# grab Sitka config files
51if [ ! -d "${SITKACONF}" ]
52then
53 # this will fail unless DEFAULT_USER has read access to the repo
519772ff 54 suwrap "cd /home/${DEFAULT_USER} && git clone git+ssh://git@git.sitka.bclibraries.ca/sitka-infra/sysadmin" ${DEFAULT_USER} || { echo "Could not get config files; exiting." ; exit 1; }
0155bbac 55fi
519772ff 56suwrap "cd ${SITKACONF} && git fetch origin && git checkout ${SITKACONF_BRANCH} && git pull" ${DEFAULT_USER} || { echo "Could not checkout ${SITKACONF_BRANCH} config files; exiting." ; exit 1; }
0155bbac 57
be754493 58if [[ -n "$TARBALL" ]] ; then
59 EGRELEASE="Evergreen-ILS-${VERSION}"
490bb871 60 EGRELEASETGZ="${EGRELEASE}.tar.gz"
519772ff 61 [ ${VERSION} == "3.1.0" ] && EGRELEASETGZ="Evergreen-ILS-3.1.0a.tar.gz"
be754493 62 BUILDDIR="/home/${INSTALL_USER}/${EGRELEASE}"
519772ff
JD
63 BRANCH="$VERSION"
64 echo "installing packaged upstream release ${EGRELEASE}"
be754493 65 # download and unpack EG release
66 rm -rf ${BUILDDIR}
519772ff
JD
67 if [ ! -f "/home/${INSTALL_USER}/${EGRELEASETGZ}" ] ; then
68 suwrap "cd /home/${INSTALL_USER} && wget http://open-ils.org/downloads/${EGRELEASETGZ}" ${INSTALL_USER} || { echo "Could not download EG release tarball ${EGRELEASETGZ}" ; exit 1; }
be754493 69 fi
519772ff 70 suwrap "cd /home/${INSTALL_USER} && tar xzf ${EGRELEASETGZ}" ${INSTALL_USER}
be754493 71else
4a6c8f6a
JD
72 if [[ -n "$CLEANINSTALL" ]] ; then
73 rm -rf "${BUILDDIR}"
74 cd /usr/local/bin/ && rm ng node npm npx
75 cd /usr/local/lib/ && rm -rf node_modules/
76 fi
be754493 77 # checkout EG source
78 if [ ! -d "${BUILDDIR}" ]
79 then
a1c0327b 80 suwrap "cd /home/${INSTALL_USER} && git clone ${REPO} evergreen" ${INSTALL_USER}
be754493 81 fi
82 suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${INSTALL_USER}
ae9cb412 83fi
71f85432 84
0155bbac 85# as root
7159ed6b 86cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-focal
fb1e0d9b 87if [[ ! -n "$TARBALL" && ! -n "$USEBUILDSERVER" ]] ; then
7159ed6b 88 cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-focal-translator # required for web client and custom translations
676b054f 89fi
0155bbac
JD
90# by default, CPAN needs some manual input at this point; you can just accept all defaults
91
a4d987d6 92# web client
fb1e0d9b
JD
93if [[ ! -n "$TARBALL" && ! -n "$SKIPWEBCLIENT" && ! -n "$USEBUILDSERVER" ]] ; then
94 # install dependencies
95 cd ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/
96 sed -i "s|'/openils/lib/javascript|'${INSTALLDIR}/lib/javascript|g" ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/test/karma.conf.js
97 suwrap "npm install" ${INSTALL_USER}
98 suwrap "npm run build-prod" ${INSTALL_USER} || { echo 'Could not install files for AngularJS staff client' ; exit 1; }
99 if [ -n "$RUNTESTS" ] ; then suwrap "npm run test" ${INSTALL_USER} || { echo 'Tests failed for AngularJS staff client' ; exit 1; } ; fi
100 cd ${BUILDDIR}/Open-ILS/src/eg2/
101 sed -i "s|'/openils/lib/javascript|'${INSTALLDIR}/lib/javascript|g" ${BUILDDIR}/Open-ILS/src/eg2/karma.conf.js
102 sed -i "s|locales: ['en-US']|locales: ['en-US','en-CA','fr-CA']|" ${BUILDDIR}/Open-ILS/src/eg2/src/environments/environment.prod.ts
103 suwrap "npm install" ${INSTALL_USER}
104 suwrap "ng build --prod" ${INSTALL_USER} || { echo 'Could not install files for Angular staff client' ; exit 1; }
105 if [ -n "$RUNTESTS" ] ; then suwrap "npm run test" ${INSTALL_USER} || { echo 'Tests failed for Angular staff client' ; exit 1; } ; fi
a4d987d6 106fi
107
7159ed6b
JD
108# install Bootstrap OPAC dependencies
109cd ${BUILDDIR}/Open-ILS/web/opac/deps
110suwrap "npm install" {$INSTALL_USER}
111
bd4a0e27 112# as INSTALL_USER
95c72bba 113[ ! -n "$TARBALL" ] && suwrap "cd ${BUILDDIR} && autoreconf -i" ${INSTALL_USER} # not required for release versions
bd4a0e27
JD
114suwrap "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/" ${INSTALL_USER}
115suwrap "cd ${BUILDDIR} && make" ${INSTALL_USER}
157b7812 116[ ! -n "$TARBALL" ] && suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en-CA install" ${INSTALL_USER}
0155bbac
JD
117
118# as root
ed673b6a 119rm -rf ${INSTALLDIR}/var/web/eg2/en-US
1e32ac13 120cd ${BUILDDIR} && make install
8aefd611 121ldconfig
ae9cb412 122mv ${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/
0155bbac 123
ea48fca9
JD
124# setup start page
125if [ ! -d "${INSTALLDIR}/var/web/news" ]
126then
127 mkdir ${INSTALLDIR}/var/web/news
128fi
129if [ ! -d "${INSTALLDIR}/var/web/news/media" ]
130then
131 mkdir ${INSTALLDIR}/var/web/news/media
132fi
133NEWSFILES="index.html style.css media/logo.png media/book.png media/policy.png media/dash.png media/delete.png"
134for NEWSFILE in ${NEWSFILES}
135do
136 if [ -f "${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME}" ]
137 then
138 cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME} ${INSTALLDIR}/var/web/news/${NEWSFILE}
139 fi
140done
141if [[ -n "$PROD" ]] ; then
142 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
143 if [ ! -e "/etc/cron.d/news" ] ; then cp ${SITKACONF}/files/etc/cron.d/news/${HOSTNAME} /etc/cron.d/news ; fi
144else
145 # nonprod server, auto-update splash page with install info
146 TODAY=`date +'%A %d %B %Y'`
147 sed -i "s|__THISHOST__|${THISHOST}|g" ${INSTALLDIR}/var/web/news/index.html
148 sed -i "s|__TODAY__|${TODAY}|g" ${INSTALLDIR}/var/web/news/index.html
149 sed -i "s|__VERSION__|${VERSION}|g" ${INSTALLDIR}/var/web/news/index.html
150 sed -i "s|__BRANCH__|${BRANCH}|g" ${INSTALLDIR}/var/web/news/index.html
151fi
152
153# setup/update test server banner
154if [[ ! -n "$PROD" ]] ; then
155 SITECONFIGS="/etc/apache2/sites-available/test-server.conf"
156 for SITECONFIG in ${SITECONFIGS} ; do
157 cp ${SITKACONF}/files/${SITECONFIG}/${HOSTNAME} ${SITECONFIG}
158 sed -i "s|__NONPROD__|${THISHOST}|g" ${SITECONFIG}
159 sed -i "s|__VERSION__|${VERSION}|g" ${SITECONFIG}
160 done
161 a2ensite test-server.conf
162fi
163
164# if we are just updating an existing EG install, we're all done!
165if [[ -n "$UPDATEONLY" ]] ; then
166 exit 0
167fi
168
320b3c66
JD
169if [[ ! -n "$SKIPWEBCLIENT" ]] ; then
170 apt-get install -y nginx
171fi
172
4521aa77
JD
173# NFS support
174if [[ -n "$NFS" && -n "$PROD" ]] ; then
175 apt-get install -y nfs-common
176 if [ ! -d "${INSTALLDIR}/var/web/reporter" ] ; then suwrap "mkdir ${INSTALLDIR}/var/web/reporter" {$INSTALL_USER} ; fi
177 if [ ! -d "${INSTALLDIR}/var/tmp" ] ; then suwrap "mkdir ${INSTALLDIR}/var/tmp" {$INSTALL_USER} ; fi
12dbbad8 178 if [ ! -d "${INSTALLDIR}/var/data/offline" ] ; then suwrap "mkdir ${INSTALLDIR}/var/data/offline" {$INSTALL_USER} ; fi
4521aa77
JD
179 # TODO: add fstab entries and mount NFS shares - still doing this manually for now
180 #cp ${SITKACONF}/files/etc/fstab/${HOSTNAME} /etc/fstab
181fi
182
0155bbac 183# Apache stuff (as root):
ef6f3a9f 184APACHEFILES="/etc/apache2/mods-available/mpm_prefork.conf"
0155bbac
JD
185for APACHEFILE in ${APACHEFILES}
186do
a4d987d6 187 [[ -e "${APACHEFILE}" ]] && mv ${APACHEFILE} ${APACHEFILE}.`date +%Y-%m-%d-%H%M%S`
40ce1f36 188 cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
0155bbac 189done
8a0b2129 190cp ${BUILDDIR}/Open-ILS/examples/apache_24/eg_startup /etc/apache2/eg_startup
ef6f3a9f 191sed -i 's/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=opensrf/' /etc/apache2/envvars
3a272d45
JD
192if [ ! -d "/etc/apache2/includes" ] ; then
193 mkdir /etc/apache2/includes
194fi
a4d987d6 195a2dismod mpm_event
196a2enmod mpm_prefork
ef6f3a9f 197a2enmod headers
6fafe528 198a2enmod remoteip
71f85432
JD
199# ensure opensrf can run Apache
200chown -R opensrf:opensrf /var/lock/apache2
7d30f3bf 201
ef6f3a9f 202# More Apache stuff for non-production sites
605401cc 203if [[ ! -n "$PROD" ]] ; then
ef6f3a9f 204 a2dissite 000-default
884250a7
JD
205 if [ ! -d "/etc/apache2/ssl/libraries.coop/star.catalogue.libraries.coop" ]
206 then
207 mkdir -p /etc/apache2/ssl/libraries.coop/star.catalogue.libraries.coop
208 cp ${SITKACONF}/files/etc/ssl/apache2/star.catalogue.libraries.coop/star.catalogue.libraries.coop.crt /etc/apache2/ssl/libraries.coop/star.catalogue.libraries.coop/star_catalogue_libraries_coop.crt
209 cp ${SITKACONF}/files/etc/ssl/apache2/star.catalogue.libraries.coop/star.catalogue.libraries.coop.key /etc/apache2/ssl/libraries.coop/star.catalogue.libraries.coop/star_catalogue_libraries_coop.key
210 cp ${SITKACONF}/files/etc/ssl/apache2/star.catalogue.libraries.coop/star.catalogue.libraries.coop.ca /etc/apache2/ssl/libraries.coop/star.catalogue.libraries.coop/star_catalogue_libraries_coop.ca
211 fi
605401cc
JD
212fi
213
7b2b5e72 214# websockets config
519772ff 215if [[ ! -n "$SKIPWEBCLIENT" ]] ; then
48ca004b 216 cp -b {$SITKACONF}/files/etc/nginx/nginx.conf/{$HOSTNAME} /etc/nginx/nginx.conf
cd706301 217 cp -b ${SITKACONF}/files/etc/nginx/sites-available/osrf-ws-http-proxy/${HOSTNAME} /etc/nginx/sites-available/osrf-ws-http-proxy
bdbfd77f 218 #ln -s /etc/nginx/sites-available/osrf-ws-http-proxy /etc/nginx/sites-enabled/osrf-ws-http-proxy
7b2b5e72
JD
219 rm /etc/nginx/sites-enabled/default
220 cp -b ${SITKACONF}/files/etc/apache2/ports.conf/${HOSTNAME} /etc/apache2/ports.conf
221 WSJSFILES="opensrf_ws.js opensrf_ws_shared.js"
222 for WSJSFILE in ${WSJSFILES} ; do
223 # NOTE: this should be unnecessary if we installed OpenSRF with ./configure --with-websockets-port=443
224 sed -i 's/var WEBSOCKET_PORT_SSL = 7682;/var WEBSOCKET_PORT_SSL = 443;/g' ${INSTALLDIR}/lib/javascript/$WSJSFILE
225 done
7b2b5e72
JD
226fi
227
286e0b2b
JD
228# install default crontab, if specified
229if [[ -c "$CRONTAB" ]]; then
230 if [ ! -f "/etc/cron.d/evergreen-dailies" ] ; then
231 cp ${SITKACONF}/files/etc/cron.d/evergreen-dailies/${HOSTNAME} /etc/cron.d/evergreen-dailies
232 fi
233fi
234
607b8582 235# LDAP config
48ca004b 236apt-get install -y ldap-utils
607b8582
JD
237if ! `diff ${SITKACONF}/files/etc/ldap/ldap.conf/${HOSTNAME} /etc/ldap/ldap.conf >/dev/null` ; then
238 cp -b --suffix=.`date +%Y-%m-%d-%H%M%S` ${SITKACONF}/files/etc/ldap/ldap.conf/${HOSTNAME} /etc/ldap/ldap.conf
239fi
240
26b3ea66 241# set up log rotation
702f0bd2
JD
242if [[ ! -n "$PROD" ]] ; then
243 if [ ! -f "/etc/logrotate.d/evergreen" ]
244 then
245 cp ${SITKACONF}/files/etc/logrotate.d/evergreen/${HOSTNAME} /etc/logrotate.d/evergreen
246 fi
26b3ea66 247fi
bcd0a18c 248
4cfcada0
JD
249# remote logging (prod only)
250if [[ -n "$PROD" ]] ; then
251 apt-get install syslog-ng
252 cp ${SITKACONF}/files/etc/syslog-ng/syslog-ng.conf/${HOSTNAME} /etc/syslog-ng/syslog-ng.conf
253 cp ${SITKACONF}/files/etc/syslog-ng/conf.d/sitka.conf/${HOSTNAME} /etc/syslog-ng/conf.d/sitka.conf
254 systemctl restart syslog-ng.service
255 cp ${SITKACONF}/files/usr/local/bin/eg-stats-collector-remote-log.pl /usr/local/bin/eg-stats-collector-remote-log.pl
256 cp ${SITKACONF}/files/usr/local/bin/eg-stats-keepalive.sh /usr/local/bin/eg-stats-keepalive.sh
257 cp ${SITKACONF}/files/etc/cron.d/eg-stats-keepalive/${HOSTNAME} /etc/cron.d/eg-stats-keepalive
258fi
259
bcd0a18c
JD
260# action trigger filters (prod only)
261if [[ -n "$PROD" ]] ; then
262 if [ -f "${INSTALLDIR}/conf/action_trigger_filters.json" ] ; then
263 mv ${INSTALLDIR}/conf/action_trigger_filters.json ${INSTALLDIR}/conf/action_trigger_filters.json.`date +%Y-%m-%d-%H%M%S`
264 fi
265 cp ${SITKACONF}/files/${INSTALLDIR}/conf/action_trigger_filters.json/${HOSTNAME} ${INSTALLDIR}/conf/action_trigger_filters.json
266fi
0155bbac 267
0155bbac
JD
268# 0. osrf conf stuff
269# FIXME: ensure osrf conf files point at a real, distinct db!
270OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
271for OSRFCONFFILE in ${OSRFCONFFILES}
272do
40ce1f36 273 mv ${OSRFCONFFILE} ${OSRFCONFFILE}.`date +%Y-%m-%d-%H%M%S`
3c2fc018
JD
274 if [[ -n "$PROD" && -f "${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME}-314" ]] ; then
275 cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME}-314 ${OSRFCONFFILE}
276 else
277 cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}
278 fi
40ce1f36 279 sed -i "s|__HOSTNAME__|${THISHOST}|g" ${OSRFCONFFILE}
0155bbac 280done
661d99f4 281if [ ! -f "/home/opensrf/.srfsh.xml" ]
9d46f12d 282then
661d99f4 283 cp ${SITKACONF}/files/home/opensrf/.srfsh.xml/${HOSTNAME} /home/opensrf/.srfsh.xml
3c2fc018 284 sed -i "s|__HOSTNAME__|${THISHOST}|g" /home/opensrf/.srfsh.xml
9d46f12d
JD
285fi
286
0155bbac 287# 1. install dojo
abcafeff 288if [ ! -f "/home/opensrf/dojo-release-1.3.3.tar.gz" ]
51a4755a
JD
289then
290 cd /home/opensrf && wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
291fi
0155bbac
JD
292tar -C ${INSTALLDIR}/var/web/js -xzf /home/opensrf/dojo-release-1.3.3.tar.gz
293cp -r ${INSTALLDIR}/var/web/js/dojo-release-1.3.3/* ${INSTALLDIR}/var/web/js/dojo/.
4b074e2e
JD
294# FIXME stock dojo is probably superfluous when we use the following Evergreen-specific tarball...
295if [ ! -f "/home/opensrf/dojo.tgz" ] ; then
296 cd /home/opensrf && wget http://evergreen-ils.org/downloads/dojo.tgz
297fi
298tar -C ${INSTALLDIR}/var/web/js/dojo/ -zxf /home/opensrf/dojo.tgz
0155bbac 299
1e32ac13 300# 2. set up XUL client - DEPRECATED
0155bbac 301
9d46f12d 302# 3. install circ scripts and opac skins - DEPRECATED
71f85432 303
96b76bbb
JD
304# 4a. avoid 404s
305touch ${INSTALLDIR}/var/web/css/skin/default/register_custom.css
96b76bbb 306
1e32ac13 307# 4b. workaround for LP#1461683 - DEPRECATED
71f85432
JD
308
309# 5. locale hack - XXX deprecated?
310#cd ${INSTALLDIR}/var/web/opac/locale && cp -fdr en-US en-US-bak && cp -fdr en-CA en-US
0155bbac
JD
311
312# 6. deletepatron
313# ensure apache conf contains deletepatron config (location should be ${INSTALLDIR}/var/web/deletepatron)
437b75c1
JD
314if [[ ! -d "${INSTALLDIR}/var/web/deletepatron" ]] ; then
315 NEW_DELETEPATRON_INSTALL="true"
316 cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
317fi
318cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22
319if [[ -n "$NEW_DELETEPATRON_INSTALL" ]] ; then
1e32ac13 320 find ${INSTALLDIR}/var/web/deletepatron -name "*.pm" | xargs sed -i -e "s|/openils|${INSTALLDIR}|g"
437b75c1 321fi
ae9cb412 322apt-get install -y libcgi-session-perl libhtml-template-perl
0155bbac 323
f3b555fc
JD
324# 7. support scripts
325cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
22b9d1ac 326cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
9c35266e 327cp ${BUILDDIR}/Open-ILS/src/support-scripts/badge_score_generator.pl ${INSTALLDIR}/bin
f3b555fc
JD
328
329# 7.5 EDI (optional)
330if [[ -n "$EDI" ]] ; then
331 cp -r ${BUILDDIR}/Open-ILS/src/edi_translator ${INSTALLDIR}/var/edi
48ca004b 332 cd ${INSTALLDIR}/var/edi && ./install-ubuntu.sh
f3b555fc
JD
333 cp ${BUILDDIR}/Open-ILS/src/support-scripts/edi_pusher.pl ${INSTALLDIR}/bin
334 cp ${BUILDDIR}/Open-ILS/src/support-scripts/edi_fetcher.pl ${INSTALLDIR}/bin
335 cp ${SYSADMIN}/files/${INSTALLDIR}/bin/edi_per_account_fetcher.sh ${INSTALLDIR}/bin/edi_per_account_fetcher.sh
4531a146
JD
336 # add local modifications to openils-mapper rubygem (eww, yuck, barf)
337 cp -b ${SYSADMIN}/files/var/lib/gems/2.3.0/gems/openils-mapper-0.9.9/lib/openils/mapper.rb /var/lib/gems/2.3.0/gems/openils-mapper-0.9.9/lib/openils/mapper.rb
338 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
f3b555fc 339fi
0155bbac 340
341cf34e 341# 8.5 offline patron list
24057702
JD
342if [ ! -d "${INSTALLDIR}/var/data/offline/blocked" ] ; then
343 # TODO: handle prod - an NFS share should exist
344 if [[ ! -n "$PROD" ]] ; then
345 mkdir -p ${INSTALLDIR}/var/data/offline/blocked
346 fi
347fi
437b75c1 348if [ ! -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
341cf34e
JD
349if [ ! -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
350
f37d71da 351cp ${SITKACONF}/files${INSTALLDIR}/var/data/zips.txt/${HOSTNAME} ${INSTALLDIR}/var/data/zips.txt
661d99f4 352
a5d39801 353cp -b --suffix=.`date +%Y-%m-%d-%H%M%S` ${SITKACONF}/files${INSTALLDIR}/var/web/robots.txt/${HOSTNAME} ${INSTALLDIR}/var/web/robots.txt
ea5fbaea 354
c05e3516 355# 9. make sure opensrf owns all the stuff we just did
b7afc39d 356echo 'managing file permissions...'
af205db8 357if [[ ! -n "$PROD" ]] ; then
6fafe528 358 mkdir ${INSTALLDIR}/var/tmp # this would be an NFS share on prod, but it's just a normal directory for non-prod
af205db8
JD
359 chown -R opensrf:opensrf ${INSTALLDIR} 2>/dev/null
360else
361 for file in `ls -1 ${INSTALLDIR} | grep -v var` ; do chown -R opensrf:opensrf ${INSTALLDIR}/$file ; done
362 chown opensrf:opensrf ${INSTALLDIR}/var
363 for file in `ls -1 ${INSTALLDIR}/var | egrep -v '(data|tmp|web)'` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/$file ; done
364 chown opensrf:opensrf ${INSTALLDIR}/var/data ${INSTALLDIR}/var/web
365 for file in `ls -1 ${INSTALLDIR}/var/data | grep -v offline` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/data/$file ; done
366 for file in `ls -1 ${INSTALLDIR}/var/web | grep -v reporter` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/web/$file ; done
367fi
d4e88b8a 368chown -R opensrf:opensrf /home/opensrf
7f126d3b
JD
369SKINDIRS="${INSTALLDIR}/var/skins ${INSTALLDIR}/var/web/css/skin"
370for SKINDIR in ${SKINDIRS} ; do
371 if [[ ! -d "${SKINDIR}" ]] ; then mkdir ${SKINDIR} ; fi
372 chmod 777 ${SKINDIR}
bd4a0e27 373 chown -R ${DEFAULT_USER}:${DEFAULT_USER} ${SKINDIR}
7f126d3b 374done
bd4a0e27 375chown -R ${DEFAULT_USER}:${DEFAULT_USER} ${INSTALLDIR}/conf/kpac ${INSTALLDIR}/var/web/images/kpac
0155bbac 376
d4e88b8a 377# 10. staff client stuff
ae9cb412 378apt-get install -y nsis unzip
089f11fb
JD
379
380# 11. integrity checker prereqs
ae9cb412 381apt-get install -y libconfig-simple-perl libgit-repository-perl libdate-manip-perl
ee1de43f
JD
382
383# 12. paper overdue prereqs
2151da0e 384apt-get install -y python3-reportlab python3-reportlab-accel python-is-python3 unifont
6298f1c5 385
a4d987d6 386echo 'Evergreen is installed!'
6298f1c5 387