diff --git a/cdist/conf/type/__user_groups/explorer/group b/cdist/conf/type/__user_groups/explorer/group index a8cb63af..5bad9a0b 100755 --- a/cdist/conf/type/__user_groups/explorer/group +++ b/cdist/conf/type/__user_groups/explorer/group @@ -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 diff --git a/cdist/conf/type/__user_groups/explorer/oldusermod b/cdist/conf/type/__user_groups/explorer/oldusermod index 6ef25b13..bf43fcec 100644 --- a/cdist/conf/type/__user_groups/explorer/oldusermod +++ b/cdist/conf/type/__user_groups/explorer/oldusermod @@ -18,4 +18,11 @@ # along with cdist. If not, see . # +os="$($__explorer/os)" + +if [ "$os" = "netbsd" ]; then + echo netbsd + exit +fi + usermod --help | grep -q -- '-A group' && echo true || echo false diff --git a/cdist/conf/type/__user_groups/gencode-remote b/cdist/conf/type/__user_groups/gencode-remote index 65404bfc..8b13f32c 100755 --- a/cdist/conf/type/__user_groups/gencode-remote +++ b/cdist/conf/type/__user_groups/gencode-remote @@ -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