diff options
author | mtm <mtm@FreeBSD.org> | 2003-03-20 16:36:03 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-03-20 16:36:03 +0000 |
commit | 66726447ae92b9fc4729c3f77d333e6255f7f6d1 (patch) | |
tree | e0033b82430e30b2054810d2bb4fdbb65e7e7e28 /usr.sbin/adduser/adduser.sh | |
parent | 0077bc4bf03f4063df206f64fbfeabd8874c66c5 (diff) | |
download | FreeBSD-src-66726447ae92b9fc4729c3f77d333e6255f7f6d1.zip FreeBSD-src-66726447ae92b9fc4729c3f77d333e6255f7f6d1.tar.gz |
Add a -g option to specify a default login group.
Approved by: markm (mentor)(implicit)
Diffstat (limited to 'usr.sbin/adduser/adduser.sh')
-rw-r--r-- | usr.sbin/adduser/adduser.sh | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh index 79e3752..bd9c42f 100644 --- a/usr.sbin/adduser/adduser.sh +++ b/usr.sbin/adduser/adduser.sh @@ -145,6 +145,7 @@ save_config() { echo "# NOTE: only *some* variables are saved." >> ${ADDUSERCONF} echo "# Last Modified on `${DATECMD}`." >> ${ADDUSERCONF} echo '' >> ${ADDUSERCONF} + echo "defaultLgroup=$ulogingroup" >> ${ADDUSERCONF} echo "defaultclass=$uclass" >> ${ADDUSERCONF} echo "defaultgroups=$ugroups" >> ${ADDUSERCONF} echo "passwdtype=$passwdtype" >> ${ADDUSERCONF} @@ -430,25 +431,23 @@ get_class() { # get_logingroup # Reads user's login group. Can be used in both interactive and batch # modes. The specified value can be a group name or its numeric id. -# This routine leaves the field blank if nothing is provided. The pw(8) -# command will then provide a login group with the same name as the username. +# This routine leaves the field blank if nothing is provided and +# a default login group has not been set. The pw(8) command +# will then provide a login group with the same name as the username. # get_logingroup() { - ulogingroup= + ulogingroup="$defaultLgroup" _input= - # No need to take down a login group for a configuration saving run. - [ -n "$configflag" ] && return - if [ -z "$fflag" ]; then - echo -n "Login group [$username]: " + echo -n "Login group [${ulogingroup:-$username}]: " read _input else _input="`echo "$fileline" | cut -f3 -d:`" fi # Pw(8) will use the username as login group if it's left empty - [ -n "$_input" ] && ulogingroup="$_input" || ulogingroup= + [ -n "$_input" ] && ulogingroup="$_input" } # get_groups @@ -713,7 +712,7 @@ input_interactive() { [ -z "$configflag" ] && printf "%-10s : %s\n" "Full Name" "$ugecos" [ -z "$configflag" ] && printf "%-10s : %s\n" "Uid" "$uuid" printf "%-10s : %s\n" "Class" "$uclass" - [ -z "$configflag" ] && printf "%-10s : %s %s\n" "Groups" "${ulogingroup:-$username}" "$ugroups" + printf "%-10s : %s %s\n" "Groups" "${ulogingroup:-$username}" "$ugroups" printf "%-10s : %s\n" "Home" "$uhome" printf "%-10s : %s\n" "Shell" "$ushell" printf "%-10s : %s\n" "Locked" "$_disable" @@ -777,6 +776,7 @@ randompass= fileline= savedpwtype= defaultclass= +defaultLgroup= defaultgoups= defaultshell="${DEFAULTSHELL}" @@ -835,6 +835,10 @@ for _switch ; do fflag=yes shift; shift ;; + -g) + defaultLgroup="$2" + shift; shift + ;; -G) defaultgroups="$2" shift; shift |