1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-06 03:50:15 +02:00

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.
This commit is contained in:
Kirill A. Korinsky 2024-11-28 10:30:30 +01:00
parent 10f6723f00
commit 8aae7424e9
No known key found for this signature in database
GPG key ID: 98D8D9867759226E

View file

@ -129,9 +129,16 @@ set_dist_client()
# run command either directly or via su $INSTALLUSER # run command either directly or via su $INSTALLUSER
exec_cmd() exec_cmd()
{ {
case $EXEC_CMD in case $EXEC_CMD,$(uname -s) in
as_install_user) su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@" ;; as_install_user,OpenBSD)
as_current_user) "$@" ;; su -s /bin/sh "$INSTALLUSER" -c 'exec "$0" "$@"' "$@"
;;
as_install_user,*)
su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@"
;;
as_current_user,*)
"$@"
;;
esac esac
} }
exec_erl() exec_erl()