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