[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#490899: user-setup-udeb: way to (easily) *not* create a user, but do the root password setup



Cheers,

I'm pretty new at offering patches, and I'm not well convinced this one fits
the global way user-setup is designed. Please, any comment is welcome.

Another solution would be, I guess, to temporary change the user
debconf/priority to medium, and to revert it to its previous state after the
choice.

-- 
PEB
diff --git a/user-setup-ask b/user-setup-ask
index 6176930..06e4f56 100755
--- a/user-setup-ask
+++ b/user-setup-ask
@@ -30,6 +30,7 @@ set_special_users() {
 # Main loop starts here. Use a state machine to allow jumping back to
 # previous questions.
 STATE=0
+USER_RETRY=false
 while :; do
        case "$STATE" in
            0)
@@ -97,7 +98,11 @@ while :; do
                        # to sudo to root
                        db_set passwd/make-user true
                elif ! is_system_user; then
-                       db_input medium passwd/make-user || true
+                       if [ "$USER_RETRY" = true ]; then
+                               db_input critical passwd/make-user || true
+                       else
+                               db_input medium passwd/make-user || true
+                       fi
                fi
                ;;
            4)
@@ -135,6 +140,10 @@ while :; do
                        # Verify the user name, loop with message if bad.
                        db_get passwd/username
                        USER="$RET"
+                       if test -z $RET; then
+                               STATE=3
+                               USER_RETRY=true
+                               continue
                        if ! LC_ALL=C expr "$USER" : '[a-z][-a-z0-9]*$' >/dev/null || \
                           ! LC_ALL=C expr length "$USER" '<=' 32 >/dev/null; then
                                db_fset passwd/username seen false


Reply to: