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