aboutsummaryrefslogtreecommitdiffstats
path: root/add-user
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2002-07-12 15:23:50 +0000
committerMystery Man <unknown@mandriva.org>2002-07-12 15:23:50 +0000
commite86b6a1e3b64bdf1f96c572f7a824b3dd74c71b8 (patch)
tree33a04fe5e4b674d437146992d11bb52dd20804ba /add-user
parentb570e96e55cab1c0d1ee546f1601939f190e9697 (diff)
downloadrpm-helper-e86b6a1e3b64bdf1f96c572f7a824b3dd74c71b8.tar
rpm-helper-e86b6a1e3b64bdf1f96c572f7a824b3dd74c71b8.tar.gz
rpm-helper-e86b6a1e3b64bdf1f96c572f7a824b3dd74c71b8.tar.bz2
rpm-helper-e86b6a1e3b64bdf1f96c572f7a824b3dd74c71b8.tar.xz
rpm-helper-e86b6a1e3b64bdf1f96c572f7a824b3dd74c71b8.zip
This commit was manufactured by cvs2svn to create tag 'V0_3_1mdk'.V0_3_1mdk
Diffstat (limited to 'add-user')
-rwxr-xr-xadd-user19
1 files changed, 16 insertions, 3 deletions
diff --git a/add-user b/add-user
index 0a44fc8..f2d1126 100755
--- a/add-user
+++ b/add-user
@@ -10,8 +10,8 @@
# system user.
#---------------------------------------------------------------
-if [ $# != 5 ]; then
- echo "usage: $0 <pkg name> <num installed> <user name> <home dir> <shell>" 1>&2
+if [ $# -lt 5 ]; then
+ echo "usage: $0 <pkg name> <num installed> <user name> <home dir> <shell> [<group1> <group2>...]" 1>&2
exit 1
fi
@@ -20,7 +20,20 @@ num=$2 # number of packages installed
name=$3 # name of the user
dir=$4 # home directory
shell=$5 # shell
+shift 5
-/usr/sbin/useradd -r -M -s $shell -d $dir -c "system user for $pkg" $name > /dev/null 2>&1 || :
+if [ $# -gt 0 ]; then
+ garg="-G $1"
+ /usr/sbin/groupadd -r $1 > /dev/null 2>&1
+ shift
+ for g in $*; do
+ garg="$garg,$g"
+ /usr/sbin/groupadd -r $g > /dev/null 2>&1
+ done
+fi
+
+/usr/sbin/useradd -r -M -s $shell -d $dir -c "system user for $pkg" $garg $name > /dev/null 2>&1
+
+exit 0
# add-user ends here