redhat groupmod doesn't support --gid option

redhat groupmod doesn't support password chages
redhat doesn't support getent gshadow
This commit is contained in:
Matt Coddington 2012-02-06 16:21:51 -05:00
parent 63ba527bd8
commit acb4644f1e
2 changed files with 23 additions and 2 deletions

View file

@ -22,6 +22,14 @@
#
name=$__object_id
os="$($__explorer/os)"
getent gshadow "$name" || true
case "$os" in
centos|fedora|redhat)
grep "^${name}:" /etc/gshadow || true
;;
*)
getent gshadow "$name" || true
;;
esac

View file

@ -23,23 +23,36 @@
#
name="$__object_id"
os="$(cat "$__global/explorer/os")"
cd "$__object/parameter"
if grep -q "^${name}:" "$__object/explorer/group"; then
for property in $(ls .); do
new_value="$(cat "$property")"
# argument to pass the groupmod command for this property (os-specific
# exceptions are listed in the case statement below)
proparg="--$property"
case "$property" in
password)
current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")"
case "$os" in
centos|fedora|redhat)
echo "group/$name: $os groupmod does not support password modification" >&2
continue
;;
esac
;;
gid)
current_value="$(awk -F: '{ print $3 }' < "$__object/explorer/group")"
case "$os" in
centos|fedora|redhat) proparg="-g" ;;
esac
;;
esac
if [ "$new_value" != "$current_value" ]; then
set -- "$@" "--$property" \"$new_value\"
set -- "$@" "$proparg" \"$new_value\"
fi
done