2 DEFAULT_USER="sitkastaff"
3 HOMEDIR="/home/${DEFAULT_USER}"
4 BUILDDIR="${HOMEDIR}/opensrf"
5 INSTALLDIR="/srv/openils"
8 SITKACONF="${HOMEDIR}/sysadmin"
10 # test for ejabberd passwords
11 if [ -z "$PRIVATE_ROUTER_PASSWD" -o -z "$PRIVATE_OPENSRF_PASSWD" -o -z "$PUBLIC_ROUTER_PASSWD" -o -z "$PUBLIC_OPENSRF_PASSWD" ]
13 echo "Missing ejabberd password(s), no OpenSRF install!"
18 usermod -a -G sudo ${DEFAULT_USER}
19 apt-get install git-core build-essential translate-toolkit python-polib bsdmainutils
22 if [ ! -d "${SITKACONF}" ]
24 # this will fail unless DEFAULT_USER has read access to the repo
25 su -l -c "cd ${HOMEDIR} && git clone git+ssh://git@git.sitka.bclibraries.ca/sitka-infra/sysadmin" ${DEFAULT_USER}
27 su -l -c "cd ${HOMEDIR}/sysadmin && git pull" ${DEFAULT_USER}
28 if [ ! -d "${BUILDDIR}/.git" ] ; then
29 su -l -c "cd ${HOMEDIR} && git clone git://git.evergreen-ils.org/OpenSRF.git opensrf" ${DEFAULT_USER}
31 su -l -c "cd ${BUILDDIR} && git fetch origin && git checkout ${BRANCH} && git pull" ${DEFAULT_USER}
34 echo "Installing OpenSRF prerequisites for Ubuntu..."
35 cd ${BUILDDIR} && make -f src/extras/Makefile.install ubuntu-precise
38 echo "Configuring and building OpenSRF..."
39 su -l -c "cd ${BUILDDIR} && autoreconf -i" ${DEFAULT_USER}
40 su -l -c "cd ${BUILDDIR} && ./configure --prefix=${INSTALLDIR} --sysconfdir=${INSTALLDIR}/conf" ${DEFAULT_USER}
41 su -l -c "cd ${BUILDDIR} && make" ${DEFAULT_USER}
44 echo "Installing OpenSRF..."
45 cd ${BUILDDIR} && make install
46 useradd -m -s /bin/bash opensrf
47 echo "export PATH=\$PATH:${INSTALLDIR}/bin" >> /home/opensrf/.bashrc
48 chown -R opensrf:opensrf ${INSTALLDIR}
50 # as root, add the following two lines to /etc/hosts:
51 #127.0.1.2 public.localhost public
52 #127.0.1.3 private.localhost private
53 echo "Updating /etc/hosts..."
54 echo -e "127.0.1.2\tpublic.localhost\tpublic\n127.0.1.3\tprivate.localhost\tprivate\n" | \
55 cat - /etc/hosts > /etc/hosts.new && mv /etc/hosts.new /etc/hosts
58 echo "ldconfig stuff..."
59 echo "${INSTALLDIR}/lib" > /etc/ld.so.conf.d/opensrf.conf
63 echo "Setting up ejabberd..."
64 cp ${SITKACONF}/files/etc/ejabberd/ejabberd.cfg/${HOSTNAME} /etc/ejabberd/ejabberd.cfg
65 chgrp ejabberd /etc/ejabberd/ejabberd.cfg
66 chmod 640 /etc/ejabberd/ejabberd.cfg
67 /etc/init.d/ejabberd restart && sleep 10 && \
68 ejabberdctl register router private.localhost ${PRIVATE_ROUTER_PASSWD} && \
69 ejabberdctl register opensrf private.localhost ${PRIVATE_OPENSRF_PASSWD} && \
70 ejabberdctl register router public.localhost ${PUBLIC_ROUTER_PASSWD} && \
71 ejabberdctl register opensrf public.localhost ${PUBLIC_OPENSRF_PASSWD}
73 echo "OpenSRF is installed!"