From 1b77abcc9cb5e4cb3d90251a2a75d4390e4ff61d Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Thu, 28 Nov 2024 10:30:30 +0100 Subject: [PATCH] ejabberdctl: support OpenBSD su OpenBSD has a different than Linux su: 1. `-c` before username is treated as login class; 2. it doesn't require `--` as arguments separator. Without (1) it complains as: su: no such login class: exec "$0" "$@" and without (2): -: --: not found Here, I've added detection of OS via `uname -s` which routes to the right `su`. I really think that other BSD may need it as well. --- ejabberdctl.template | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ejabberdctl.template b/ejabberdctl.template index 21be6430f..a5b6e704b 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -125,9 +125,16 @@ set_dist_client() # run command either directly or via su $INSTALLUSER exec_cmd() { - case $EXEC_CMD in - as_install_user) su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@" ;; - as_current_user) "$@" ;; + case $EXEC_CMD,$(uname -s) in + as_install_user,OpenBSD) + su -s /bin/sh "$INSTALLUSER" -c 'exec "$0" "$@"' "$@" + ;; + as_install_user,*) + su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@" + ;; + as_current_user,*) + "$@" + ;; esac } exec_erl()