25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01: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 7d0c20e133
commit 1b77abcc9c
No known key found for this signature in database
GPG Key ID: 98D8D9867759226E

View File

@ -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()