Commit 9649237c authored by Jondy Zhao's avatar Jondy Zhao

useradd: support many other groups; try to grp_name if name doesn't exist.

parent d097597a
...@@ -150,10 +150,11 @@ function add_member_to_group() ...@@ -150,10 +150,11 @@ function add_member_to_group()
{ {
local name=$1 local name=$1
local grpname=$2 local grpname=$2
net localgroup $grpname > /dev/null 2>&1 || grpname="grp_$grpname"
net localgroup $grpname > /dev/null 2>&1 || return 1
if ! net localgroup $grpname | grep -q -e "^$name$" ; then if ! net localgroup $grpname | grep -q -e "^$name$" ; then
net localgroup $grpname $name /add net localgroup $grpname $name /add
fi fi
net localgroup $grpname | grep -q -e "^$name$"
} # === End of add_member_to_group() === # } # === End of add_member_to_group() === #
while getopts "Dd:g:G:p:s:r" opt ; do while getopts "Dd:g:G:p:s:r" opt ; do
...@@ -165,7 +166,7 @@ while getopts "Dd:g:G:p:s:r" opt ; do ...@@ -165,7 +166,7 @@ while getopts "Dd:g:G:p:s:r" opt ; do
USER_INIT_GROUP=$OPTARG USER_INIT_GROUP=$OPTARG
;; ;;
G) G)
USER_OTHER_GROUP=$OPTARG USER_OTHER_GROUP="$USER_OTHER_GROUP $OPTARG"
;; ;;
p) p)
USER_PASSWORD=$OPTARG USER_PASSWORD=$OPTARG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment