From e464c5aaa223f3cfe80f20c3d42a1eb2b928adad Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Apr 2011 11:04:00 +0200 Subject: [PATCH] simplify Signed-off-by: Nico Schottelius --- conf/type/__group/gencode-remote | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/conf/type/__group/gencode-remote b/conf/type/__group/gencode-remote index a8a8397d..4cb05762 100755 --- a/conf/type/__group/gencode-remote +++ b/conf/type/__group/gencode-remote @@ -24,35 +24,26 @@ name="$__object_id" -get_current_value() { - local key="$1" - local index - case "$key" in - password) - cut -d':' -f 2 "$__object/explorer/gshadow" - break - ;; - gid) index=3;; - esac - cut -d':' -f $index "$__object/explorer/group" -} - cd "$__object/parameter" if grep -q "^${name}:" "$__object/explorer/group"; then - # group exists, only change changed values for property in $(ls .); do - current_value=$(get_current_value "$property") new_value="$(cat "$property")" + + case "$key" in + password) + current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")" + ;; + gid) + current_value="$(awk -F: '{ print $3 }' < "$__object/explorer/group")" + ;; + esac + 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 groupmod $@ $name - fi + [ $# -gt 0 ] && echo groupmod $@ $name else for property in $(ls .); do new_value="$(cat "$property")"