install-osrf.sh: optionally skip ejabberd registration
authortwirlip <twirlip@twirlip.org>
Tue, 16 May 2017 21:50:55 +0000 (14:50 -0700)
committertwirlip <twirlip@twirlip.org>
Tue, 16 May 2017 21:50:55 +0000 (14:50 -0700)
deployment/install-osrf.sh

index d548bdb..89261c5 100755 (executable)
@@ -10,21 +10,24 @@ SITKACONF_BRANCH="master"
 
 THISHOST=`hostname -s`
 
-# 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
-
-while getopts ":pw" opt ; do
+while getopts ":pwj" opt ; do
   case $opt in
     p ) PROD="prod";;
     w ) WEBSOCKETS="websockets";;
+    j ) SKIP_EJABBERD_REG="skip_ejabberd_reg";;
   esac
 done
 shift $(($OPTIND - 1))
 
+# 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
+  if [[ ! -n "$SKIP_EJABBERD_REG" ]] ; then
+    echo "Missing ejabberd password(s), no OpenSRF install!"
+    exit
+  fi
+fi
+
 # always use a proxy for websockets traffic
 if [[ -n "$WEBSOCKETS" ]] ; then
     WSPORT="--with-websockets-port=443"
@@ -109,11 +112,14 @@ cp ${SITKACONF}/files/etc/ejabberd/ejabberd.cfg/${HOSTNAME} /etc/ejabberd/ejabbe
 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/ejabberd stop && /etc/init.d/ejabberd start
+if [[ ! -n "$SKIP_EJABBERD_REG" ]] ; then
+  sleep 5
   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}
+fi
 
 echo "OpenSRF is installed!"