forked from ungleich-public/cdist
use property, not key anymore
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
4b76d8a7e0
commit
db425d3925
1 changed files with 4 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -30,7 +31,7 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then
|
|||
|
||||
file="$__object/explorer/passwd"
|
||||
|
||||
case "$key" in
|
||||
case "$property" in
|
||||
password)
|
||||
field=3
|
||||
file="$__object/explorer/shadow"
|
||||
|
@ -50,18 +51,15 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then
|
|||
shell) field=7 ;;
|
||||
esac
|
||||
|
||||
export field
|
||||
current_value="$(awk -F: '{ print $ENVIRON["field"] }' < "$file")"
|
||||
|
||||
if [ "$new_value" != "$current_value" ]; then
|
||||
# Shedule changed properties for update
|
||||
set -- "$@" "--$property" \"$new_value\"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
# Update changed properties
|
||||
echo usermod "$@" "$name"
|
||||
fi
|
||||
[ $# -gt 0 ] && echo usermod "$@" "$name"
|
||||
else
|
||||
for property in $(ls .); do
|
||||
new_value="$(cat "$property")"
|
||||
|
|
Loading…
Reference in a new issue