Hello, I wrote a little patch, that makes main-menu aware of isinstallable skripts as explained in modules.txt in doc.
It would be nice if someone reviewed it. Sebastian -- PGP-Key: http://www.mmweg.rwth-aachen.de/~sebastian.ley/public.key Fingerprint: A46A 753F AEDC 2C01 BE6E F6DB 97E0 3309 9FD6 E3E6
? semantic.cache Index: main-menu.c =================================================================== RCS file: /cvs/debian-boot/debian-installer/main-menu/main-menu.c,v retrieving revision 1.78 diff -u -r1.78 main-menu.c --- main-menu.c 16 Jul 2003 15:37:29 -0000 1.78 +++ main-menu.c 18 Jul 2003 17:57:48 -0000 @@ -51,27 +51,46 @@ /* Returns true if the given package could be the default menu item. */ int isdefault(struct package_t *p) { - char *menutest, *cmd; + int check; + + check = check_script(p, "menutest"); + if (check == -1) { + if (p->status == unpacked || p->status == half_configured) { + return 1; + } + else { + return 0; + } + } + else { + return check; + } +} + +/* Returns : + * 0 if selected script returns false or something goes wrong + * 1 if selected script return truen + * -1 if selected script is not present + */ +int check_script(struct package_t *p, char *scriptname) { + char *script, *cmd; struct stat statbuf; int ret; - if (asprintf(&menutest, DPKGDIR "info/%s.menutest", p->package) == -1) { + if (asprintf(&script, DPKGDIR "info/%s.%s", p->package, scriptname) == -1) { return 0; } - if (stat(menutest, &statbuf) == 0) { - if (asprintf(&cmd, "exec %s >/dev/null 2>&1", menutest) == -1) { + if (stat(script, &statbuf) == 0) { + if (asprintf(&cmd, "exec %s >/dev/null 2>&1", script) == -1) { return 0; } ret = !SYSTEM(cmd); free(cmd); } - else if (p->status == unpacked || p->status == half_configured) { - ret = 1; - } else { - ret = 0; + ret = -1; } - free(menutest); + free(script); return ret; } @@ -86,7 +105,7 @@ /* Traverse the list, return the first menu item that isn't installed */ for (node = list->head; node != NULL; node = node->next) { p = (struct package_t *)node->data; - if (!p->installer_menu_item || p->status == installed) + if (!p->installer_menu_item || p->status == installed || !check_script(p, "isinstallable")) continue; /* If menutest says this item should be default, make it so */ if (isdefault(p)) @@ -158,6 +177,8 @@ int ok = 0; p = (struct package_t *)node->data; if (!p->installer_menu_item) + continue; + if (!check_script(p, "isinstallable")) continue; if (language) { langdesc = p->localized_descriptions;
pgp00000.pgp
Description: PGP signature