Merge remote-tracking branch 'mcodd/groupmod-redhat-exception'

This commit is contained in:
Nico Schottelius 2012-03-12 20:56:57 +01:00
commit 856514d70f
2 changed files with 24 additions and 2 deletions

View file

@ -22,6 +22,15 @@
# #
name=$__object_id name=$__object_id
os_version="$($__explorer/os_version)"
case "$os_version" in
"Red Hat Enterprise Linux Server release "[45]*|"CentOS release "[45]*)
# TODO: find a way to get this information
echo "$os_version does not have getent gshadow"
;;
*)
getent gshadow "$name" || true getent gshadow "$name" || true
;;
esac

View file

@ -23,23 +23,36 @@
# #
name="$__object_id" name="$__object_id"
os_version="$(cat "$__global/explorer/os_version")"
cd "$__object/parameter" cd "$__object/parameter"
if grep -q "^${name}:" "$__object/explorer/group"; then if grep -q "^${name}:" "$__object/explorer/group"; then
for property in $(ls .); do for property in $(ls .); do
new_value="$(cat "$property")" new_value="$(cat "$property")"
# argument to pass the groupmod command for this property (exceptions
# are made in the case statement below)
proparg="--$property"
case "$property" in case "$property" in
password) password)
current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")" current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")"
case "$os_version" in
"Red Hat Enterprise Linux Server release "[45]*|"CentOS release "[45]*)
# TODO: Use gpasswd? Need to fix gshadow explorer first.
echo "group/$name: '$os_version' groupmod does not support password modification" >&2
exit 1
;;
esac
;; ;;
gid) gid)
# set to -g to support older redhat/centos
proparg="-g"
current_value="$(awk -F: '{ print $3 }' < "$__object/explorer/group")" current_value="$(awk -F: '{ print $3 }' < "$__object/explorer/group")"
;; ;;
esac esac
if [ "$new_value" != "$current_value" ]; then if [ "$new_value" != "$current_value" ]; then
set -- "$@" "--$property" \"$new_value\" set -- "$@" "$proparg" \"$new_value\"
fi fi
done done