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