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

Changing debconf frontend from the main menu



Here is another suggestion on how to change the frontend from the main
menu.  The idea is that all cdebconf frontend udebs will include a
postinst script and a menu entry setting the frontend as the default
frontend.  The udeb will also provide the virtual package
debconf-frontend.

When main-menu detects that a package implementing debconf-udeb, it
will exit, knowing that init will restart main-menu using
/sbin/debian-installer.  We should change rootskel to only set
debconf/frontend the first time it is executed (instead of setting
DEBIAN_FRONTEND).  This will make sure the new default frontend is
used when main-menu is started again after it exited because a new
debconf-frontend was selected.

Here is a patch for main-menu to get it to exit on command.  We might
want to change 'debconf-frontend' to something more generic, like
'exit-main-menu'.

Index: main-menu.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/main-menu/main-menu.c,v
retrieving revision 1.60
diff -u -3 -p -u -r1.60 main-menu.c
--- main-menu.c 22 Jan 2003 11:23:29 -0000      1.60
+++ main-menu.c 10 Mar 2003 21:50:04 -0000
@@ -376,6 +376,15 @@ static void update_language (void) {
        debconfclient_delete(debconf);
 }

+static int
+is_package_providing(struct package_t p, const char *name)
+{
+       for (i = 0; p->provides[i] != NULL; i++)
+               if (strcmp(p->provides[i]->name, name) == 0) {
+                 return 1; /* TRUE */
+               }
+}
+
 int main (int argc, char **argv) {
        struct package_t *p;
        int i;
@@ -394,11 +403,17 @@ int main (int argc, char **argv) {
                 * package 'language-selected'.
                 * The LANGUAGE environment variable must be updated
                 */
-               for (i = 0; p->provides[i] != NULL; i++)
-                       if (strcmp(p->provides[i]->name, "language-selected") == 0) {
-                               update_language();
-                               break;
-                       }
+               if (is_package_providing(p, "language-selected")) {
+                       update_language();
+
+               /*
+                * A new frontend package might change the default /
+                * current frontend.  Exit main-menu to let it restart
+                * from init with the new frontend.
+                */
+               if (is_package_providing(p, "debconf-frontend")) {
+                       return (0);
+
                di_list_free(packages, di_pkg_free);
                packages = status_read();
        }



Reply to: