Browse Source

Add support to exit the installer using di-utils-exit-installer.

r59203
keep-around/c8703c509368e1805e513d61f98a9d17d2cdd9cc
Otavio Salvador 14 years ago
parent
commit
16c7bd617a
  1. 6
      debian/changelog
  2. 12
      main-menu.c
  3. 1
      main-menu.h

6
debian/changelog

@ -1,3 +1,9 @@
main-menu (1.30) UNRELEASED; urgency=low
* Add support to exit the installer using di-utils-exit-installer.
-- Otavio Salvador <otavio@ossystems.com.br> Wed, 01 Jul 2009 15:37:31 -0300
main-menu (1.29) unstable; urgency=low
[ Frans Pop ]

12
main-menu.c

@ -620,7 +620,7 @@ int main (int argc __attribute__ ((unused)), char **argv) {
di_system_package *p;
di_packages *packages;
di_packages_allocator *allocator;
int ret;
int ret, exit_loop;
debconf = debconfclient_new();
di_system_init(basename(argv[0]));
@ -642,9 +642,10 @@ int main (int argc __attribute__ ((unused)), char **argv) {
seen_items = di_hash_table_new_full(di_rstring_hash, di_rstring_equal,
seen_items_key_destroy, NULL);
exit_loop = 0;
allocator = di_system_packages_allocator_alloc ();
packages = di_system_packages_status_read_file(DI_SYSTEM_DPKG_STATUSFILE, allocator);
while ((p=show_main_menu(packages, allocator))) {
while (!exit_loop && (p=show_main_menu(packages, allocator))) {
di_slist_node *node;
if (p->installer_menu_item < NEVERDEFAULT && display_menu) {
@ -668,6 +669,10 @@ int main (int argc __attribute__ ((unused)), char **argv) {
di_log(DI_LOG_LEVEL_INFO, "Menu item '%s' succeeded but requested to be left unconfigured.", p->p.package);
display_menu = 1;
break;
case EXIT_INSTALLER:
/* Interrupt the loop and exit properly */
exit_loop = 1;
break;
default:
di_log(DI_LOG_LEVEL_WARNING, "Menu item '%s' failed.", p->p.package);
notify_user_of_failure(p);
@ -693,7 +698,7 @@ int main (int argc __attribute__ ((unused)), char **argv) {
debconf->command(debconf, "X_SAVE", NULL);
}
return EXIT_FAILURE;
return exit_loop != 0 ? EXIT_OK : EXIT_FAILURE;
}
int di_config_package_depth=0;
@ -753,6 +758,7 @@ static int di_config_package(di_system_package *p,
free(configcommand);
switch (ret) {
case EXIT_OK:
case EXIT_INSTALLER:
p->p.status = di_package_status_installed;
break;
default:

1
main-menu.h

@ -22,6 +22,7 @@ enum
{
EXIT_OK = 0,
EXIT_BACKUP = 10,
EXIT_INSTALLER = 11,
};
/* Priority at which the menu is displayed */

Loading…
Cancel
Save