Skip to content

Commit 9e31ee2

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 67cc0c5 commit 9e31ee2

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
@@ -129,9 +129,16 @@ set_dist_client()
129129
# run command either directly or via su $INSTALLUSER
130130
exec_cmd()
131131
{
132-
case $EXEC_CMD in
133-
as_install_user) su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@" ;;
134-
as_current_user) "$@" ;;
132+
case $EXEC_CMD,$(uname -s) in
133+
as_install_user,OpenBSD)
134+
su -s /bin/sh "$INSTALLUSER" -c 'exec "$0" "$@"' "$@"
135+
;;
136+
as_install_user,*)
137+
su -s /bin/sh -c 'exec "$0" "$@"' "$INSTALLUSER" -- "$@"
138+
;;
139+
as_current_user,*)
140+
"$@"
141+
;;
135142
esac
136143
}
137144
exec_erl()

0 commit comments

Comments
 (0)