$NetBSD: patch-ae,v 1.19 2018/01/03 22:51:30 fhajny Exp $ - Default locations. - Use 'su -' instead of just 'su'. Fixes priv delegation on SunOS and AIX where Erlang relies on $HOME set correctly. Use a portable su arg order while at it. - At least SunOS has not wheel group. - Portable grep calls. --- ejabberdctl.template.orig 2017-12-28 18:37:19.000000000 +0000 +++ ejabberdctl.template @@ -58,8 +58,8 @@ done # define ejabberd variables if not already defined from the command line : "${ETC_DIR:="{{sysconfdir}}/ejabberd"}" -: "${LOGS_DIR:="{{localstatedir}}/log/ejabberd"}" -: "${SPOOL_DIR:="{{localstatedir}}/lib/ejabberd"}" +: "${LOGS_DIR:=@EJABBERD_LOGDIR@}" +: "${SPOOL_DIR:=@EJABBERD_DB@}" : "${EJABBERD_CONFIG_PATH:="$ETC_DIR/ejabberd.yml"}" : "${EJABBERDCTL_CONFIG_PATH:="$ETC_DIR/ejabberdctl.cfg"}" [ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH" @@ -110,7 +110,7 @@ export ERL_LIBS exec_cmd() { case $EXEC_CMD in - as_install_user) su -s /bin/sh -c '"$0" "$@"' "$INSTALLUSER" -- "$@" ;; + as_install_user) su - "$INSTALLUSER" -c '"$@"' -- "$@" ;; as_current_user) "$@" ;; esac } @@ -209,14 +209,14 @@ uid() # stop epmd if there is no other running node stop_epmd() { - "$EPMD" -names 2>/dev/null | grep -q name || "$EPMD" -kill >/dev/null + "$EPMD" -names 2>/dev/null | grep name >/dev/null || "$EPMD" -kill >/dev/null } # make sure node not already running and node name unregistered # if all ok, ensure runtime directory exists and make it current directory check_start() { - "$EPMD" -names 2>/dev/null | grep -q " ${ERLANG_NODE%@*} " && { + "$EPMD" -names 2>/dev/null | grep " ${ERLANG_NODE%@*} " >/dev/null && { pgrep -f "$ERLANG_NODE" >/dev/null && { echo "ERROR: The ejabberd node '$ERLANG_NODE' is already running." exit 4