Skip to content

Commit 1b77abc

Browse files
committed
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.
1 parent 7d0c20e commit 1b77abc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ejabberdctl.template

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,16 @@ set_dist_client()
125125
# run command either directly or via su $INSTALLUSER
126126
exec_cmd()
127127
{
128-
case $EXEC_CMD in
129-
as_install_user) su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@" ;;
130-
as_current_user) "$@" ;;
128+
case $EXEC_CMD,$(uname -s) in
129+
as_install_user,OpenBSD)
130+
su -s /bin/sh "$INSTALLUSER" -c 'exec "$0" "$@"' "$@"
131+
;;
132+
as_install_user,*)
133+
su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@"
134+
;;
135+
as_current_user,*)
136+
"$@"
137+
;;
131138
esac
132139
}
133140
exec_erl()

0 commit comments

Comments
 (0)