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