__user: only run commands if value has changed

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
remotes/origin/1.2
Steven Armstrong 14 years ago
parent 42c87edad1
commit 1518bf1935
  1. 1
      conf/type/__user/TODO
  2. 28
      conf/type/__user/gencode

@ -1,3 +1,2 @@
- gencode: compair new value with existing one in $__object/explorer/passwd, only change if nessecary
- delete users - delete users

@ -33,12 +33,34 @@ else
fi fi
get_current_value() {
local key="$1"
local index
case "$key" in
uid) index=3;;
gid) index=4;;
comment) index=5;;
home) index=6;;
shell) index=7;;
esac
cut -d':' -f $index "$__object/explorer/passwd"
}
set -- "$@" set -- "$@"
cd "$__object/parameter" cd "$__object/parameter"
for property in $(ls .); do for property in $(ls .); do
# TODO: compair new value with existing one in $__object/explorer/passwd, only change if nessecary current_value=$(get_current_value "$property")
set -- "$@" "--$property" "$(cat "$property")" new_value="$(cat "$property")"
if [ "$new_value" != "$current_value" ]; then
# Shedule changed properties for update
set -- "$@" "--$property" \"$new_value\"
fi
done done
echo $command $@ $name
if [ $# -gt 0 ]; then
# Update changed properties
echo $command $@ $name
fi

Loading…
Cancel
Save