Commit | Line | Data |
---|---|---|
0155bbac JD |
1 | #!/bin/bash |
2 | # IMPORTANT! This script assumes you have already installed OpenSRF. | |
3 | ||
4 | HOSTNAME="nonprod" | |
5 | DEFAULT_USER="sitkastaff" | |
6 | HOMEDIR="/home/${DEFAULT_USER}" | |
7 | BUILDDIR="${HOMEDIR}/evergreen" | |
8 | INSTALLDIR="/srv/openils" | |
9 | BRANCH="production/sitka_2_2" | |
10 | VERSION="2.2.0.sitka.1" | |
11 | STAMP_ID="2_2_0_sitka_1" | |
12 | ALT_STAMP_IDS="rel_2_2_0_sitka_1 2_2_0_sitka_0 rel_2_2_0_sitka_0 rel_2_2" | |
13 | SITKACONF="${HOMEDIR}/sysadmin" | |
14 | DEPLOYDIR="/home/opensrf/deploy" | |
15 | OPACSKIN="${DEPLOYDIR}/opacskin" | |
16 | OILSPOLICY="${DEPLOYDIR}/oilspolicy" | |
17 | ||
18 | # as DEFAULT_USER | |
19 | ||
20 | # grab Sitka config files | |
21 | if [ ! -d "${SITKACONF}" ] | |
22 | then | |
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} | |
25 | fi | |
26 | su -l -c "cd ${SITKACONF} && git pull" ${DEFAULT_USER} | |
27 | ||
28 | # checkout EG source | |
29 | if [ ! -d "${BUILDDIR}" ] | |
30 | then | |
31 | su -l -c "cd ${HOMEDIR} && git clone git://git.sitka.bclibraries.ca/sitka/evergreen evergreen" ${DEFAULT_USER} | |
32 | fi | |
33 | su -l -c "cd ${BUILDDIR} && git checkout ${BRANCH}" ${DEFAULT_USER} | |
34 | ||
35 | # as root | |
36 | cd ${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 | |
40 | su -l -c "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER} | |
41 | su -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} | |
42 | su -l -c "cd ${BUILDDIR} && make" ${DEFAULT_USER} | |
43 | su -l -c "cd ${BUILDDIR}/build/i18n && make install_all_locales" ${DEFAULT_USER} | |
44 | ||
45 | # as root | |
46 | cd ${BUILDDIR} && make STAFF_CLIENT_STAMP_ID=${STAMP_ID} STAFF_CLIENT_VERSION=${VERSION} install | |
47 | chown -R opensrf:opensrf ${INSTALLDIR} | |
48 | ||
49 | # Apache stuff (as root): | |
50 | APACHEFILES="/etc/apache2/eg_vhost.conf /etc/apache2/startup.pl /etc/apache2/sites-available/eg.conf" | |
51 | for APACHEFILE in ${APACHEFILES} | |
52 | do | |
53 | cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE} | |
54 | done | |
55 | a2dissite default | |
56 | a2ensite eg.conf | |
57 | mkdir /etc/apache2/ssl | |
58 | cd /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! | |
66 | OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml" | |
67 | for OSRFCONFFILE in ${OSRFCONFFILES} | |
68 | do | |
69 | cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE} | |
70 | done | |
71 | cp ${SITKACONF}/files/home/opensrf/.srfsh.xml/${HOSTNAME} ${HOMEDIR}/.srfsh.xml | |
72 | ||
73 | # 1. install dojo | |
74 | cd /home/opensrf && wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz | |
75 | tar -C ${INSTALLDIR}/var/web/js -xzf /home/opensrf/dojo-release-1.3.3.tar.gz | |
76 | cp -r ${INSTALLDIR}/var/web/js/dojo-release-1.3.3/* ${INSTALLDIR}/var/web/js/dojo/. | |
77 | ||
78 | # 2. set up staff client | |
79 | cd ${INSTALLDIR}/var/web/xul && ln -s ${STAMP_ID} current && ln -s current/server server | |
80 | for ALT_STAMP_ID in ${ALT_STAMP_IDS} | |
81 | do | |
82 | cd ${INSTALLDIR}/var/web/xul && ln -s current ${ALT_STAMP_ID} | |
83 | done | |
84 | ||
85 | # 3. install circ scripts and opac skins | |
86 | ||
87 | # (a) setup deploy directory | |
88 | if [ ! -d "${DEPLOYDIR}" ] | |
89 | then | |
90 | mkdir ${DEPLOYDIR} | |
91 | fi | |
92 | ||
93 | # (b) bclibraries skin | |
94 | if [ ! -d "${OPACSKIN}" ] | |
95 | then | |
96 | cd ${DEPLOYDIR} && git clone git://git.sitka.bclibraries.ca/sitka/opacskin.git | |
97 | fi | |
d64cdadb | 98 | cd ${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 | |
104 | if [ ! -d "${OILSPOLICY}" ] | |
105 | then | |
106 | cd ${DEPLOYDIR} && git clone git://git.sitka.bclibraries.ca/sitka/oilspolicy.git | |
107 | fi | |
108 | cd ${OILSPOLICY} && git pull && rsync -a --exclude=.git ${OILSPOLICY} ${INSTALLDIR}/var | |
109 | ||
110 | # 4. avoid 404s | |
111 | touch ${INSTALLDIR}/var/web/css/skin/default/register_custom.css | |
112 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/patron_custom.properties | |
113 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/common_custom.properties | |
114 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/offline_custom.properties | |
115 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/auth_custom.properties | |
116 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/cat_custom.properties | |
117 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-CA/circ_custom.properties | |
118 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/patron_custom.properties | |
119 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/common_custom.properties | |
120 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/offline_custom.properties | |
121 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/auth_custom.properties | |
122 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/cat_custom.properties | |
123 | touch ${INSTALLDIR}/var/web/xul/server/locale/en-US/circ_custom.properties | |
124 | touch ${INSTALLDIR}/var/web/xul/server/skin/custom.js | |
125 | ||
126 | # 5. locale hack | |
127 | cd ${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) | |
131 | cd ${INSTALLDIR}/var/web && git clone https://github.com/twirlip/deletepatron.git | |
132 | cd ${INSTALLDIR}/var/web/deletepatron && git checkout eg22 && find . -name *.pm | xargs sed -i -e 's|/openils|/srv/openils|g' | |
133 | ||
134 | # 7. support scripts | |
135 | cp ${BUILDDIR}/Open-ILS/src/support-scripts/generate_circ_notices.pl ${INSTALLDIR}/bin | |
136 | cp ${BUILDDIR}/Open-ILS/src/support-scripts/oils_header.pl ${INSTALLDIR}/bin | |
137 | ||
138 | # 8. make sure opensrf owns all the stuff we just did | |
139 | chown -R opensrf:opensrf ${INSTALLDIR} | |
140 |