deployment: require manually-supplied ejabberd passwords in install-osrf.sh
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 26 Sep 2012 00:22:47 +0000 (17:22 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 26 Sep 2012 00:22:47 +0000 (17:22 -0700)
deployment/install-osrf.sh

index 38d9ca3..818e50e 100755 (executable)
@@ -5,6 +5,13 @@ DEFAULT_USER="sitkastaff"
 HOMEDIR="/home/${DEFAULT_USER}"
 SITKACONF="${HOMEDIR}/sysadmin"
 
+# test for ejabberd passwords
+if [ -z "$PRIVATE_ROUTER_PASSWD" -o -z "$PRIVATE_OPENSRF_PASSWD" -o -z "$PUBLIC_ROUTER_PASSWD" -o -z "$PUBLIC_OPENSRF_PASSWD" ]
+then
+  echo "Missing ejabberd password(s), no OpenSRF install!"
+  exit
+fi
+
 # as root
 usermod -a -G sudo ${DEFAULT_USER}
 apt-get install git-core build-essential translate-toolkit python-polib bsdmainutils
@@ -53,9 +60,9 @@ mv /etc/ejabberd/ejabberd.cfg /etc/ejabberd/ejabberd.cfg.orig && cp ${SITKACONF}
 chgrp ejabberd /etc/ejabberd/ejabberd.cfg
 chmod 640 /etc/ejabberd/ejabberd.cfg
 /etc/init.d/ejabberd restart
-ejabberdctl register router private.localhost passwd
-ejabberdctl register opensrf private.localhost passwd
-ejabberdctl register router public.localhost passwd
-ejabberdctl register opensrf public.localhost passwd
+ejabberdctl register router private.localhost $PRIVATE_ROUTER_PASSWD
+ejabberdctl register opensrf private.localhost $PRIVATE_OPENSRF_PASSWD
+ejabberdctl register router public.localhost $PUBLIC_ROUTER_PASSWD
+ejabberdctl register opensrf public.localhost $PUBLIC_OPENSRF_PASSWD
 
 echo "OpenSRF is installed!"