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

Bug#219888: anna: Give the user full control of modules to be installed



Package: anna
Version: 0.043
Severity: wishlist

Hello,

The anna TODO list contains :
| * Include all packages that will be autoinstalled in the question about
|   what to install, in addition to those that will not be installed.
|   In corner cases the user mqay need to omit a particular package
|   from being installed even though it would be normally (think kernel
|   module udeb with a module that hangs with the given HW or something).

The attached patch implements it this way :
  - A new template (anna/choose-mode) asks the user (priority low) the
    way udebs should be selected : automatically, propose additional
    modules (default, current behaviour), full control.
  - If full control is chosen, automatically selected components are
    added to the list, preselected. The user can deselect them and they
    won't get installed.

I had to add a new template and change anna/choose-modules. Since i'm
not an native english speaker, reviewing the changes may be necessary.

If these changes are conflicting with the freeze plans going on, but
there is some interest in the patch, i'll keep it in sync with CVS until
it can be applied.

Note that the only way I can reach the partitionning (=swap-space
creating) step without getting out of memory is using these changes (as
well as the rootskel patch in #219528).

-- 
Jeremie Koenig <sprite@sprite.fr.eu.org>
Index: anna.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/anna/anna.c,v
retrieving revision 1.67
diff -u -r1.67 anna.c
--- anna.c	5 Nov 2003 15:49:29 -0000	1.67
+++ anna.c	9 Nov 2003 23:07:54 -0000
@@ -28,7 +28,7 @@
 
         if (retriever && (p = di_packages_get_package(status, retriever, 0))) {
             package_to_choice(p, buf, 200);
-	    set_retriever(buf);
+            set_retriever(buf);
         }
     }
 
@@ -42,13 +42,38 @@
     return 0;
 }
 
+static int
+choose_mode(di_packages *status __attribute__((unused)), di_packages **packages __attribute__((unused)), di_packages_allocator **packages_allocator __attribute__((unused)))
+{
+    debconf_fset(debconf, ANNA_CHOOSE_MODE, "seen", "false");
+    debconf_input(debconf, "low", ANNA_CHOOSE_MODE);
+    return 0;
+}
+
+static int
+get_choose_mode()
+{
+    const char *modes[] = {
+        "let the installer decide",
+        "offer additional components",
+        "full control",
+        NULL };
+    int i;
+
+    debconf_get(debconf, ANNA_CHOOSE_MODE);
+    if (debconf->value) {
+        for (i = 0 ; modes[i] && strcmp(debconf->value, modes[i]) ; i++);
+        if (modes[i])  return i;
+    }
+    return 1;   /* default */
+}
 
 static int
 choose_modules(di_packages *status, di_packages **packages, di_packages_allocator **packages_allocator)
 {
-    char *choices, *package_kernel, *running_kernel = NULL;
-    int package_count = 0;
-    di_package *package, *status_package, **package_array;
+    char *choices, *choices_sel, *package_kernel, *running_kernel = NULL;
+    int mode, package_count = 0, package_count_sel = 0;
+    di_package *package, *status_package, **package_array, **package_array_sel;
     di_slist_node *node, *node1;
     struct utsname uts;
 
@@ -114,8 +139,8 @@
             package->status_want = di_package_status_want_unknown;
             di_log (DI_LOG_LEVEL_DEBUG, "ask for %s, matches kernel", package->package);
         }
-	else if (package_kernel)
-	  continue;
+        else if (package_kernel)
+          continue;
         if (package->priority >= di_package_priority_standard)
         {
             package->status_want = di_package_status_want_install;
@@ -138,22 +163,39 @@
 
     /* Slight over-allocation, but who cares */
     package_array = di_new0(di_package *, di_hash_table_size((*packages)->table));
+    package_array_sel = di_new0(di_package *, di_hash_table_size((*packages)->table));
     /* Now build the asklist, figuring out which packages have been
      * pulled into instlist */
+    mode = get_choose_mode();
     for (node = (*packages)->list.head; node; node = node->next) {
         package = node->data;
-        if (package->status_want == di_package_status_want_unknown)
-            package_array[package_count++] = package;
+        switch (package->status_want) {
+            case di_package_status_want_install:
+        	if(mode < 2)  break;
+        	package_array_sel[package_count_sel++] = package;
+        	package->status_want = di_package_status_want_unknown;
+            case di_package_status_want_unknown:
+                package_array[package_count++] = package;
+        	break;
+            default:
+        	break;
+        }
     }
 
     qsort(package_array, package_count, sizeof(di_package *), package_array_compare);
-    choices = list_to_choices(package_array);
+    choices =     list_to_choices(package_array);
+    choices_sel = list_to_choices(package_array_sel);
     debconf_fset(debconf, ANNA_CHOOSE_MODULES, "seen", "false");
     debconf_subst(debconf, ANNA_CHOOSE_MODULES, "CHOICES", choices);
-    debconf_input(debconf, "medium", ANNA_CHOOSE_MODULES);
+    debconf_set(debconf, ANNA_CHOOSE_MODULES, choices_sel);
+    /* Fortunately we are the last entry, so "Go back" hasn't got to work :) */
+    if (mode >= 1)
+        debconf_input(debconf, "medium", ANNA_CHOOSE_MODULES);
 
     di_free(choices);
+    di_free(choices_sel);
     di_free(package_array);
+    di_free(package_array_sel);
 
     return 0;
 }
@@ -261,6 +303,7 @@
     int ret, state = 0;
     int (*states[])(di_packages *status, di_packages **packages, di_packages_allocator **packages_allocator) = {
         choose_retriever,
+        choose_mode,
         choose_modules,
         NULL,
     };
@@ -278,8 +321,8 @@
     di_package **retrievers_before = get_retriever_packages(status);
 
     if (argc > 1) {
-	    set_retriever(argv[1]);
-	    state=1; /* skip manual setting and use the supplied retriever */
+            set_retriever(argv[1]);
+            state=1; /* skip manual setting and use the supplied retriever */
     }
     
     while (state >= 0 && states[state] != NULL) {
Index: anna.h
===================================================================
RCS file: /cvs/debian-boot/debian-installer/anna/anna.h,v
retrieving revision 1.28
diff -u -r1.28 anna.h
--- anna.h	2 Nov 2003 23:09:24 -0000	1.28
+++ anna.h	9 Nov 2003 23:07:54 -0000
@@ -12,6 +12,7 @@
 #define EXCLUDE_FILE            DOWNLOAD_DIR "/exclude"
 #define DPKG_UNPACK_COMMAND	"udpkg --unpack"
 #define ANNA_RETRIEVER          "anna/retriever"
+#define ANNA_CHOOSE_MODE        "anna/choose_mode"
 #define ANNA_CHOOSE_MODULES     "anna/choose_modules"
 #define ANNA_NO_MODULES         "anna/no_modules"
 
Index: debian/templates
===================================================================
RCS file: /cvs/debian-boot/debian-installer/anna/debian/templates,v
retrieving revision 1.20
diff -u -r1.20 templates
--- debian/templates	9 Nov 2003 02:37:52 -0000	1.20
+++ debian/templates	9 Nov 2003 23:07:54 -0000
@@ -5,11 +5,26 @@
  The retriever is responsible for fetching installer components to be
  loaded.
 
+Template: anna/choose_mode
+Type: select
+_Choices: let the installer decide, offer additional components, full control
+Default: offer additional components
+_Description: Installer components selection mode:
+ Most components you will need will be automatically selected. However you
+ may wish to have a finer control over the list of modules to be installed.
+ .
+ Additional components all have low priority and are probably not necessary,
+ but may be interesting to some users.
+ .
+ Choosing full control will offer you an opportunity not to load some
+ base installer components. This is rarely necessary, and can make the
+ installation impossible, because of missing functionnality.
+
 Template: anna/choose_modules
 Type: multiselect
 Choices: ${CHOICES}
 _Description: Installer components to load:
- Most things you will need will be loaded automatically. The listed
+ Most things you will need have been automatically selected. The other
  installer components all have low priority and are probably not necessary,
  but may be interesting to some users.
  .

Reply to: