update install-eg.sh to install EG 2.6 beta1 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
6f940e4f 4HOSTNAME="nonprod-26"
0155bbac
JD
5DEFAULT_USER="sitkastaff"
6HOMEDIR="/home/${DEFAULT_USER}"
6f940e4f
JD
7EGRELEASE="Evergreen-ILS-2.6-beta1"
8#BUILDDIR="${HOMEDIR}/evergreen"
9BUILDDIR="${HOMEDIR}/${EGRELEASE}"
0155bbac 10INSTALLDIR="/srv/openils"
6f940e4f
JD
11#BRANCH="production/sitka_2_4"
12#VERSION="2.4.0.sitka.0"
13#STAMP_ID="2_4_0_sitka_0"
14STAMP_ID="rel_2_6_beta1"
15#ALT_STAMP_IDS="rel_2_4_0_sitka_0 rel_2_4_0_sitka_0"
0155bbac 16SITKACONF="${HOMEDIR}/sysadmin"
0155bbac 17
e724d7db
JD
18suwrap() {
19 su -s /bin/bash -l -c "source ~/.bashrc ; $1" $2
20}
21
0155bbac
JD
22# as DEFAULT_USER
23
24# grab Sitka config files
25if [ ! -d "${SITKACONF}" ]
26then
27 # this will fail unless DEFAULT_USER has read access to the repo
e724d7db 28 suwrap "cd ${HOMEDIR} && git clone git+ssh://git@git.sitka.bclibraries.ca/sitka-infra/sysadmin" ${DEFAULT_USER}
0155bbac 29fi
e724d7db 30suwrap "cd ${SITKACONF} && git pull" ${DEFAULT_USER}
0155bbac
JD
31
32# checkout EG source
33if [ ! -d "${BUILDDIR}" ]
34then
6f940e4f 35 suwrap "cd ${HOMEDIR} && wget http://evergreen-ils.org/downloads/previews/${EGRELEASE}.tar.gz && tar xzf ${EGRELEASE}.tar.gz" ${DEFAULT_USER}
0155bbac 36fi
0155bbac
JD
37
38# as root
39cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-precise
40# by default, CPAN needs some manual input at this point; you can just accept all defaults
41
42# as DEFAULT_USER
e724d7db
JD
43suwrap "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER}
44suwrap "cd ${BUILDDIR} && ./configure -C --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf --with-opensrf-headers=${INSTALLDIR}/include/ --with-opensrf-libs=${INSTALLDIR}/lib/ --with-dbi=/usr/lib/dbd/" ${DEFAULT_USER}
45suwrap "cd ${BUILDDIR} && make" ${DEFAULT_USER}
691245a2 46suwrap "cd ${BUILDDIR}/build/i18n && make LOCALE=fr-CA install && make LOCALE=en-CA install" ${DEFAULT_USER}
0155bbac
JD
47
48# as root
6f940e4f 49cd ${BUILDDIR} && make STAFF_CLIENT_STAMP_ID=${STAMP_ID} install
0155bbac
JD
50chown -R opensrf:opensrf ${INSTALLDIR}
51
52# Apache stuff (as root):
9d46f12d 53APACHEFILES="/etc/apache2/eg_vhost.conf /etc/apache2/eg_startup /etc/apache2/sites-available/eg.conf"
0155bbac
JD
54for APACHEFILE in ${APACHEFILES}
55do
56 cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
57done
58a2dissite default
9d46f12d 59a2ensite eg.conf
51a4755a
JD
60if [ ! -d "/etc/apache2/ssl" ]
61then
62 mkdir /etc/apache2/ssl
63 cd /etc/apache2/ssl && openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
64fi
7d30f3bf 65
26b3ea66
JD
66# set up log rotation
67if [ ! -d "/etc/logrotate.d/evergreen" ]
68then
69 cp ${SITKACONF}/files/etc/logrotate.d/evergreen/${HOSTNAME} /etc/logrotate.d/evergreen
70fi
0155bbac 71
0155bbac
JD
72# 0. osrf conf stuff
73# FIXME: ensure osrf conf files point at a real, distinct db!
74OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
75for OSRFCONFFILE in ${OSRFCONFFILES}
76do
51a4755a 77 mv ${OSRFCONFFILE} ${OSRFCONFFILE}.bak
0155bbac
JD
78 cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}
79done
9d46f12d
JD
80if [ ! -d "${HOMEDIR}/.srfsh.xml" ]
81then
82 cp ${SITKACONF}/files/home/opensrf/.srfsh.xml/${HOSTNAME} ${HOMEDIR}/.srfsh.xml
83fi
84
0155bbac 85# 1. install dojo
51a4755a
JD
86if [ ! -d "/home/opensrf/dojo-release-1.3.3.tar.gz" ]
87then
88 cd /home/opensrf && wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
89fi
0155bbac
JD
90tar -C ${INSTALLDIR}/var/web/js -xzf /home/opensrf/dojo-release-1.3.3.tar.gz
91cp -r ${INSTALLDIR}/var/web/js/dojo-release-1.3.3/* ${INSTALLDIR}/var/web/js/dojo/.
92
93# 2. set up staff client
9d46f12d 94cd ${INSTALLDIR}/var/web/xul && rm server && rm current
0155bbac 95cd ${INSTALLDIR}/var/web/xul && ln -s ${STAMP_ID} current && ln -s current/server server
6f940e4f
JD
96#for ALT_STAMP_ID in ${ALT_STAMP_IDS}
97#do
98# cd ${INSTALLDIR}/var/web/xul && ln -s current ${ALT_STAMP_ID}
99#done
0155bbac 100
9d46f12d 101# 3. install circ scripts and opac skins - DEPRECATED
0155bbac
JD
102
103# 4. avoid 404s
104touch ${INSTALLDIR}/var/web/css/skin/default/register_custom.css
105touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/patron_custom.properties
106touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/common_custom.properties
107touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/offline_custom.properties
108touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/auth_custom.properties
109touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/cat_custom.properties
110touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/circ_custom.properties
111touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/patron_custom.properties
112touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/common_custom.properties
113touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/offline_custom.properties
114touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/auth_custom.properties
115touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/cat_custom.properties
116touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/circ_custom.properties
117touch ${INSTALLDIR}/var/web/xul/server/skin/custom.js
118
119# 5. locale hack
120cd ${INSTALLDIR}/var/web/opac/locale && cp -fdr en-US en-US-bak && cp -fdr en-CA en-US
121
122# 6. deletepatron
123# ensure apache conf contains deletepatron config (location should be ${INSTALLDIR}/var/web/deletepatron)
124cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
6f81dddf 125cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22 && find . -name "*.pm" | xargs sed -i -e 's|/openils|/srv/openils|g'
6113c87e 126apt-get install libcgi-session-perl libhtml-template-perl
0155bbac
JD
127
128# 7. support scripts
129cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
130cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
131
c05e3516
JD
132# 8. setup start page
133if [ ! -d "${INSTALLDIR}/var/web/news" ]
134then
135 mkdir ${INSTALLDIR}/var/web/news
136fi
137NEWSFILES="index.html style.css"
138for NEWSFILE in ${NEWSFILES}
139do
140 if [ -f "${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME}" ]
141 then
142 cp ${SITKACONF}/files/${INSTALLDIR}/var/web/news/${NEWSFILE}/${HOSTNAME} ${INSTALLDIR}/var/web/news/${NEWSFILE}
143 fi
144done
145
146# 9. make sure opensrf owns all the stuff we just did
0155bbac 147chown -R opensrf:opensrf ${INSTALLDIR}
d4e88b8a
JD
148chown -R opensrf:opensrf /home/opensrf
149chown -R opensrf:opensrf /var/lock/apache2
0155bbac 150
d4e88b8a
JD
151# 10. staff client stuff
152apt-get install nsis unzip
089f11fb
JD
153
154# 11. integrity checker prereqs
155apt-get install libconfig-simple-perl libgit-repository-perl libdate-manip-perl