Merge branch '__user_remove_freebsd_fix' into 'master'

[__user] fix user delete on freebsd

See merge request ungleich-public/cdist!882
This commit is contained in:
poljakowski 2020-05-23 19:02:31 +02:00
commit 15e4b5ee3b

View file

@ -135,10 +135,18 @@ elif [ "$state" = "absent" ]; then
if grep -q "^${name}:" "$__object/explorer/passwd"; then if grep -q "^${name}:" "$__object/explorer/passwd"; then
#user exists, but state != present, so delete it #user exists, but state != present, so delete it
if [ -f "$__object/parameter/remove-home" ]; then if [ -f "$__object/parameter/remove-home" ]; then
if [ "$os" = "freebsd" ]; then
printf "pw userdel '%s' -r >/dev/null 2>&1\\n" "${name}"
else
printf "userdel -r '%s' >/dev/null 2>&1\\n" "${name}" printf "userdel -r '%s' >/dev/null 2>&1\\n" "${name}"
fi
echo "userdel -r" >> "$__messages_out" echo "userdel -r" >> "$__messages_out"
else
if [ "$os" = "freebsd" ]; then
printf "pw userdel '%s' >/dev/null 2>&1\\n" "${name}"
else else
printf "userdel '%s' >/dev/null 2>&1\\n" "${name}" printf "userdel '%s' >/dev/null 2>&1\\n" "${name}"
fi
echo "userdel" >> "$__messages_out" echo "userdel" >> "$__messages_out"
fi fi
fi fi