commit yast2-bootloader for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-bootloader for openSUSE:Factory checked in at Fri Jul 24 17:33:48 CEST 2009. -------- --- yast2-bootloader/yast2-bootloader.changes 2009-07-22 13:49:55.000000000 +0200 +++ yast2-bootloader/yast2-bootloader.changes 2009-07-24 17:06:34.000000000 +0200 @@ -1,0 +2,6 @@ +Fri Jul 24 14:54:16 CEST 2009 - juhliarik@suse.cz + +- added support for encrypted disk (fate#305633) +- 2.18.10 + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- yast2-bootloader-2.18.9.tar.bz2 New: ---- yast2-bootloader-2.18.10.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-bootloader.spec ++++++ --- /var/tmp/diff_new_pack.ICcxf3/_old 2009-07-24 17:24:54.000000000 +0200 +++ /var/tmp/diff_new_pack.ICcxf3/_new 2009-07-24 17:24:54.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package yast2-bootloader (Version 2.18.9) +# spec file for package yast2-bootloader (Version 2.18.10) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,10 +19,10 @@ Name: yast2-bootloader -Version: 2.18.9 +Version: 2.18.10 Release: 1 BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-bootloader-2.18.9.tar.bz2 +Source0: yast2-bootloader-2.18.10.tar.bz2 Prefix: /usr Group: System/YaST License: GPL v2 or later @@ -61,7 +61,7 @@ This package contains the YaST2 component for bootloader configuration. %prep -%setup -n yast2-bootloader-2.18.9 +%setup -n yast2-bootloader-2.18.10 %build %{prefix}/bin/y2tool y2autoconf ++++++ yast2-bootloader-2.18.9.tar.bz2 -> yast2-bootloader-2.18.10.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/VERSION new/yast2-bootloader-2.18.10/VERSION --- old/yast2-bootloader-2.18.9/VERSION 2009-07-20 16:56:59.000000000 +0200 +++ new/yast2-bootloader-2.18.10/VERSION 2009-07-24 14:55:00.000000000 +0200 @@ -1 +1 @@ -2.18.9 +2.18.10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/clients/bootloader_proposal.ycp new/yast2-bootloader-2.18.10/src/clients/bootloader_proposal.ycp --- old/yast2-bootloader-2.18.9/src/clients/bootloader_proposal.ycp 2009-07-09 12:42:20.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/clients/bootloader_proposal.ycp 2009-07-22 13:39:48.000000000 +0200 @@ -1,7 +1,7 @@ /** * Module: bootloader_proposal.ycp * - * $Id: bootloader_proposal.ycp 57241 2009-05-18 15:46:56Z juhliarik $ + * $Id: bootloader_proposal.ycp 58126 2009-07-22 11:39:44Z juhliarik $ * * Author: Klaus Kaempf <kkaempf@suse.de> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/grub/misc.ycp new/yast2-bootloader-2.18.10/src/grub/misc.ycp --- old/yast2-bootloader-2.18.9/src/grub/misc.ycp 2009-07-20 14:15:26.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/grub/misc.ycp 2009-07-22 13:39:48.000000000 +0200 @@ -12,7 +12,7 @@ * Jiri Srain <jsrain@suse.cz> * Olaf Dabrunz <od@suse.de> * - * $Id: misc.ycp 57241 2009-05-18 15:46:56Z juhliarik $ + * $Id: misc.ycp 58126 2009-07-22 11:39:44Z juhliarik $ * */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/modules/BootCommon.ycp new/yast2-bootloader-2.18.10/src/modules/BootCommon.ycp --- old/yast2-bootloader-2.18.9/src/modules/BootCommon.ycp 2009-06-26 11:18:15.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/modules/BootCommon.ycp 2009-07-24 15:21:35.000000000 +0200 @@ -76,6 +76,11 @@ global integer cached_settings_base_data_change_time = nil; +/** FATE#305633: Support installation with encrypted root file system + * Add root_luks to /etc/sysconfig/initrd + */ + +global boolean add_luks_to_initrd = false; /** * device to save loader stage 1 to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/modules/BootGRUB.ycp new/yast2-bootloader-2.18.10/src/modules/BootGRUB.ycp --- old/yast2-bootloader-2.18.9/src/modules/BootGRUB.ycp 2009-07-10 13:32:17.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/modules/BootGRUB.ycp 2009-07-22 13:39:48.000000000 +0200 @@ -15,7 +15,7 @@ * Olaf Dabrunz <od@suse.de> * Philipp Thomas <pth@suse.de> * - * $Id: BootGRUB.ycp 57310 2009-05-25 14:24:53Z jreidinger $ + * $Id: BootGRUB.ycp 58126 2009-07-22 11:39:44Z juhliarik $ * */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/modules/Bootloader.ycp new/yast2-bootloader-2.18.10/src/modules/Bootloader.ycp --- old/yast2-bootloader-2.18.9/src/modules/Bootloader.ycp 2009-06-26 11:18:15.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/modules/Bootloader.ycp 2009-07-24 15:25:27.000000000 +0200 @@ -50,6 +50,7 @@ global define boolean Write (); global define boolean FlagOnetimeBoot (string section); + boolean Write_root_luks_to_initrd(); // additional interfaces, mostly for other modules global define void ReadOrProposeIfNeeded (); @@ -282,6 +283,10 @@ y2milestone ("unfiltered target map: %1", (map<string,map>)Storage::GetTargetMap()); BootCommon::UpdateInstallationKernelParameters (); blPropose (); + + // FATE#305633: Support installation with encrypted root file system + // adding luks_root for all image sections + BootCommon::sections = BootCommon::CheckAdding_luks_root(BootCommon::sections); BootCommon::was_proposed = true; BootCommon::changed = true; BootCommon::location_changed = true; @@ -444,6 +449,10 @@ Progress::Title (titles[0]:""); } + // update initrd conf file if it is necessary + // adding root_luks to /etc/sysconfig/initrd + Write_root_luks_to_initrd(); + map<string,any> params_to_save = $[]; string new_vga = getKernelParam (getDefaultSection (), "vgamode"); @@ -623,6 +632,10 @@ Initrd::changed = true; } + // update initrd conf file if it is necessary + // adding root_luks to /etc/sysconfig/initrd + Write_root_luks_to_initrd(); + map<string,any> params_to_save = $[]; string new_vga = getKernelParam (getDefaultSection (), "vgamode"); @@ -1484,4 +1497,52 @@ return true; } +/** FATE#305633: Support installation with encrypted root file system + * Update conf file for initrd + * + * + */ + + +boolean Write_root_luks_to_initrd() +{ + if (!BootCommon::add_luks_to_initrd) + { + y2milestone("Skip adding root_luks to initrd conf file"); + return false; + } + string conf_initrd = "/etc/sysconfig/initrd"; + string tmp_content = ""; + string content_luks_initrd = "root_luks=1\nluks=root\n"; + string cmd = sformat("ls '%1' 2>/dev/null |tr -d '\n'", conf_initrd); + y2milestone("Checking existing initrd conf file via command %1", cmd); + map out = (map)SCR::Execute(.target.bash_output, cmd); + if (out["stdout"]:"" == conf_initrd) + { + tmp_content = (string) SCR::Read(.target.string, conf_initrd); + y2milestone("content of initrd conf file: %1", tmp_content); + if ((search(tmp_content, "root_luks=1") != nil) && (search(tmp_content, "luks=root") != nil)) + { + y2milestone("skip adding: %1 to %2", content_luks_initrd, conf_initrd); + } else { + cmd = sformat("echo '%1' >> %2", content_luks_initrd, conf_initrd); + y2milestone("Adding root_luks via command %1", cmd); + out = (map)SCR::Execute(.target.bash_output, cmd); + y2error("%1",out); + if (out["exit"]:-1 == 0) + y2milestone("Adding root_luks to initrd conf file done successful"); + else { + y2error("Adding root_luks to initrd failed"); + return false; + } + } + } else { + integer last=findlastof(conf_initrd,"/"); + string path_file = substring (conf_initrd, 0, last); + SCR::Execute(.target.mkdir, path_file); + SCR::Write(.target.string, conf_initrd, content_luks_initrd); + } + return true; +} + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/routines/helps.ycp new/yast2-bootloader-2.18.10/src/routines/helps.ycp --- old/yast2-bootloader-2.18.9/src/routines/helps.ycp 2009-07-20 14:39:57.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/routines/helps.ycp 2009-07-22 13:39:48.000000000 +0200 @@ -11,7 +11,7 @@ * Authors: * Jiri Srain <jsrain@suse.cz> * - * $Id: helps.ycp 56563 2009-04-02 08:41:25Z jreidinger $ + * $Id: helps.ycp 58126 2009-07-22 11:39:44Z juhliarik $ * */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-2.18.9/src/routines/misc.ycp new/yast2-bootloader-2.18.10/src/routines/misc.ycp --- old/yast2-bootloader-2.18.9/src/routines/misc.ycp 2009-04-28 16:39:08.000000000 +0200 +++ new/yast2-bootloader-2.18.10/src/routines/misc.ycp 2009-07-24 15:25:17.000000000 +0200 @@ -1712,7 +1712,167 @@ return ret; } +/** FATE#305633: Support installation with encrypted root file system + * Delete luks_root if it is necessary + * + * @param string section append + * @return string updated append + */ +string delete_luks_root (string append) +{ + string new_append = append; + if (search(append, "luks_root") != nil) + { + list <string> list_append = splitstring(append, " "); + list <string> list_new_append = []; + foreach(string item, list_append, + { + if (search(item, "luks_root") == nil) + list_new_append = add(list_new_append, item); + }); + new_append = mergestring(list_new_append, " "); + } + return new_append; +} + +/** FATE#305633: Support installation with encrypted root file system + * Function parse append string and delete or add luks_root devices + * + * @param string section append + * @param list <string> luks partitions + * @return string updated append + */ + +string luks_append (string old_append, list <string> luks_partitions) +{ + string new_append = ""; + list <string> list_new_append = []; + list <string> result_devices = []; + if (size(luks_partitions) == 0) + { + y2milestone("skip adding luks_root -> not encrypted partitions"); + new_append = delete_luks_root(old_append); + return new_append; + } + if (search(old_append, "luks_root") == nil) + { + new_append = old_append + " luks_root=" + mergestring(luks_partitions, ","); + y2milestone("updated append: %1", new_append); + add_luks_to_initrd = true; + return new_append; + } else { + list <string> list_append = splitstring(old_append, " "); + string luks = ""; + foreach(string item, list_append, + { + if (search(item, "luks_root") != nil) + luks = item; + else + list_new_append = add(list_new_append, item); + }); + y2milestone("previous luks_root: %1", luks); + if (size(luks_partitions) > 0) + { + string new_luks_root = "luks_root=" + mergestring(luks_partitions,","); + y2milestone("new luks_root: %1", new_luks_root); + list_new_append = add(list_new_append, new_luks_root); + } + + new_append = mergestring(list_new_append, " "); + } + y2milestone("updated append: %1", new_append); + add_luks_to_initrd = true; + return new_append; +} + +/** FATE#305633: Support installation with encrypted root file system + * Update append of boot section from boot section + * + * @param map<string,any> boot section which should be udpated + * @param map<string,map> target map from storage + * @return string updated append (with luks_root or with deleted luks_root) + */ + +string add_delete_luks_root (map<string,any> section, map<string,map> tm) +{ + string root_disk = ""; + map p_dev = $[]; + string old_append = section["append"]:""; + string new_append = ""; + string s_root = section["root"]:""; + string s_disk = ""; + list <string> luks_devices = []; + if (s_root != "") + { + // try to find disk of partition + p_dev = Storage::GetDiskPartition(s_root); + y2milestone("GetDiskPartition with root: %1 is: %2", s_root, p_dev); + s_disk = p_dev["disk"]:""; + y2milestone("Disk is: %1", s_disk); + map p_device = tm[s_disk]:$[]; + // check if it is LVM disk + if (p_device["type"]:nil == `CT_LVM) + { + // add all physical partitions from LVM + list <string> lvm_partitions = (list <string>) p_device["devices_add"]:[]; + y2milestone("physical partitions which create LVM: %1", lvm_partitions); + foreach(string p, lvm_partitions, + { + p_dev = Storage::GetDiskPartition(p); + s_disk = p_dev["disk"]:""; + map tmp_device = tm[s_disk]:$[]; + foreach(map tmp_p, tmp_device["partitions"]:[], + { + if ((tmp_p["device"]:"" == p) && (tmp_p["enc_type"]:nil == `luks)) + luks_devices = add(luks_devices, p); + }); + }); + y2milestone("luks_devices: %1", luks_devices); + new_append = luks_append(old_append, luks_devices); + return new_append; + } else { + y2milestone("skip adding luks_root -> \"root\" is not on LVM"); + new_append = delete_luks_root(old_append); + return new_append; + } + } else { + y2milestone("skip adding luks_root -> \"root\" missing"); + new_append = delete_luks_root(old_append); + return new_append; + } + y2error("skip adding luks_root -> unknown error"); + new_append = delete_luks_root(old_append); + return new_append; +} + + +/** FATE#305633: Support installation with encrypted root file system + * Function check sections and add luks_root if it is necessary + * + * @param list of sections list <map <string any> > + * @return updated list of section list <map <string any> > + */ + +global list<map<string,any> > CheckAdding_luks_root (list<map<string,any> > bl_sections) +{ + map<string,map> tm = (map<string,map>)Storage::GetTargetMap(); + list<map<string,any> > update_bl_sections = []; + map <string, any> updated_section = $[]; + foreach ( map <string, any> s, bl_sections, + { + if (s["type"]:nil == "image") + { + updated_section = s; + updated_section["append"] = add_delete_luks_root(s,tm); + update_bl_sections = add(update_bl_sections, updated_section); + } else { + update_bl_sections = add(update_bl_sections, s); + } + }); + + return update_bl_sections; +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de