git: 9efad6f9e108 - main - add defaults for adduser.sh (OK? [yes] & additional user [no])

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 18 Jul 2023 17:39:27 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=9efad6f9e1084e97dd6e2599562e7db0bd31a4ab

commit 9efad6f9e1084e97dd6e2599562e7db0bd31a4ab
Author:     Sven Ruediger <freebsd@hackacad.net>
AuthorDate: 2023-07-18 17:37:48 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-07-18 17:37:48 +0000

    add defaults for adduser.sh (OK? [yes] & additional user [no])
    
    Event:          Kitchener-Waterloo Hackathon 202305
    Differential Revision:  https://reviews.freebsd.org/D40157
---
 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 fb4b51fc23e3..75db900c4524 100644
--- a/usr.sbin/adduser/adduser.sh
+++ b/usr.sbin/adduser/adduser.sh
@@ -657,6 +657,8 @@ input_interactive() {
 	_usepass="yes"
 	_logingroup_ok="no"
 	_groups_ok="no"
+	_all_ok="yes"
+	_another_user="no"
 	case $passwdtype in
 	none)
 		_emptypass="yes"
@@ -817,8 +819,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
@@ -1030,11 +1035,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`