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