From 45f1a023bf147d6e0113df5730784d807a5d0064 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 5 Jul 2007 14:26:04 +0000 Subject: use Flash rescue entries if flash=rescue or flash=upgrade is present on command line --- mdk-stage1/rescue-gui.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/rescue-gui.c b/mdk-stage1/rescue-gui.c index 77113354b..f0b156fb5 100644 --- a/mdk-stage1/rescue-gui.c +++ b/mdk-stage1/rescue-gui.c @@ -31,6 +31,7 @@ #include "config-stage1.h" #include "frontend.h" #include "utils.h" +#include "params.h" #if defined(__i386__) || defined(__x86_64__) #define ENABLE_RESCUE_MS_BOOT 1 @@ -174,13 +175,35 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) char reboot_[] = "Reboot"; char doc[] = "Doc: what's addressed by this Rescue?"; - char * actions[] = { install_bootloader, + char upgrade[] = "Upgrade to New Version"; + char rootpass[] = "Reset Root Password"; + char userpass[] = "Reset User Password"; + char factory[] = "Reset to Factory Defaults"; + char backup[] = "Backup User Files"; + char restore[] = "Restore User Files from Backup"; + char badblocks[] = "Test Key for Badblocks"; + + char * actions_default[] = { install_bootloader, #if ENABLE_RESCUE_MS_BOOT - restore_ms_boot, + restore_ms_boot, #endif - mount_parts, go_to_console, reboot_, doc, NULL }; + mount_parts, go_to_console, reboot_, doc, NULL }; + char * actions_flash_rescue[] = { rootpass, userpass, factory, backup, restore, + badblocks, reboot_, NULL }; + char * actions_flash_upgrade[] = { upgrade, rootpass, userpass, factory, backup, restore, + badblocks, reboot_, NULL }; + + + char * flash_mode; + char ** actions; char * choice; + process_cmdline(); + flash_mode = get_param_valued("flash"); + actions = !flash_mode ? + actions_default : + streq(flash_mode, "upgrade") ? actions_flash_upgrade : actions_flash_rescue; + init_frontend("Welcome to " DISTRIB_NAME " Rescue (" DISTRIB_VERSION ") " __DATE__ " " __TIME__); do { @@ -215,6 +238,29 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) binary = "/usr/bin/rescue-doc"; } + /* Mandriva Flash entries */ + if (ptr_begins_static_str(choice, rootpass)) { + binary = "/usr/bin/reset_rootpass"; + } + if (ptr_begins_static_str(choice, userpass)) { + binary = "/usr/bin/reset_userpass"; + } + if (ptr_begins_static_str(choice, factory)) { + binary = "/usr/bin/clear_systemloop"; + } + if (ptr_begins_static_str(choice, backup)) { + binary = "/usr/bin/backup_systemloop"; + } + if (ptr_begins_static_str(choice, restore)) { + binary = "/usr/bin/restore_systemloop"; + } + if (ptr_begins_static_str(choice, badblocks)) { + binary = "/usr/bin/test_badblocks"; + } + if (ptr_begins_static_str(choice, upgrade)) { + binary = "/usr/bin/upgrade"; + } + if (binary) { int wait_status; suspend_to_console(); -- cgit v1.2.1