diff options
author | Frederic Lepied <flepied@mandriva.com> | 2002-07-12 15:19:48 +0000 |
---|---|---|
committer | Frederic Lepied <flepied@mandriva.com> | 2002-07-12 15:19:48 +0000 |
commit | ceaec14bef72b558f56212b64111fa9e826e85d3 (patch) | |
tree | ece654b7ad7b50da60f01d0d0869cf27ad194376 /add-user | |
parent | c614c9fad2349207539bf764de2c84b306b13dc0 (diff) | |
download | rpm-helper-ceaec14bef72b558f56212b64111fa9e826e85d3.tar rpm-helper-ceaec14bef72b558f56212b64111fa9e826e85d3.tar.gz rpm-helper-ceaec14bef72b558f56212b64111fa9e826e85d3.tar.bz2 rpm-helper-ceaec14bef72b558f56212b64111fa9e826e85d3.tar.xz rpm-helper-ceaec14bef72b558f56212b64111fa9e826e85d3.zip |
added support for extended groups
Diffstat (limited to 'add-user')
-rwxr-xr-x | add-user | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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,18 @@ 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" + + done +fi + +/usr/sbin/useradd -r -M -s $shell -d $dir -c "system user for $pkg" $garg $name > /dev/null 2>&1 || : # add-user ends here |