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

Re: How much mem is low, exactly?



W. Borgert wrote:

i have changed anna to enable the user to select what he wants.
and anna only download the selected packages (and dependencies too)

Could you provide floppy images (boot.img/root.img/net-drivers.img)
on some http-accessable place, please?  I would like to test it.

- there is not enough time to include this patch for release rc1, so
according
with joey, i will create specific images for very lowmem PCs

It would be nice to have the patch in (if it works) - that would
lead to better testing than lowmem-specific images, I believe.

Cheers, WB
this is the patch attached

sylvain


Index: anna.c
===================================================================
--- anna.c	(revision 16600)
+++ anna.c	(working copy)
@@ -6,6 +6,9 @@
 #include <sys/utsname.h>
 #include "anna.h"
 
+#define STATUS_FILE "/var/lib/lowmem"
+int lowmem=0;
+
 struct debconfclient *debconf = NULL;
 static char *running_kernel = NULL, *subarchitecture;
 
@@ -69,8 +72,9 @@
 {
     char *choices;
     int package_count = 0;
-    di_package *package, *status_package, **package_array;
-    di_slist_node *node, *node1;
+    di_package *package, *status_package, **package_array, *test_package;
+    di_slist_node *node, *node1, *node2;
+    int reverse_depend=0;
 
     config_retriever();
 
@@ -123,22 +127,48 @@
         if (!di_system_package_check_subarchitecture(package, subarchitecture))
           continue;
 
-        if (((di_system_package *)package)->kernel_version)
-        {
-          if (running_kernel && strcmp(running_kernel, ((di_system_package *)package)->kernel_version) == 0)
-          {
-              package->status_want = di_package_status_want_unknown;
-              di_log (DI_LOG_LEVEL_DEBUG, "ask for %s, matches kernel", package->package);
-          }
-          else
-            continue;
-        }
+	di_log (DI_LOG_LEVEL_DEBUG, "lowmem: %d, debconf status: %s", lowmem, debconf->value);
+	
+	if (((di_system_package *)package)->kernel_version)
+	{
+	     if (running_kernel && strcmp(running_kernel, ((di_system_package *)package)->kernel_version) == 0)
+	     {
+		  package->status_want = di_package_status_want_unknown;
+		  di_log (DI_LOG_LEVEL_DEBUG, "ask for %s, matches kernel", package->package);
+	     }
+	     else
+		  continue;
+	}
+ 
+	if (lowmem) {
+	     if (package->priority == di_package_priority_standard
+		 && ! ((di_system_package *)package)->installer_menu_item) {
+		  /* get only packages which are not dependencies of other packages */
+		  reverse_depend=0;
+		  for (node1 = (*packages)->list.head; node1; node1 = node1->next) {
+		       test_package = node1->data;
+		       for (node2 = test_package->depends.head; node2; node2 = node2->next) {
+			    di_package_dependency *d = node2->data;
+			    if (d->ptr == package) {
+				 reverse_depend=1;
+			    }
+		       }
+		  }
+		  if (reverse_depend == 0 && ! ((di_system_package *)package)->kernel_version) {
+		       package->status_want = di_package_status_want_unknown;
+		  }
+		  package->priority = di_package_priority_optional;
+	     }
+	}
+
         if (package->priority >= di_package_priority_standard || is_queued(package))
         {
             package->status_want = di_package_status_want_install;
             di_log (DI_LOG_LEVEL_DEBUG, "install %s, priority >= standard", package->package);
         }
-        else if (((di_system_package *)package)->installer_menu_item)
+        else if (((di_system_package *)package)->installer_menu_item 
+		 && package->status != di_package_status_installed) /* we don't want to see installed packages
+								     * in choices list*/
         {
             package->status_want = di_package_status_want_unknown;
             di_log (DI_LOG_LEVEL_DEBUG, "ask for %s, is installer item", package->package);
@@ -167,8 +197,12 @@
     choices = list_to_choices(package_array);
     debconf_fset(debconf, ANNA_CHOOSE_MODULES, "seen", "false");
     debconf_subst(debconf, ANNA_CHOOSE_MODULES, "CHOICES", choices);
-    debconf_input(debconf, "medium", ANNA_CHOOSE_MODULES);
-
+    if (lowmem) {
+	 debconf_input(debconf, "high", ANNA_CHOOSE_MODULES);
+    }
+    else {
+	 debconf_input(debconf, "medium", ANNA_CHOOSE_MODULES);
+    }
     di_free(choices);
     di_free(package_array);
 
@@ -334,6 +368,11 @@
 
     di_system_init("anna");
 
+     /* test if lowmem is activated */
+     if( rename(STATUS_FILE, STATUS_FILE) == 0) { 
+       lowmem=1;
+     } 
+
     if (debconf_get(debconf, "debian-installer/kernel/subarchitecture"))
         subarchitecture = strdup("generic");
     else

Reply to: