Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2024 10:34:24 GMT
From:      Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 1da8405cdec4 - stable/13 - add defaults for adduser.sh (OK? [yes] & additional user [no])
Message-ID:  <202404291034.43TAYOWd071344@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=1da8405cdec442bc75c5443a727905f0f2c5800d

commit 1da8405cdec442bc75c5443a727905f0f2c5800d
Author:     Sven Ruediger <freebsd@hackacad.net>
AuthorDate: 2023-07-18 17:37:48 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-04-29 10:16:06 +0000

    add defaults for adduser.sh (OK? [yes] & additional user [no])
    
    Event:          Kitchener-Waterloo Hackathon 202305
    Differential Revision:  https://reviews.freebsd.org/D40157
    
    (cherry picked from commit 9efad6f9e1084e97dd6e2599562e7db0bd31a4ab)
---
 usr.sbin/adduser/adduser.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh
index 89dec9cf3d25..fef9e293c1ce 100644
--- a/usr.sbin/adduser/adduser.sh
+++ b/usr.sbin/adduser/adduser.sh
@@ -656,6 +656,8 @@ input_interactive() {
 	_usepass="yes"
 	_logingroup_ok="no"
 	_groups_ok="no"
+	_all_ok="yes"
+	_another_user="no"
 	case $passwdtype in
 	none)
 		_emptypass="yes"
@@ -816,8 +818,11 @@ input_interactive() {
 	printf "%-10s : %s\n" "Shell" "$ushell"
 	printf "%-10s : %s\n" "Locked" "$_disable"
 	while : ; do
-		echo -n "OK? (yes/no): "
+		echo -n "OK? (yes/no) [$_all_ok]: "
 		read _input
+		if [ -z "$_input" ]; then
+			_input=$_all_ok
+		fi
 		case $_input in
 		[Nn][Oo]|[Nn])
 			return 1
@@ -1029,11 +1034,14 @@ else
 	input_interactive
 	while : ; do
 		if [ -z "$configflag" ]; then
-			echo -n "Add another user? (yes/no): "
+			echo -n "Add another user? (yes/no) [$_another_user]: "
 		else
-			echo -n "Re-edit the default configuration? (yes/no): "
+			echo -n "Re-edit the default configuration? (yes/no) [$_another_user]: "
 		fi
 		read _input
+		if [ -z "$_input" ]; then
+			_input=$_another_user
+		fi
 		case $_input in
 		[Yy][Ee][Ss]|[Yy][Ee]|[Yy])
 			uidstart=`get_nextuid $uidstart`



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404291034.43TAYOWd071344>