patchs for lowmem <=32Mb in i386
hello
i will not be here next week, and i don't know if i have to commit this
patch before RC1
so i attach the patches for S10lowmem and anna.c file
test it for other arches,
joey will decide to put it or not for RC1
bye
sylvain
Index: S10lowmem
===================================================================
--- S10lowmem (revision 17618)
+++ S10lowmem (working copy)
@@ -8,9 +8,13 @@
ram=$(expr "$ram" / 1024) # convert to megabytes
# This is the max memory footprint of the installer in non lowmem mode
# up to running the partitioner.
+ # According to memory size, we define different levels
ARCH=`udpkg --print-architecture`
case $ARCH in
- i386) needed=45 ;;
+ i386)
+ needed=45
+ level1=32
+ ;;
mips) needed=25 ;;
mipsel) needed=25 ;;
m68k) needed=25 ;;
@@ -23,4 +27,8 @@
trimtemplates /var/lib/dpkg/info || true
fi
+
+ if [ "$ram" -lt "$level1" ]; then
+ touch /var/lib/lowmem-lvl1
+ fi
fi
Index: anna.c
===================================================================
--- anna.c (revision 17618)
+++ anna.c (working copy)
@@ -6,6 +6,9 @@
#include <sys/utsname.h>
#include "anna.h"
+#define STATUS_FILE "/var/lib/lowmem-lvl1"
+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: