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

Bug#211063: autopartkit: should not re-ask for confirmation



Package: autopartkit
Version: 0.57 (not installed)
Severity: wishlist
Tags: patch d-i

Before asking autopartkit/confirm (the message that asks the user to
confirm the deletion of everything on all hard drives), autopartkit
fsets autopartkit/confirm's "seen" attribute to false, which prevents
(among others) fully automated installation.

The included (untested) patch makes autopartkit heed the "seen"
attribute, but sets it back to false if the user answered no or exited,
since the user usually would go back and correct something, and then
answer yes the second time.

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux dessverre 2.4.20-k7 #1 Tue Jan 14 00:29:06 EST 2003 i686
Locale: LANG=C, LC_CTYPE=en_US.ISO8859-1

? autopartkit-confirm-onlyonce.patch
Index: autopartkit.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/autopartkit/autopartkit.c,v
retrieving revision 1.63
diff -u -r1.63 autopartkit.c
--- autopartkit.c	16 Aug 2003 22:57:46 -0000	1.63
+++ autopartkit.c	15 Sep 2003 16:10:49 -0000
@@ -205,19 +205,6 @@
     client->command(client, "TITLE", new_title, NULL);
 }
 
-static int mydebconf_bool(char *priority, char *template)
-{
-    const char *value;
-
-    value = mydebconf_input(priority, template);
-    if (strstr(value, "true"))
-	return 1;
-    if (strstr(value, "false"))
-	return 0;
-    mydebconf_debug("unknown bool value", value);
-    return 0;
-}
-
 void autopartkit_log(const int level, const char * format, ...)
 {
     int LOGLIMIT = 1;
@@ -228,18 +215,23 @@
     vsyslog(LOG_DEBUG, format, ap);
     va_end(ap);
 }
+
+/* note: only fsets seen=true if the user answered yes */
 static void autopartkit_confirm(void)
 {
-    static int confirm = 0;
-    if (confirm)
-	return;
-    if (mydebconf_bool("critical", "autopartkit/confirm"))
-    {
-	confirm = 1;
-	return;
-    } else {
-	exit(EXIT_FAILURE);
-    }
+    client->command (client, "INPUT", "critical", "autopartkit/confirm", NULL);
+    client->command (client, "GO", NULL);
+    client->command (client, "GET", "autopartkit/confirm", NULL);
+
+    if (strstr(client->value, "true"))
+        return;
+
+    client->command (client, "FSET", "autopartkit/confirm", "seen", "false", NULL);
+    
+    if (strstr(client->value, "false"))
+        exit(EXIT_FAILURE);
+    mydebconf_debug("unknown bool value", client->value);
+    exit(EXIT_FAILURE);
 }
 
 static void disable_kmsg(int disable)

Reply to: