[yast-commit] r59589 - in /branches/SuSE-Code-11-SP1-Branch/bootloader: VERSION package/yast2-bootloader.changes src/clients/Makefile.am src/clients/bootloader_preupdate.ycp src/modules/BootGRUB.ycp
Author: juhliarik Date: Wed Nov 18 16:31:00 2009 New Revision: 59589 URL: http://svn.opensuse.org/viewcvs/yast?rev=59589&view=rev Log: added fix for updating device.map Added: branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/bootloader_preupdate.ycp Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/Makefile.am branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION?rev=59589&r1=59588&r2=59589&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION (original) +++ branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION Wed Nov 18 16:31:00 2009 @@ -1 +1 @@ -2.17.60 +2.17.61 Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes?rev=59589&r1=59588&r2=59589&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes (original) +++ branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes Wed Nov 18 16:31:00 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Nov 18 16:18:57 CET 2009 - juhliarik@suse.cz + +- added fix for updating device.map (bnc#477778) +- 2.17.61 + +------------------------------------------------------------------- Mon May 18 17:26:50 CEST 2009 - juhliarik@suse.cz - added fix for checking soft-raid devices in device.map Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/Makefile.am?rev=59589&r1=59588&r2=59589&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/Makefile.am (original) +++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/Makefile.am Wed Nov 18 16:31:00 2009 @@ -9,7 +9,8 @@ bootloader_finish.ycp \ print-product.ycp \ inst_bootloader.ycp \ - inst_lilo_convert.ycp + inst_lilo_convert.ycp \ + bootloader_preupdate.ycp EXTRA_DIST = \ $(client_DATA) Added: branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/bootloader_preupdate.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/bootloader_preupdate.ycp?rev=59589&view=auto ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/bootloader_preupdate.ycp (added) +++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/clients/bootloader_preupdate.ycp Wed Nov 18 16:31:00 2009 @@ -0,0 +1,131 @@ +/** + * File: + * bootloader/routines/bootloader_preupdate.ycp + * + * Module: + * Bootloader installation and configuration + * + * Summary: + * Client for handling pre-update bootloader configuration + * + * Authors: + * Jozef Uhliarik <juhliarik@suse.cz> + * + * + */ + +{ + +textdomain "bootloader"; + + +import "BootCommon"; +import "Installation"; +import "GetInstArgs"; +import "Mode"; +import "Arch"; +import "BootGRUB"; +import "Storage"; + +y2milestone ("starting bootloader_preupdate"); + +boolean preUpdateDeviceMap() +{ + boolean ret = false; + string device_map = (string) WFM::Read(.local.string, Installation::destdir +"/boot/grub/device.map"); + if (device_map == nil) + { + y2error("Reading device map failed."); + return false; + } + y2milestone("Device map: %1", device_map); + + BootCommon::InitializeLibrary(true, "grub"); + BootCommon::setLoaderType("grub"); + map<string,string> new_files = $[]; + new_files["/boot/grub/device.map"] = device_map; + ret = BootCommon::SetFilesContents (new_files); + if (!ret) + { + y2error("SetFilesContents failed."); + return false; + } + BootCommon::device_mapping = BootCommon::GetDeviceMap (); + + if ((BootCommon::device_mapping == nil) || (size(BootCommon::device_mapping) == 0)) + { + y2error("Parsing device map failed or it is empty."); + return false; + } + BootCommon::UpdateDeviceMap(); + + ret = BootCommon::SetDeviceMap(BootCommon::device_mapping); + if (!ret) + { + y2error("Set device map failed."); + return false; + } + + new_files = BootCommon::GetFilesContents(); + y2milestone("new content file: %1", new_files); + + string content_dev_map = new_files["/boot/grub/device.map"]:nil; + + if ((content_dev_map != nil ) && (content_dev_map != "")) + { + y2milestone("writing device map: %1", content_dev_map); + WFM::Write(.local.string, Installation::destdir +"/boot/grub/device.map", + content_dev_map); + } + + return ret; +} + + +if ( GetInstArgs::going_back()) // going backwards? +{ + return `auto; // don't execute this once more +} + +if (Mode::update() && (Arch::x86_64() || Arch::i386())) +{ + + // 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)); + + any ret = nil; + if (bl == "grub") { + + y2milestone("updating device map..."); + if (preUpdateDeviceMap()) + { + y2milestone("Update device map is done successful"); + BootGRUB::update_device_map_done = true; + } else { + y2error("Update device map failed"); + BootGRUB::update_device_map_done = false; + } + + y2milestone("Calling storage update"); + Storage::Update (Installation::installedVersion, Installation::updateVersion); + } + + if (ret == `back) + return `back; + + if (ret == `next) + return `next; + +} + +y2milestone ("finish bootloader_preupdate"); + +return `auto; + +} Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp?rev=59589&r1=59588&r2=59589&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp Wed Nov 18 16:31:00 2009 @@ -45,6 +45,16 @@ */ global boolean insert_saved_mbr = false; + +/** + * The variable indicate if client bootloader_preupdate + * successful update device map + * If success true else false + */ + +global boolean update_device_map_done = false; + + // variables for temporary data /** @@ -714,7 +724,14 @@ * Update read settings to new version of configuration files */ global define void Update () { - BootCommon::UpdateDeviceMap (); + // update device map would be done in bootloader_preupdate + // run update device only if it was not called or if update device + // failed in bootloader_preupdate + if (!update_device_map_done) + { + BootCommon::UpdateDeviceMap (); + update_device_map_done = true; + } // During update, for libata device name migration ("/dev/hda1" -> // "/dev/sda1") and somesuch, we need to re-read and parse the rest of the -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
juhliarik@svn.opensuse.org