add some NetBSD support in __user_groups

This commit is contained in:
Jonathan A. Kollasch 2015-10-15 10:53:56 -05:00
parent 68370db5c3
commit 90fe1bf6c9
3 changed files with 15 additions and 2 deletions

View file

@ -20,4 +20,4 @@
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
(id --groups --name "$user" | tr ' ' '\n' | sort) 2>/dev/null || true
(id -G -n "$user" | tr ' ' '\n' | sort) 2>/dev/null || true

View file

@ -18,4 +18,11 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
os="$($__explorer/os)"
if [ "$os" = "netbsd" ]; then
echo netbsd
exit
fi
usermod --help | grep -q -- '-A group' && echo true || echo false

View file

@ -21,8 +21,14 @@
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
state_should="$(cat "$__object/parameter/state")"
oldusermod="$(cat "$__object/explorer/oldusermod")"
os=$(cat "$__global/explorer/os")
if [ "$oldusermod" = "true" ]; then
if [ "$os" = "netbsd" ]; then
# NetBSD does not have a command to remove a user from a group
oldusermod="true"
addparam="-G"
delparam=";;#"
elif [ "$oldusermod" = "true" ]; then
addparam="-A"
delparam="-R"
else