Hello community,
here is the log from the commit of package yast2-bootloader
checked in at Sat Apr 22 01:40:56 CEST 2006.
--------
--- yast2-bootloader/yast2-bootloader.changes 2006-04-20 13:54:34.000000000 +0200
+++ STABLE/yast2-bootloader/yast2-bootloader.changes 2006-04-21 19:24:55.000000000 +0200
@@ -1,0 +2,12 @@
+Fri Apr 21 19:23:12 CEST 2006 - od@suse.de
+
+- (#148931, #164950), fixes features #300383, #300160, #300358:
+ - for root partitions in bootloader config: automatically use mount
+ by id, path, uuid and label as set up in yast2-storage
+ - also display these as "hints" in the UI
+- fixed some comments
+- added a y2milestone in getPartitionList()
+- fixed some whitespace
+- 2.13.50
+
+-------------------------------------------------------------------
Old:
----
yast2-bootloader-2.13.49.tar.bz2
New:
----
yast2-bootloader-2.13.50.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.qcTbvr/_old 2006-04-22 01:40:04.000000000 +0200
+++ /var/tmp/diff_new_pack.qcTbvr/_new 2006-04-22 01:40:04.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-bootloader (Version 2.13.49)
+# spec file for package yast2-bootloader (Version 2.13.50)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-bootloader
-Version: 2.13.49
+Version: 2.13.50
Release: 1
License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-bootloader-2.13.49.tar.bz2
+Source0: yast2-bootloader-2.13.50.tar.bz2
prefix: /usr
BuildRequires: docbook-xsl-stylesheets doxygen gcc-c++ libxslt limal-bootloader limal-devel perl-XML-Writer perl-gettext sgml-skel swig update-alternatives update-desktop-files yast2-devel yast2-devtools yast2-installation yast2-perl-bindings yast2-testsuite
PreReq: /bin/sed %fillup_prereq
@@ -60,7 +60,7 @@
Dan Meszaros
%prep
-%setup -n yast2-bootloader-2.13.49
+%setup -n yast2-bootloader-2.13.50
%build
%{prefix}/bin/y2tool y2autoconf
@@ -111,6 +111,15 @@
/usr/share/YaST2/clients/bootfloppy.ycp
%changelog -n yast2-bootloader
+* Fri Apr 21 2006 - od@suse.de
+- (#148931, #164950), fixes features #300383, #300160, #300358:
+- for root partitions in bootloader config: automatically use mount
+ by id, path, uuid and label as set up in yast2-storage
+- also display these as "hints" in the UI
+- fixed some comments
+- added a y2milestone in getPartitionList()
+- fixed some whitespace
+- 2.13.50
* Thu Apr 20 2006 - od@suse.de
- using /sbin/activate again (#167602)
- do not accept fsid 257 (on pmac) anymore, Apple_Bootstrap is now
++++++ yast2-bootloader-2.13.49.tar.bz2 -> yast2-bootloader-2.13.50.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-bootloader-2.13.49/VERSION new/yast2-bootloader-2.13.50/VERSION
--- old/yast2-bootloader-2.13.49/VERSION 2006-04-20 13:49:42.000000000 +0200
+++ new/yast2-bootloader-2.13.50/VERSION 2006-04-21 19:22:58.000000000 +0200
@@ -1 +1 @@
-2.13.49
+2.13.50
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-bootloader-2.13.49/src/modules/BootCommon.ycp new/yast2-bootloader-2.13.50/src/modules/BootCommon.ycp
--- old/yast2-bootloader-2.13.49/src/modules/BootCommon.ycp 2006-04-11 16:34:58.000000000 +0200
+++ new/yast2-bootloader-2.13.50/src/modules/BootCommon.ycp 2006-04-21 19:22:47.000000000 +0200
@@ -14,7 +14,7 @@
* Jiri Srain
* Joachim Plack
*
- * $Id: BootCommon.ycp 29960 2006-04-10 18:37:22Z jplack $
+ * $Id: BootCommon.ycp 30358 2006-04-21 17:22:43Z odabrunz $
*
*/
@@ -78,7 +78,7 @@
-/* These global variables and functions is needed in included files */
+/* These global variables and functions are needed in included files */
/**
* string sepresenting device name of /boot partition
@@ -466,6 +466,14 @@
read_default_section_name = s["name"]:"";
}
});
+
+ // convert root device names in sections to kernel device names, if
+ // possible
+ sections = maplist (map s, sections, {
+ s["root"] = BootCommon::MountByDev2Dev(s["root"]:"");
+ return s;
+ });
+
return true;
}
@@ -499,7 +507,7 @@
* Save all bootloader configuration files to the cache of the PlugLib
* PlugLib must be initialized properly !!!
* @param clean boolean true if settings should be cleaned up (checking their
- * correctness, supposing all files are on the disk
+ * correctness, supposing all files are on the disk)
* @param init boolean true to init the library
* @param flush boolean true to flush settings to the disk
* @return boolean true if success
@@ -523,6 +531,14 @@
return (map)
filter (string k, any v, s, { return is (v, string); });
});
+
+ // convert root device names in sections to the device names indicated by
+ // "mountby"
+ sects = maplist (map s, sects, {
+ s["root"] = BootCommon::Dev2MountByDev(s["root"]:"");
+ return s;
+ });
+
ret = ret && SetDeviceMap (device_mapping);
ret = ret && SetSections (sects);
ret = ret && SetGlobal (globals);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-bootloader-2.13.49/src/routines/global_widgets.ycp new/yast2-bootloader-2.13.50/src/routines/global_widgets.ycp
--- old/yast2-bootloader-2.13.49/src/routines/global_widgets.ycp 2006-02-13 04:52:14.000000000 +0100
+++ new/yast2-bootloader-2.13.50/src/routines/global_widgets.ycp 2006-04-21 19:22:47.000000000 +0200
@@ -11,7 +11,7 @@
* Authors:
* Jiri Srain
*
- * $Id: global_widgets.ycp 27748 2006-02-08 15:15:11Z jplack $
+ * $Id: global_widgets.ycp 30358 2006-04-21 17:22:43Z odabrunz $
*
*/
@@ -104,7 +104,7 @@
boolean elilo = Bootloader::getLoaderType () == "elilo";
list sec = maplist (map s, sects, {
string image = s["kernel"]:"";
- string root = s["root"]:"";
+ string root = (BootCommon::getHintedPartitionList ([s["root"]:""]))[0]:"";
return `item (`id (s["name"]:""),
tolower (BootCommon::globals["default"]:"")
== tolower (s["name"]:"")
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-bootloader-2.13.49/src/routines/misc.ycp new/yast2-bootloader-2.13.50/src/routines/misc.ycp
--- old/yast2-bootloader-2.13.49/src/routines/misc.ycp 2006-04-20 13:49:35.000000000 +0200
+++ new/yast2-bootloader-2.13.50/src/routines/misc.ycp 2006-04-21 19:22:48.000000000 +0200
@@ -10,8 +10,9 @@
*
* Authors:
* Jiri Srain
+ * Olaf Dabrunz
*
- * $Id: misc.ycp 30275 2006-04-20 11:49:32Z odabrunz $
+ * $Id: misc.ycp 30358 2006-04-21 17:22:43Z odabrunz $
*
* WARNING:
* To be included to BootCommon.ycp only, requires function
@@ -220,8 +221,152 @@
}
/**
- * returns list of partitions. looks at '/proc/partitions' and creates list
- * of partition for combobox or menu
+ * Converts a "/dev/disk/by-" device name to the corresponding kernel
+ * device name, according to the "mountby" setting for the device from
+ * yast2-storage. If the given device name is not a "/dev/disk/by-" device
+ * name, it is left unchanged. Also, if the information about the device
+ * name cannot be found in the target map from yast2-storage, the device
+ * name is left unchanged.
+ *
+ * @param dev string device name
+ * @return string kernel device name
+ */
+ global define string MountByDev2Dev(string dev) ``{
+ y2milestone ("MountByDev2Dev: %1", dev);
+
+ if (!regexpmatch(dev, "^/dev/disk/by-"))
+ return dev;
+
+ map devices = (map)Storage::GetTargetMap();
+
+ // make a map: "type/identifier" -> info_map_for_this_partition
+ // e.g.: "id/scsi-SATA_ST3120813AS_3LS09W21-part5" -> info_map_for_this_partition
+ symbol mountby = `device;
+ map partitions = $[];
+ foreach (string k, map v, devices, ``{
+ foreach (map p, (list<map>)(v["partitions"]:[]), ``{
+ mountby = (symbol) p["mountby"]:nil;
+ if ( mountby == `uuid )
+ {
+ partitions["uuid/" + p["uuid"]:""] = p;
+ } else if ( mountby == `label )
+ {
+ partitions["label/" + p["label"]:""] = p;
+ } else if ( mountby == `id )
+ {
+ partitions["id/" + p["udev_id", 0]:""] = p;
+ } else if ( mountby == `path )
+ {
+ partitions["path/" + p["udev_path"]:""] = p;
+ }
+ });
+ });
+ y2milestone ("MountByDev2Dev: partitions %1", partitions);
+
+ // ident is "id/<id>", "path/<path>", "uuid/<uuid>" or "label/<label>"
+ string ident = regexpsub(dev, "^/dev/disk/by-(.*)", "\\1");
+ y2milestone ("MountByDev2Dev: ident %1", ident);
+ // if exists, get the kernel name, otherwise leave unchanged
+ string ret = partitions[ident, "device"]:dev;
+
+ y2milestone ("MountByDev2Dev: ret %1", ret);
+ return ret;
+ }
+
+ /**
+ * Converts a device name to the corresponding device name it should be
+ * mounted by, according to the "mountby" setting for the device from
+ * yast2-storage.
+ *
+ * @param dev string device name
+ * @return string device name according to "mountby"
+ */
+ global define string Dev2MountByDev(string dev) ``{
+ y2milestone ("Dev2MountByDev: %1", dev);
+ map devices = (map)Storage::GetTargetMap();
+
+ // make a map: "/dev/hda1" -> info_map_for_this_partition
+ map partitions = $[];
+ foreach (string k, map v, devices, ``{
+ foreach (map p, (list<map>)(v["partitions"]:[]), ``{
+ partitions[p["device"]:""] = p;
+ });
+ });
+// y2milestone ("Dev2MountByDev: partitions %1", partitions);
+
+ string ret = dev;
+
+ symbol mountby = `device;
+ mountby = (symbol) partitions[dev, "mountby"]:nil;
+ if ( mountby == `uuid )
+ {
+ ret = sformat ("/dev/disk/by-uuid/%1", partitions[dev, "uuid"]:"");
+ } else if ( mountby == `label )
+ {
+ ret = sformat ("/dev/disk/by-label/%1", partitions[dev, "label"]:"");
+ } else if ( mountby == `id )
+ {
+ ret = sformat ("/dev/disk/by-id/%1", partitions[dev, "udev_id", 0]:"");
+ } else if ( mountby == `path )
+ {
+ ret = sformat ("/dev/disk/by-path/%1", partitions[dev, "udev_path"]:"");
+ }
+
+ y2milestone ("Dev2MountByDev: ret %1", ret);
+ return ret;
+ }
+
+ /**
+ * Returns list of partitions with "mount by" hints. Goes through the list
+ * of partitions passed as a parameter and creates a list of partitions with
+ * hints according to the current partitioning requested from
+ * yast2-storage. To be used in a combobox or menu.
+ *
+ * @param parts_to_get list<string> partitions to list
+ * @return a list of strings containing a partition name and a hint (if applicable)
+ */
+ global define list<string> getHintedPartitionList(list<string> parts_to_get) ``{
+ y2milestone ("getHintedPartitionList: %1", parts_to_get);
+ map devices = (map)Storage::GetTargetMap();
+
+ // make a map: "/dev/hda1" -> info_map_for_this_partition
+ map partitions = $[];
+ foreach (string k, map v, devices, ``{
+ foreach (map p, (list<map>)(v["partitions"]:[]), ``{
+ partitions[p["device"]:""] = p;
+ });
+ });
+ y2milestone ("getHintedPartitionList: partitions %1", partitions);
+
+ symbol mountby = `device;
+ list<string> ret = maplist (string dev, parts_to_get, ``{
+ mountby = (symbol) partitions[dev, "mountby"]:nil;
+ if ( mountby == `uuid )
+ {
+ return sformat ("%1 (mount by UUID: %2)", dev, partitions[dev, "uuid"]:"");
+ } else if ( mountby == `label )
+ {
+ return sformat ("%1 (mount by LABEL: %2)", dev, partitions[dev, "label"]:"");
+ } else if ( mountby == `id )
+ {
+ return sformat ("%1 (mount by ID: %2)", dev, partitions[dev, "udev_id", 0]:"");
+ } else if ( mountby == `path )
+ {
+ return sformat ("%1 (mount by PATH: %2)", dev, partitions[dev, "udev_path"]:"");
+ } else if ( mountby == nil || mountby == `device )
+ {
+ return dev;
+ }
+ });
+
+ y2milestone ("getHintedPartitionList: ret %1", ret);
+ return ret;
+ }
+
+ /**
+ * Returns list of partitions. Requests current partitioning from
+ * yast2-storage and creates list of partition for combobox, menu or other
+ * purpose.
* @param type symbol
* `boot - for bootloader installation
* `root - for kernel root
@@ -235,6 +380,7 @@
* @return a list of strings
*/
global define list<string> getPartitionList(symbol type) ``{
+ y2milestone ("getPartitionList: %1", type);
map devices = (map)Storage::GetTargetMap();
list<map> partitions = [];
foreach (string k, map v, devices, ``{
@@ -247,7 +393,7 @@
if (type == `boot || type == `boot_other)
{
- devices = filter (string k, map v, devices,
+ devices = filter (string k, map v, devices,
``(v["type"]:`CT_UNKNOWN == `CT_DISK));
}
list<string> all_disks = (list<string>) maplist (string k, map v, devices, ``(k));
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-bootloader-2.13.49/src/routines/section_widgets.ycp new/yast2-bootloader-2.13.50/src/routines/section_widgets.ycp
--- old/yast2-bootloader-2.13.49/src/routines/section_widgets.ycp 2006-02-13 04:52:14.000000000 +0100
+++ new/yast2-bootloader-2.13.50/src/routines/section_widgets.ycp 2006-04-21 19:22:48.000000000 +0200
@@ -11,7 +11,7 @@
* Authors:
* Jiri Srain
*
- * $Id: section_widgets.ycp 27748 2006-02-08 15:15:11Z jplack $
+ * $Id: section_widgets.ycp 30358 2006-04-21 17:22:43Z odabrunz $
*
*/
@@ -31,7 +31,7 @@
include "bootloader/routines/helps.ycp";
/**
- * Init function of widget
+ * Init function for widget value
* @param widget any id of the widget
*/
void SectionOptionInit (string widget) {
@@ -59,7 +59,7 @@
/**
- * Validate function of a widget
+ * Validate function of the name widget
* @param widget any widget key
* @param event map event description of event that occured
* @return boolean true if widget settings ok
@@ -84,7 +84,7 @@
}
/**
- * Store function of a widget
+ * Store function of the name widget
* @param widget any widget key
* @param event map event description of event that occured
*/
@@ -145,7 +145,7 @@
}
/**
- * Handle function of a widget
+ * Handle function of the initrd widget
* @param widget any widget key
* @param event map event description of event that occured
* @return symbol to return to wizard sequencer, or nil
@@ -161,13 +161,49 @@
/**
- * Init function of widget
+ * Init function of the root device widget
* @param widget any id of the widget
*/
void RootDeviceInit (string widget) {
+ y2milestone ("RootDeviceInit: %1", widget);
list<string> available = BootCommon::getPartitionList (`root);
+ // if we mount any of these devices by id, label etc., we add a hint to
+ // that effect to the item
+ y2milestone ("RootDeviceInit: getHintedPartitionList for %1", available);
+ available = BootCommon::getHintedPartitionList (available);
UI::ChangeWidget (`id (widget), `Items, available);
- SectionOptionInit (widget);
+ UI::ChangeWidget (`id (widget), `Value,
+ (BootCommon::getHintedPartitionList ([BootCommon::current_section[widget]:""]))[0]:"");
+}
+
+/**
+ * Store function of the root device widget
+ * @param widget any widget key
+ * @param event map event description of event that occured
+ */
+void RootDeviceStore (string widget, map event) {
+ BootCommon::current_section[widget]
+ = (splitstring( (string)UI::QueryWidget (`id (widget), `Value), " "))[0]:"";
+}
+
+/**
+ * Handle function of the root device widget
+ * @param widget any widget key
+ * @param event map event description of event that occured
+ * @return symbol to return to wizard sequencer, or nil
+ */
+symbol RootDeviceHandle (string widget, map event) {
+ if (event["EventReason"]:nil != "ValueChanged")
+ return nil;
+ // append hint string when user changed root device
+ string current
+ = (splitstring( (string)UI::QueryWidget (`id (widget), `Value), " "))[0]:"";
+ // check against the list of existing partitions
+ list<string> available = BootCommon::getPartitionList (`root);
+ if (contains(available, current))
+ UI::ChangeWidget (`id (widget), `Value,
+ (BootCommon::getHintedPartitionList ([current]))[0]:"");
+ return nil;
}
/**
@@ -203,7 +239,7 @@
}
/**
- * Handle function of a widget
+ * Handle function of the chainloader widget
* @param widget any widget key
* @param event map event description of event that occured
* @return symbol to return to wizard sequencer, or nil
@@ -357,8 +393,10 @@
"widget" : `combobox,
// combo box
"label" : _("Root &Device"),
- "opt" : [ `editable, `hstretch ],
+ "opt" : [ `editable, `hstretch, `notify ],
"init" : RootDeviceInit,
+ "handle" : RootDeviceHandle,
+ "store" : RootDeviceStore,
"help" : RootDeviceHelp (),
],
"vga" : $[
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...