BUILDDIR="${HOMEDIR}/opensrf"
INSTALLDIR="/srv/openils"
BRANCH="rel_2_4"
-HOSTNAME="nonprod-28"
+HOSTNAME="nonprod"
SITKACONF="${HOMEDIR}/sysadmin"
-SITKACONF_BRANCH="eg28"
+SITKACONF_BRANCH="eg210"
# test for ejabberd passwords
if [ -z "$PRIVATE_ROUTER_PASSWD" -o -z "$PRIVATE_OPENSRF_PASSWD" -o -z "$PUBLIC_ROUTER_PASSWD" -o -z "$PUBLIC_OPENSRF_PASSWD" ]
exit
fi
+while getopts ":p" opt ; do
+ case $opt in
+ p ) PROD="prod";;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [[ -n "$PROD" ]] ; then
+ echo 'this is a production install'
+else
+ echo 'this is NOT a production install'
+fi
# as root
usermod -a -G sudo ${DEFAULT_USER}
apt-get install git-core build-essential translate-toolkit python-polib bsdmainutils
mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
fi
cp ${SITKACONF}/files/etc/apache2/apache2.conf/${HOSTNAME} /etc/apache2/apache2.conf
+sed -i "s|__HOSTNAME__|${THISHOST}|g" /etc/apache2/apache2.conf
# as root
echo "Installing OpenSRF prerequisites for Ubuntu..."
echo "Installing OpenSRF..."
cd ${BUILDDIR} && make install
useradd -m -s /bin/bash opensrf
-PATHFILES="/etc/profile /root/.bashrc /home/opensrf/.bashrc"
+PATHFILES="/etc/profile /root/.bashrc /home/${DEFAULT_USER}/.bashrc /home/opensrf/.bashrc"
for PATHFILE in ${PATHFILES} ; do
- if [[ -e "${PATHFILE}" && ! `egrep "PATH=.*${INSTALLDIR}/bin" "${PATHFILE}"` ]] ; then
+ if [[ ! -e "${PATHFILE}" || ! `egrep "PATH=.*${INSTALLDIR}/bin" "${PATHFILE}"` ]] ; then
echo "export PATH=${INSTALLDIR}/bin:\$PATH" >> ${PATHFILE}
fi
done
+chown ${DEFAULT_USER}:${DEFAULT_USER} /home/${DEFAULT_USER}/.bashrc
chown -R opensrf:opensrf ${INSTALLDIR}
# as root, add the following two lines to /etc/hosts:
#127.0.1.2 public.localhost public
#127.0.1.3 private.localhost private
-echo "Updating /etc/hosts..."
-echo -e "127.0.1.2\tpublic.localhost\tpublic\n127.0.1.3\tprivate.localhost\tprivate\n" | \
- cat - /etc/hosts > /etc/hosts.new && mv /etc/hosts.new /etc/hosts
+if [[ ! -n "$PROD" ]] ; then
+ if [[ ! `grep public.localhost /etc/hosts` ]] ; then
+ echo "Updating /etc/hosts..."
+ echo -e "127.0.1.2\tpublic.localhost\tpublic\n127.0.1.3\tprivate.localhost\tprivate\n" | \
+ cat - /etc/hosts > /etc/hosts.new && mv /etc/hosts.new /etc/hosts
+ fi
+else
+ echo 'WARNING: If this is a new production server, you will need to manually update /etc/hosts!'
+fi
# as root
echo "ldconfig stuff..."
# as root
echo "Setting up ejabberd..."
cp ${SITKACONF}/files/etc/ejabberd/ejabberd.cfg/${HOSTNAME} /etc/ejabberd/ejabberd.cfg
+sed -i "s|__HOSTNAME__|${THISHOST}|g" /etc/ejabberd/ejabberd.cfg
chgrp ejabberd /etc/ejabberd/ejabberd.cfg
chmod 640 /etc/ejabberd/ejabberd.cfg
/etc/init.d/ejabberd restart && sleep 10 && \
#/etc/init.d/apache2-websockets start
-echo "websockets is installed!"
+#echo "websockets is installed!"