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