__user_groups: Support OpenBSD

OpenBSD's usermod(8) interface is similary to NetBSD's.
This commit makes __user_groups support it explicitly.

https://man.openbsd.org/usermod.8
http://netbsd.gw.com/cgi-bin/man-cgi?usermod++NetBSD-current
This commit is contained in:
Philippe Grégoire 2017-08-27 08:56:34 -04:00
parent f4c4ba7267
commit 0e3c7545cc
No known key found for this signature in database
GPG key ID: A14AA6DA679C2177

View file

@ -42,10 +42,10 @@ if [ -z "$changed_groups" ]; then
fi fi
for group in $changed_groups; do for group in $changed_groups; do
if [ "$os" = "netbsd" ]; then if [ "$os" = "netbsd" ] || [ "$os" = "openbsd" ]; then
case "$state_should" in case "$state_should" in
present) echo "usermod -G \"$group\" \"$user\"" ;; present) echo "usermod -G \"$group\" \"$user\"" ;;
absent) echo 'NetBSD does not have a command to remove a user from a group' >&2 ; exit 1 ;; absent) echo 'NetBSD and OpenBSD do not have a command to remove a user from a group' >&2 ; exit 1 ;;
esac esac
elif [ "$os" = "freebsd" ]; then elif [ "$os" = "freebsd" ]; then
case "$state_should" in case "$state_should" in