aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-12-22 23:08:41 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-12-22 23:08:41 +0000
commit8a832b7dab615a128aeba158adff29e4e30ee41e (patch)
tree3945b631015df35998b6a0711ecf486a84924bbf
parent48eb5505dc5d8d8c79e6b5f8dca0d19a7d6265d4 (diff)
downloadrpm-helper-8a832b7dab615a128aeba158adff29e4e30ee41e.tar
rpm-helper-8a832b7dab615a128aeba158adff29e4e30ee41e.tar.gz
rpm-helper-8a832b7dab615a128aeba158adff29e4e30ee41e.tar.bz2
rpm-helper-8a832b7dab615a128aeba158adff29e4e30ee41e.tar.xz
rpm-helper-8a832b7dab615a128aeba158adff29e4e30ee41e.zip
do not delete supplementary groups already added
-rwxr-xr-xadd-group6
1 files changed, 5 insertions, 1 deletions
diff --git a/add-group b/add-group
index c27855c..fada716 100755
--- a/add-group
+++ b/add-group
@@ -29,7 +29,11 @@ if [ -n "$users" ]; then
IFS="$SAVED_IFS"
for u in $*; do
- /usr/sbin/usermod -G $name $u > /dev/null 2>&1
+ old=`egrep "[:,]$u(,|$)" /etc/group | cut -d : -f 1 | xargs echo`
+ if [ -n "$old" ]; then
+ old=`echo ",$old" | sed 's/ /,/g'`
+ fi
+ /usr/sbin/usermod -G $name$old $u > /dev/null 2>&1
done
fi