install-eg.sh: fix typo in NFS setup
[sitka/sitka-tools.git] / deployment / install-eg.sh
1 #!/bin/bash
2 # IMPORTANT! This script assumes you have already installed OpenSRF.
3
4 HOSTNAME="nonprod"
5 DEFAULT_USER="opensrf"
6 INSTALL_USER="opensrf"
7 BUILDDIR="/home/${INSTALL_USER}/evergreen"
8 INSTALLDIR="/srv/openils"
9 REPO="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"
12 BRANCH="origin/user/jeffdavis/eg37-beta-tpac"
13 STAMP_ID="rel_3_7_beta"
14 VERSION="3.7.beta.sitka.1"
15 SITKACONF="/home/${DEFAULT_USER}/sysadmin"
16 SITKACONF_BRANCH="ubuntu-focal"
17 SITKATOOLS="/root/sitka-tools"
18
19 THISHOST=`hostname -s`
20
21 suwrap() {
22   su -s /bin/bash -c "source ~/.bashrc ; $1" $2
23 }
24
25 while getopts ":pecnWbrtuD" opt ; do
26   case $opt in
27     p ) PROD="prod";;
28     e ) EDI="edi";;
29     c ) CRONTAB="crontab";;
30     n ) NFS="nfs";;
31     W ) SKIPWEBCLIENT="skipwebclient";;
32     b ) USEBUILDSERVER="usebuildserver";;
33     r ) RUNTESTS="runtests";;
34     t ) TARBALL="tarball";;
35     u ) UPDATEONLY="updateonly";;
36     D ) CLEANINSTALL="cleaninstall";;
37   esac
38 done
39 shift $(($OPTIND - 1))
40
41 if [[ -n "$PROD" ]] ; then
42   echo 'this is a production install'
43   [ "$HOSTNAME" == "nonprod" ] && HOSTNAME="prod"
44 else
45   echo 'this is NOT a production install'
46 fi
47
48 # as DEFAULT_USER
49
50 # grab Sitka config files
51 if [ ! -d "${SITKACONF}" ]
52 then
53   # this will fail unless DEFAULT_USER has read access to the repo
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; }
55 fi
56 suwrap "cd ${SITKACONF} && git fetch origin && git checkout ${SITKACONF_BRANCH} && git pull" ${DEFAULT_USER} || { echo "Could not checkout ${SITKACONF_BRANCH} config files; exiting." ; exit 1; }
57
58 if [[ -n "$TARBALL" ]] ; then
59   EGRELEASE="Evergreen-ILS-${VERSION}"
60   EGRELEASETGZ="${EGRELEASE}.tar.gz"
61   [ ${VERSION} == "3.1.0" ] && EGRELEASETGZ="Evergreen-ILS-3.1.0a.tar.gz"
62   BUILDDIR="/home/${INSTALL_USER}/${EGRELEASE}"
63   BRANCH="$VERSION"
64   echo "installing packaged upstream release ${EGRELEASE}"
65   # download and unpack EG release
66   rm -rf ${BUILDDIR}
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; }
69   fi
70   suwrap "cd /home/${INSTALL_USER} && tar xzf ${EGRELEASETGZ}" ${INSTALL_USER}
71 else
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
77   # checkout EG source
78   if [ ! -d "${BUILDDIR}" ]
79   then
80     suwrap "cd /home/${INSTALL_USER} && git clone ${REPO} evergreen" ${INSTALL_USER}
81   fi
82   suwrap "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${INSTALL_USER}
83 fi
84
85 # as root
86 cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-focal
87 if [[ ! -n "$TARBALL" && ! -n "$USEBUILDSERVER" ]] ; then
88   cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-focal-translator # required for web client and custom translations
89 fi
90 # by default, CPAN needs some manual input at this point; you can just accept all defaults
91  
92 # web client
93 if [[ ! -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
106 fi
107
108 # install Bootstrap OPAC dependencies
109 cd ${BUILDDIR}/Open-ILS/web/opac/deps
110 suwrap "npm install" {$INSTALL_USER}
111
112 # as INSTALL_USER
113 [ ! -n "$TARBALL" ] && suwrap "cd ${BUILDDIR} && autoreconf -i" ${INSTALL_USER} # not required for release versions
114 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/" ${INSTALL_USER}
115 suwrap "cd ${BUILDDIR} && make" ${INSTALL_USER}
116 [ ! -n "$TARBALL" ] && suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en-CA install" ${INSTALL_USER}
117  
118 # as root
119 rm -rf ${INSTALLDIR}/var/web/eg2/en-US
120 cd ${BUILDDIR} && make install
121 ldconfig
122 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/
123  
124 # setup start page
125 if [ ! -d "${INSTALLDIR}/var/web/news" ]
126 then
127   mkdir ${INSTALLDIR}/var/web/news
128 fi
129 if [ ! -d "${INSTALLDIR}/var/web/news/media" ]
130 then
131   mkdir ${INSTALLDIR}/var/web/news/media
132 fi
133 NEWSFILES="index.html style.css media/logo.png media/book.png media/policy.png media/dash.png media/delete.png"
134 for NEWSFILE in ${NEWSFILES}
135 do
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
140 done
141 if [[ -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
144 else
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
151 fi
152
153 # setup/update test server banner
154 if [[ ! -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
162 fi
163
164 # if we are just updating an existing EG install, we're all done!
165 if [[ -n "$UPDATEONLY" ]] ; then
166     exit 0
167 fi
168
169 if [[ ! -n "$SKIPWEBCLIENT" ]] ; then
170     apt-get install -y nginx
171 fi
172
173 # NFS support
174 if [[ -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
178     if [ ! -d "${INSTALLDIR}/var/data/offline" ] ; then suwrap "mkdir ${INSTALLDIR}/var/data/offline" {$INSTALL_USER} ; fi
179     # TODO: add fstab entries and mount NFS shares - still doing this manually for now
180     #cp ${SITKACONF}/files/etc/fstab/${HOSTNAME} /etc/fstab
181 fi
182
183 # Apache stuff (as root):
184 APACHEFILES="/etc/apache2/mods-available/mpm_prefork.conf"
185 for APACHEFILE in ${APACHEFILES}
186 do
187   [[ -e "${APACHEFILE}" ]] && mv ${APACHEFILE} ${APACHEFILE}.`date +%Y-%m-%d-%H%M%S`
188   cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
189 done
190 cp ${BUILDDIR}/Open-ILS/examples/apache_24/eg_startup /etc/apache2/eg_startup
191 sed -i 's/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=opensrf/' /etc/apache2/envvars
192 if [ ! -d "/etc/apache2/includes" ] ; then
193   mkdir /etc/apache2/includes
194 fi
195 a2dismod mpm_event
196 a2enmod mpm_prefork
197 a2enmod headers
198 a2enmod remoteip
199 # ensure opensrf can run Apache
200 chown -R opensrf:opensrf /var/lock/apache2
201
202 # More Apache stuff for non-production sites
203 if [[ ! -n "$PROD" ]] ; then
204   a2dissite 000-default
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
212 fi
213
214 # websockets config
215 if [[ ! -n "$SKIPWEBCLIENT" ]] ; then
216     cp -b {$SITKACONF}/files/etc/nginx/nginx.conf/{$HOSTNAME} /etc/nginx/nginx.conf
217     cp -b ${SITKACONF}/files/etc/nginx/sites-available/osrf-ws-http-proxy/${HOSTNAME} /etc/nginx/sites-available/osrf-ws-http-proxy
218     #ln -s /etc/nginx/sites-available/osrf-ws-http-proxy /etc/nginx/sites-enabled/osrf-ws-http-proxy
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
226 fi
227
228 # install default crontab, if specified
229 if [[ -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
233 fi
234
235 # LDAP config
236 apt-get install -y ldap-utils
237 if ! `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
239 fi
240
241 # set up log rotation
242 if [[ ! -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
247 fi
248
249 # remote logging (prod only)
250 if [[ -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
258 fi
259
260 # action trigger filters (prod only)
261 if [[ -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
266 fi
267  
268 # 0. osrf conf stuff 
269 # FIXME: ensure osrf conf files point at a real, distinct db!
270 OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
271 for OSRFCONFFILE in ${OSRFCONFFILES}
272 do
273   mv ${OSRFCONFFILE} ${OSRFCONFFILE}.`date +%Y-%m-%d-%H%M%S`
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
279   sed -i "s|__HOSTNAME__|${THISHOST}|g" ${OSRFCONFFILE}
280 done
281 if [ ! -f "/home/opensrf/.srfsh.xml" ]
282 then
283   cp ${SITKACONF}/files/home/opensrf/.srfsh.xml/${HOSTNAME} /home/opensrf/.srfsh.xml
284   sed -i "s|__HOSTNAME__|${THISHOST}|g" /home/opensrf/.srfsh.xml
285 fi 
286
287 # 1. install dojo
288 if [ ! -f "/home/opensrf/dojo-release-1.3.3.tar.gz" ]
289 then
290   cd /home/opensrf && wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
291 fi
292 tar -C ${INSTALLDIR}/var/web/js -xzf /home/opensrf/dojo-release-1.3.3.tar.gz
293 cp -r ${INSTALLDIR}/var/web/js/dojo-release-1.3.3/* ${INSTALLDIR}/var/web/js/dojo/.
294 # FIXME stock dojo is probably superfluous when we use the following Evergreen-specific tarball...
295 if [ ! -f "/home/opensrf/dojo.tgz" ] ; then
296   cd /home/opensrf && wget http://evergreen-ils.org/downloads/dojo.tgz
297 fi
298 tar -C ${INSTALLDIR}/var/web/js/dojo/ -zxf /home/opensrf/dojo.tgz
299  
300 # 2. set up XUL client - DEPRECATED
301  
302 # 3. install circ scripts and opac skins - DEPRECATED
303
304 # 4a. avoid 404s
305 touch ${INSTALLDIR}/var/web/css/skin/default/register_custom.css
306
307 # 4b. workaround for LP#1461683 - DEPRECATED
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
311  
312 # 6. deletepatron
313 # ensure apache conf contains deletepatron config (location should be ${INSTALLDIR}/var/web/deletepatron)
314 if [[ ! -d "${INSTALLDIR}/var/web/deletepatron" ]] ; then
315   NEW_DELETEPATRON_INSTALL="true"
316   cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
317 fi
318 cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22
319 if [[ -n "$NEW_DELETEPATRON_INSTALL" ]] ; then
320   find ${INSTALLDIR}/var/web/deletepatron -name "*.pm" | xargs sed -i -e "s|/openils|${INSTALLDIR}|g"
321 fi
322 apt-get install -y libcgi-session-perl libhtml-template-perl
323
324 # 7. support scripts
325 cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
326 cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
327 cp ${BUILDDIR}/Open-ILS/src/support-scripts/badge_score_generator.pl ${INSTALLDIR}/bin
328
329 # 7.5 EDI (optional)
330 if [[ -n "$EDI" ]] ; then
331   cp -r ${BUILDDIR}/Open-ILS/src/edi_translator ${INSTALLDIR}/var/edi
332   cd ${INSTALLDIR}/var/edi && ./install-ubuntu.sh
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
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
339 fi
340
341 # 8.5 offline patron list
342 if [ ! -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
347 fi
348 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
349 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
350
351 cp ${SITKACONF}/files${INSTALLDIR}/var/data/zips.txt/${HOSTNAME} ${INSTALLDIR}/var/data/zips.txt
352
353 cp -b --suffix=.`date +%Y-%m-%d-%H%M%S` ${SITKACONF}/files${INSTALLDIR}/var/web/robots.txt/${HOSTNAME} ${INSTALLDIR}/var/web/robots.txt
354
355 # 9. make sure opensrf owns all the stuff we just did
356 echo 'managing file permissions...'
357 if [[ ! -n "$PROD" ]] ; then
358   mkdir ${INSTALLDIR}/var/tmp # this would be an NFS share on prod, but it's just a normal directory for non-prod
359   chown -R opensrf:opensrf ${INSTALLDIR} 2>/dev/null
360 else
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
367 fi
368 chown -R opensrf:opensrf /home/opensrf
369 SKINDIRS="${INSTALLDIR}/var/skins ${INSTALLDIR}/var/web/css/skin"
370 for SKINDIR in ${SKINDIRS} ; do
371   if [[ ! -d "${SKINDIR}" ]] ; then mkdir ${SKINDIR} ; fi
372   chmod 777 ${SKINDIR}
373   chown -R ${DEFAULT_USER}:${DEFAULT_USER} ${SKINDIR}
374 done
375 chown -R ${DEFAULT_USER}:${DEFAULT_USER} ${INSTALLDIR}/conf/kpac ${INSTALLDIR}/var/web/images/kpac
376
377 # 10. staff client stuff
378 apt-get install -y nsis unzip
379
380 # 11. integrity checker prereqs
381 apt-get install -y libconfig-simple-perl libgit-repository-perl libdate-manip-perl
382
383 # 12. paper overdue prereqs
384 apt-get install -y python3-reportlab python3-reportlab-accel python-is-python3 unifont
385
386 echo 'Evergreen is installed!'
387