From 8aae7424e9ac3da802c6751a0f0b47d2fa7115f6 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Thu, 28 Nov 2024 10:30:30 +0100 Subject: [PATCH 1/2] 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 9d91e261c..791b09f8d 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -129,9 +129,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() From 5de3bacf356530371b0a3459c95d6df988c357c2 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Sat, 26 Apr 2025 21:34:01 +0200 Subject: [PATCH 2/2] ejabberdctl: support NetBSD su Co-authored-by: Greg Troxel --- ejabberdctl.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ejabberdctl.template b/ejabberdctl.template index 791b09f8d..0853983ea 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -133,6 +133,9 @@ exec_cmd() as_install_user,OpenBSD) su -s /bin/sh "$INSTALLUSER" -c 'exec "$0" "$@"' "$@" ;; + as_install_user,NetBSD) + su "$INSTALLUSER" -c 'exec "$0" "$@"' -- "$@" + ;; as_install_user,*) su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@" ;;