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