Author: juhliarik Date: Mon Sep 29 17:10:19 2008 New Revision: 51672
URL: http://svn.opensuse.org/viewcvs/yast?rev=51672&view=rev Log: added new dialog during update from lilo
A bootloader/src/clients/inst_lilo_convert.ycp M bootloader/src/clients/Makefile.am M bootloader/src/routines/section_widgets.ycp M bootloader/yast2-bootloader.spec.in
Added: trunk/bootloader/src/clients/inst_lilo_convert.ycp Modified: trunk/bootloader/src/clients/Makefile.am trunk/bootloader/src/routines/section_widgets.ycp trunk/bootloader/yast2-bootloader.spec.in
Modified: trunk/bootloader/src/clients/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/Makefile.a... ============================================================================== --- trunk/bootloader/src/clients/Makefile.am (original) +++ trunk/bootloader/src/clients/Makefile.am Mon Sep 29 17:10:19 2008 @@ -8,7 +8,8 @@ bootloader_proposal.ycp \ bootloader_finish.ycp \ print-product.ycp \ - inst_bootloader.ycp + inst_bootloader.ycp \ + inst_lilo_convert.ycp
EXTRA_DIST = \ $(client_DATA)
Added: trunk/bootloader/src/clients/inst_lilo_convert.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/inst_lilo_... ============================================================================== --- trunk/bootloader/src/clients/inst_lilo_convert.ycp (added) +++ trunk/bootloader/src/clients/inst_lilo_convert.ycp Mon Sep 29 17:10:19 2008 @@ -0,0 +1,151 @@ +/** + * File: + * bootloader/routines/inst_bootloader.ycp + * + * Module: + * Bootloader installation and configuration + * + * Summary: + * Functions to write "dummy" config files for kernel + * + * Authors: + * Jozef Uhliarik juhliarik@suse.cz + * + * + */ + +{ + +textdomain "bootloader"; + +import "Bootloader"; +import "BootCommon"; +import "Installation"; +import "GetInstArgs"; +import "Mode"; +import "Label"; +import "Wizard"; +import "Popup"; +import "Pkg"; + +y2milestone ("starting inst_lilo_convert"); + + + + + +void selectPackage() +{ + if (! Pkg::IsSelected("grub")) + { + Pkg::PkgInstall ("grub"); + Pkg::PkgSolve (false); + } +} + +void convertSettings() +{ + + string lilo_conf = (string) WFM::Read(.local.string, Installation::destdir + "/etc/lilo.conf"); + BootCommon::setLoaderType("lilo"); + map<string,string> new_files = $[]; + new_files["/etc/lilo.conf"] = lilo_conf; + y2milestone("/etc/lilo.conf : %1", new_files); + BootCommon::ProposeDeviceMap (); + BootCommon::SetDeviceMap(BootCommon::device_mapping); + map<string,string> old_files = BootCommon::GetFilesContents (); + new_files["/boot/grub/device.map"] = old_files["/boot/grub/device.map"]:""; + y2milestone("added device.map : %1", new_files); + BootCommon::SetFilesContents (new_files); + BootCommon::setLoaderType("grub"); + + map<string,string> tmp_files = BootCommon::GetFilesContents (); + + foreach (string file, string content, tmp_files, + { + + integer last=findlastof(file,"/"); + string path_file = substring (file, 0, last); + WFM::Execute(.local.mkdir, Installation::destdir + path_file); + y2milestone ("writing file: %1", file); + WFM::Write(.local.string, Installation::destdir + file, content); + }); +} + + + + +if ( GetInstArgs::going_back()) // going backwards? +{ + return `auto; // don't execute this once more +} + +if (Mode::update()) +{ + + // save some sysconfig variables + // register new agent pointing into the mounted filesystem + path sys_agent = .target.sysconfig.bootloader; + + string target_sysconfig_path = Installation::destdir + "/etc/sysconfig/bootloader"; + SCR::RegisterAgent (.target.sysconfig.bootloader, `ag_ini(`SysConfigFile(target_sysconfig_path))); + + string bl = (string) SCR::Read(add(sys_agent,.LOADER_TYPE)); + + term convert_question = `VBox( + `HBox ( + `HStretch(), + `RadioButtonGroup(`id(`convert), + `HSquash ( + `VBox(`Left(`Label("LILO is not supported. The recommended option is select convert LILO to GRUB")), + `Left(`Label("Do you want convert settings and install GRUB?")), + `Left(`RadioButton(`id("lilo"), _("Stay LILO"))), + `Left(`RadioButton(`id("grub"), _("Convert Settings and Install GRUB"), true )) + ) + ) + ), + `HStretch() + ) + ); + any ret = nil; + if (bl == "lilo") + { + Wizard::CreateDialog(); + Wizard::SetDesktopIcon("bootloader"); + Wizard::SetContentsButtons("Converting LILO to GRUB", convert_question, + _("LILO is not supported. The recommended option is select convert LILO to GRUB"), + Label::BackButton(), Label::NextButton()); + UI::ChangeWidget(`id(`abort),`Label, Label::CancelButton()); + UI::ChangeWidget(`id(`abort), `Enabled, false); + + while (true) + { + ret = UI::UserInput(); + string current = (string) UI::QueryWidget(`id(`convert), `CurrentButton); + // One of those dialog buttons have been pressed + if (ret == `next) + { + selectPackage(); + convertSettings(); + SCR::Write (add(sys_agent,.LOADER_TYPE), "grub"); + SCR::Write (sys_agent, nil); + } + break; + + } + UI::CloseDialog(); + } + + if (ret == `back) + return `back; + + if (ret == `next) + return `next; + +} + +y2milestone ("finish inst_lilo_convert"); + +return `auto; + +}
Modified: trunk/bootloader/src/routines/section_widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/section_w... ============================================================================== --- trunk/bootloader/src/routines/section_widgets.ycp (original) +++ trunk/bootloader/src/routines/section_widgets.ycp Mon Sep 29 17:10:19 2008 @@ -318,7 +318,9 @@ else { BootCommon::current_section["name"] = ""; - BootCommon::current_section["original_name"] = ""; + // FIXME: the problem with missing YaST commnet in menu.lst + // it seems be correct if original_name stay same... + // BootCommon::current_section["original_name"] = ""; BootCommon::current_section["__auto"] = false; BootCommon::current_section["lines_cache_id"] = ""; }
Modified: trunk/bootloader/yast2-bootloader.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/yast2-bootloader.spec.... ============================================================================== --- trunk/bootloader/yast2-bootloader.spec.in (original) +++ trunk/bootloader/yast2-bootloader.spec.in Mon Sep 29 17:10:19 2008 @@ -57,6 +57,7 @@ @clientdir@/bootloader*.ycp @clientdir@/print-product.ycp @clientdir@/inst_bootl*.ycp +@clientdir@/inst_lilo_convert.ycp @ybindir@/* @agentdir@/ag_* @scrconfdir@/*.scr
yast-commit@lists.opensuse.org