deployment: fix to deploy bclibraries skin correctly
[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
4HOSTNAME="nonprod"
5DEFAULT_USER="sitkastaff"
6HOMEDIR="/home/${DEFAULT_USER}"
7BUILDDIR="${HOMEDIR}/evergreen"
8INSTALLDIR="/srv/openils"
9BRANCH="production/sitka_2_2"
10VERSION="2.2.0.sitka.1"
11STAMP_ID="2_2_0_sitka_1"
12ALT_STAMP_IDS="rel_2_2_0_sitka_1 2_2_0_sitka_0 rel_2_2_0_sitka_0 rel_2_2"
13SITKACONF="${HOMEDIR}/sysadmin"
14DEPLOYDIR="/home/opensrf/deploy"
15OPACSKIN="${DEPLOYDIR}/opacskin"
16OILSPOLICY="${DEPLOYDIR}/oilspolicy"
17
18# as DEFAULT_USER
19
20# grab Sitka config files
21if [ ! -d "${SITKACONF}" ]
22then
23 # this will fail unless DEFAULT_USER has read access to the repo
24 su -l -c "cd ${HOMEDIR} && git clone git+ssh://git@git.sitka.bclibraries.ca/sitka-infra/sysadmin" ${DEFAULT_USER}
25fi
26su -l -c "cd ${SITKACONF} && git pull" ${DEFAULT_USER}
27
28# checkout EG source
29if [ ! -d "${BUILDDIR}" ]
30then
31 su -l -c "cd ${HOMEDIR} && git clone git://git.sitka.bclibraries.ca/sitka/evergreen evergreen" ${DEFAULT_USER}
32fi
33su -l -c "cd ${BUILDDIR} && git checkout ${BRANCH}" ${DEFAULT_USER}
34
35# as root
36cd ${BUILDDIR} && make -f Open-ILS/src/extras/Makefile.install ubuntu-precise
37# by default, CPAN needs some manual input at this point; you can just accept all defaults
38
39# as DEFAULT_USER
40su -l -c "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER}
41su -l -c "cd ${BUILDDIR} && ./configure -C --prefix='${INSTALLDIR}' --sysconfdir='\${prefix}/conf' --with-opensrf-headers=${INSTALLDIR}/include/ --with-opensrf-libs=${INSTALLDIR}/lib/ --with-dbi=/usr/lib/dbd/" ${DEFAULT_USER}
42su -l -c "cd ${BUILDDIR} && make" ${DEFAULT_USER}
43su -l -c "cd ${BUILDDIR}/build/i18n && make install_all_locales" ${DEFAULT_USER}
44
45# as root
46cd ${BUILDDIR} && make STAFF_CLIENT_STAMP_ID=${STAMP_ID} STAFF_CLIENT_VERSION=${VERSION} install
47chown -R opensrf:opensrf ${INSTALLDIR}
48
49# Apache stuff (as root):
50APACHEFILES="/etc/apache2/eg_vhost.conf /etc/apache2/startup.pl /etc/apache2/sites-available/eg.conf"
51for APACHEFILE in ${APACHEFILES}
52do
53 cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
54done
55a2dissite default
56a2ensite eg.conf
57mkdir /etc/apache2/ssl
58cd /etc/apache2/ssl && openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
59
60# TODO: set up log rotation
61
62# as opensrf
63
64# 0. osrf conf stuff
65# FIXME: ensure osrf conf files point at a real, distinct db!
66OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
67for OSRFCONFFILE in ${OSRFCONFFILES}
68do
69 cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}
70done
71cp ${SITKACONF}/files/home/opensrf/.srfsh.xml/${HOSTNAME} ${HOMEDIR}/.srfsh.xml
72
73# 1. install dojo
74cd /home/opensrf && wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
75tar -C ${INSTALLDIR}/var/web/js -xzf /home/opensrf/dojo-release-1.3.3.tar.gz
76cp -r ${INSTALLDIR}/var/web/js/dojo-release-1.3.3/* ${INSTALLDIR}/var/web/js/dojo/.
77
78# 2. set up staff client
79cd ${INSTALLDIR}/var/web/xul && ln -s ${STAMP_ID} current && ln -s current/server server
80for ALT_STAMP_ID in ${ALT_STAMP_IDS}
81do
82 cd ${INSTALLDIR}/var/web/xul && ln -s current ${ALT_STAMP_ID}
83done
84
85# 3. install circ scripts and opac skins
86
87# (a) setup deploy directory
88if [ ! -d "${DEPLOYDIR}" ]
89then
90 mkdir ${DEPLOYDIR}
91fi
92
93# (b) bclibraries skin
94if [ ! -d "${OPACSKIN}" ]
95then
96 cd ${DEPLOYDIR} && git clone git://git.sitka.bclibraries.ca/sitka/opacskin.git
97fi
d64cdadb 98cd ${OPACSKIN} && git checkout -b bclibraries && \
0155bbac 99 cd ${INSTALLDIR}/var/web/opac/skin && mv default orig-default && \
d64cdadb 100 rsync -a --exclude=.git ${OPACSKIN} ${INSTALLDIR}/var/web/opac/skin/bclibraries && \
0155bbac
JD
101 ln -s ${INSTALLDIR}/var/web/opac/skin/bclibraries ${INSTALLDIR}/var/web/opac/skin/default
102
103# (b) circ scripts
104if [ ! -d "${OILSPOLICY}" ]
105then
106 cd ${DEPLOYDIR} && git clone git://git.sitka.bclibraries.ca/sitka/oilspolicy.git
107fi
108cd ${OILSPOLICY} && git pull && rsync -a --exclude=.git ${OILSPOLICY} ${INSTALLDIR}/var
109
110# 4. avoid 404s
111touch ${INSTALLDIR}/var/web/css/skin/default/register_custom.css
112touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/patron_custom.properties
113touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/common_custom.properties
114touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/offline_custom.properties
115touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/auth_custom.properties
116touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/cat_custom.properties
117touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/circ_custom.properties
118touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/patron_custom.properties
119touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/common_custom.properties
120touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/offline_custom.properties
121touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/auth_custom.properties
122touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/cat_custom.properties
123touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/circ_custom.properties
124touch ${INSTALLDIR}/var/web/xul/server/skin/custom.js
125
126# 5. locale hack
127cd ${INSTALLDIR}/var/web/opac/locale && cp -fdr en-US en-US-bak && cp -fdr en-CA en-US
128
129# 6. deletepatron
130# ensure apache conf contains deletepatron config (location should be ${INSTALLDIR}/var/web/deletepatron)
131cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git
132cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22 && find . -name *.pm | xargs sed -i -e 's|/openils|/srv/openils|g'
133
134# 7. support scripts
135cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin
136cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin
137
138# 8. make sure opensrf owns all the stuff we just did
139chown -R opensrf:opensrf ${INSTALLDIR}
140