Author: pth
Date: Thu Aug 30 15:49:53 2007
New Revision: 40623
URL: http://svn.opensuse.org/viewcvs/yast?rev=40623&view=rev
Log:
Redo the structure and logic of how top achieve booting a given section
only once.
Added:
trunk/bootloader/src/ChangeLog
trunk/bootloader/src/modules/ChangeLog
trunk/bootloader/src/routines/ChangeLog
Modified:
trunk/bootloader/package/yast2-bootloader.changes
trunk/bootloader/src/clients/bootloader_finish.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootELILO.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/BootLILO.ycp
trunk/bootloader/src/modules/BootPOWERLILO.ycp
trunk/bootloader/src/modules/BootZIPL.ycp
trunk/bootloader/src/modules/Bootloader.ycp
Modified: trunk/bootloader/package/yast2-bootloader.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/package/yast2-bootloader.changes?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/package/yast2-bootloader.changes (original)
+++ trunk/bootloader/package/yast2-bootloader.changes Thu Aug 30 15:49:53 2007
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Tue Aug 28 18:35:52 CEST 2007 - pth@suse.de
+
+- Redo the logic and structure of the one-time booting code.
+ * Global Write uses Bootloader::getDefaultSection() to determine the
+ section name.
+ * New function BootCommon::Section2Index that determines the
+ index # for a given section, currently only used by
+ BootGRUB::FlagOnetimeBoot.
+
+-------------------------------------------------------------------
Wed Aug 15 20:34:07 CEST 2007 - od@suse.de
- forgot to use changed sections (feature #302302)
Added: trunk/bootloader/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/ChangeLog?rev=40623&view=auto
==============================================================================
--- trunk/bootloader/src/ChangeLog (added)
+++ trunk/bootloader/src/ChangeLog Thu Aug 30 15:49:53 2007
@@ -0,0 +1,6 @@
+2008-08-28 Philipp Thomas
+
+ * clients/bootloader_finish(func == write): Remember status and
+ call FlagOnetimeBoot if all went well. Use
+ Bootloader::getDefaultSection to get the name of the default
+ section.
Modified: trunk/bootloader/src/clients/bootloader_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/bootloader_finish.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/clients/bootloader_finish.ycp (original)
+++ trunk/bootloader/src/clients/bootloader_finish.ycp Thu Aug 30 15:49:53 2007
@@ -150,23 +150,27 @@
// Bootloader::ReadOrProposeIfNeeded() (which is called the first time
// Write() is reached from the call-chain that starts below:
// Bootloader::Update() -> Write()).
+
if (!Mode::update ())
Bootloader::ResolveSymlinksInSections();
+ boolean retcode = false;
+
if (!Mode::update ())
{
- return Bootloader::Write ();
+ retcode = Bootloader::Write ();
}
else
{
- return Bootloader::Update (
+ retcode = Bootloader::Update (
Update::installedVersion,
Update::updateVersion);
}
- string default_name = BootCommon::globals["default"]:"";
-
- return Bootloader::FlagOnetimeBoot (default_name);
+ if (retcode)
+ return Bootloader::FlagOnetimeBoot(Bootloader::getDefaultSection ());
+ else
+ return retcode;
}
else
{
Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Thu Aug 30 15:49:53 2007
@@ -1013,6 +1013,25 @@
return ret;
}
+/**
+ * Search for section passed
+ * @return integer index number
+ */
+
+global define integer Section2Index (string section_name)
+{
+ integer index = -1;
+ integer sectnum = -1;
+
+ foreach (map s, BootCommon::sections, {
+ index = index + 1;
+ if (s["name"]:"" == section_name)
+ sectnum = index;
+ });
+
+ return sectnum;
+}
+
}
/*
Modified: trunk/bootloader/src/modules/BootELILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootELILO.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootELILO.ycp (original)
+++ trunk/bootloader/src/modules/BootELILO.ycp Thu Aug 30 15:49:53 2007
@@ -14,6 +14,7 @@
* Joachim Plack
* Jiri Srain
* Andreas Schwab
+ * Philipp Thomas
*
* $Id$
*
@@ -578,7 +579,7 @@
* @param section string section to boot
* @return boolean true on success
*/
-global define boolean FlagOnetimeBoot (string section) {
+global define boolean FlagBootDefaultOnce (string section) {
/* For now a dummy */
return true;
}
@@ -589,19 +590,20 @@
*/
global map GetFunctions () {
return $[
- "export" : Export,
- "import" : Import,
- "read" : Read,
- "reset" : Reset,
- "propose" : Propose,
- "save" : Save,
- "summary" : Summary,
- "update" : Update,
- "write" : Write,
- "widgets" : genericWidgets,
- "wizard_sequencer" : WizardSequenzer,
- "dialogs" : Dialogs,
- "section_types" : section_types,
+ "export" : Export,
+ "import" : Import,
+ "read" : Read,
+ "reset" : Reset,
+ "propose" : Propose,
+ "save" : Save,
+ "summary" : Summary,
+ "update" : Update,
+ "write" : Write,
+ "widgets" : genericWidgets,
+ "wizard_sequencer" : WizardSequenzer,
+ "dialogs" : Dialogs,
+ "section_types" : section_types,
+ "flagbootdefaultonce" : FlagBootDefaultOnce,
];
}
Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Thu Aug 30 15:49:53 2007
@@ -12,6 +12,7 @@
* Authors:
* Jiri Srain
* Joachim Plack
+ * Philipp Thomas
*
* $Id$
*
@@ -1002,53 +1003,39 @@
}
/**
- * Set section to boot on next reboot.
+ * Boot passed section once on next reboot.
* @param section string section to boot
* @return boolean true on success
*/
-global define boolean FlagOnetimeBoot (string section) {
- integer index = -1;
- integer sectnum = -1;
-
- /**
- * Determine section number to avoid having to quote
- * the section name for grubonce.
- */
- foreach (map s, BootCommon::sections,
- {
- index = index + 1;
- if (s["name"]:"" == section)
- sectnum = index;
- });
-
- map result = (map)SCR::Execute (.target.bash_output, sformat (
- "/usr/sbin/grubonce \"%1\"", sectnum));
- y2milestone ("lilo returned %1", result);
- return (result["exit"]:-1 == 0);
+global define boolean FlagOnetimeBoot (string section)
+{
+ map result = (map)SCR::Execute (.target.bash_output, sformat (
+ "/usr/sbin/grubonce \"%1\"", BootCommon::Section2Index(section)));
+ y2milestone ("grubonce returned %1", result);
+ return (result["exit"]:-1 == 0);
}
-
/**
* Return map of provided functions
* @return a map of functions (eg. $["write"::Write])
*/
global map GetFunctions () {
return $[
- //"export" : Export,
- //"import" : Import,
- "read" : Read,
- "reset" : Reset,
- "propose" : Propose,
- "save" : Save,
- "summary" : Summary,
- "update" : Update,
- "write" : Write,
- "widgets" : genericWidgets,
- "wizard_sequencer" : WizardSequenzer,
- "dialogs" : Dialogs,
- "section_types" : section_types,
- "flagonetimeboot" : FlagOnetimeBoot,
+ //"export" : Export,
+ //"import" : Import,
+ "read" : Read,
+ "reset" : Reset,
+ "propose" : Propose,
+ "save" : Save,
+ "summary" : Summary,
+ "update" : Update,
+ "write" : Write,
+ "widgets" : genericWidgets,
+ "wizard_sequencer" : WizardSequenzer,
+ "dialogs" : Dialogs,
+ "section_types" : section_types,
+ "flagonetimeboot" : FlagOnetimeBoot,
];
}
Modified: trunk/bootloader/src/modules/BootLILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootLILO.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootLILO.ycp (original)
+++ trunk/bootloader/src/modules/BootLILO.ycp Thu Aug 30 15:49:53 2007
@@ -11,6 +11,7 @@
*
* Authors:
* Jiri Srain
+ * Philipp Thomas
*
* $Id$
*
@@ -301,13 +302,14 @@
*/
global map GetFunctions () {
return $[
- "dialogs" : Dialogs,
- "read" : Read,
- "propose" : Propose,
- "save" : Save,
- "summary" : BootCommon::i386Summary,
- "update" : Update,
- "write" : Write,
+ "dialogs" : Dialogs,
+ "read" : Read,
+ "propose" : Propose,
+ "save" : Save,
+ "summary" : BootCommon::i386Summary,
+ "update" : Update,
+ "write" : Write,
+ "flagonetimeboot" : FlagOnetimeBoot,
];
}
Modified: trunk/bootloader/src/modules/BootPOWERLILO.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootPOWERLILO.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootPOWERLILO.ycp (original)
+++ trunk/bootloader/src/modules/BootPOWERLILO.ycp Thu Aug 30 15:49:53 2007
@@ -14,6 +14,7 @@
* Jiri Srain
* Joachim Plack
* Olaf Dabrunz
+ * Philipp Thomas
*
* $Id$
*
@@ -1175,9 +1176,10 @@
* @param section string section to boot
* @return boolean true on success
*/
-global define boolean FlagOnetimeBoot (string section) {
- map result = (map)SCR::Execute (.target.bash_output, sformat (
- "/sbin/lilo -R \"%1\"", section));
+global define boolean FlagOnetimeBoot (string section)
+{
+ map result = (map)SCR::Execute (.target.bash_output,
+ sformat ("/sbin/lilo -R \"%1\"", section));
y2milestone ("lilo returned %1", result);
return (result["exit"]:-1 == 0);
}
@@ -1189,20 +1191,20 @@
*/
global map GetFunctions () {
return $[
- "export" : Export,
- "import" : Import,
- "read" : Read,
- "reset" : Reset,
- "propose" : Propose,
- "save" : Save,
- "summary" : Summary,
- "update" : Update,
- "write" : Write,
- "widgets" : genericWidgets,
- "wizard_sequencer" : WizardSequenzer,
- "dialogs" : Dialogs,
- "section_types" : section_types,
- "flagonetimeboot" : FlagOnetimeBoot,
+ "export" : Export,
+ "import" : Import,
+ "read" : Read,
+ "reset" : Reset,
+ "propose" : Propose,
+ "save" : Save,
+ "summary" : Summary,
+ "update" : Update,
+ "write" : Write,
+ "widgets" : genericWidgets,
+ "wizard_sequencer" : WizardSequenzer,
+ "dialogs" : Dialogs,
+ "section_types" : section_types,
+ "flagonetimeboot" : FlagOnetimeBoot,
];
}
Modified: trunk/bootloader/src/modules/BootZIPL.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootZIPL.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootZIPL.ycp (original)
+++ trunk/bootloader/src/modules/BootZIPL.ycp Thu Aug 30 15:49:53 2007
@@ -12,6 +12,7 @@
* Authors:
* Joachim Plack
* Jiri Srain
+ * Philipp Thomas
*
* $Id$
*
@@ -290,7 +291,8 @@
* @param section string section to boot
* @return boolean true on success
*/
-global define boolean FlagOnetimeBoot (string section) {
+global define boolean FlagOnetimeBoot (string section)
+{
/* For now a dummy */
return true;
}
@@ -301,19 +303,20 @@
*/
global map GetFunctions () {
return $[
- //"export" : Export,
- //"import" : Import,
- "read" : Read,
- //"reset" : Reset,
- "propose" : Propose,
- "save" : Save,
- "summary" : Summary,
- "update" : Update,
- "write" : Write,
- "widgets" : genericWidgets,
- "wizard_sequencer" : WizardSequenzer,
- "dialogs" : Dialogs,
- "section_types" : section_types,
+ //"export" : Export,
+ //"import" : Import,
+ "read" : Read,
+ //"reset" : Reset,
+ "propose" : Propose,
+ "save" : Save,
+ "summary" : Summary,
+ "update" : Update,
+ "write" : Write,
+ "widgets" : genericWidgets,
+ "wizard_sequencer" : WizardSequenzer,
+ "dialogs" : Dialogs,
+ "section_types" : section_types,
+ "flagonetimeboot" : FlagOnetimeBoot,
];
}
Modified: trunk/bootloader/src/modules/Bootloader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader.ycp?rev=40623&r1=40622&r2=40623&view=diff
==============================================================================
--- trunk/bootloader/src/modules/Bootloader.ycp (original)
+++ trunk/bootloader/src/modules/Bootloader.ycp Thu Aug 30 15:49:53 2007
@@ -276,31 +276,35 @@
BootCommon::backup_mbr = true;
y2milestone ("Proposed settings: %1", Export ());
}
+
+
/**
* Display bootloader summary
* @return a list of summary lines
*/
global define list<string> Summary () {
list<string> ret = blSummary ();
+
// check if default section was changed or not
string main_section = getProposedDefaultSection ();
+
if (main_section == nil)
return ret;
- integer index = -1;
- integer sectnum = -1;
+
if (getLoaderType () == "none")
return ret;
- foreach (map s, BootCommon::sections, {
- index = index + 1;
- if (s["name"]:"" == main_section)
- sectnum = index;
- });
+
+ integer sectnum = BootCommon::Section2Index(main_section);
+
if (sectnum == -1)
return ret;
+
if (BootCommon::sections[sectnum, "__changed"]:false)
return ret;
+
string filtered_cmdline = filterchars (Kernel::GetCmdLine (),
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
+
if (size (filtered_cmdline) > 0)
{
ret = add (ret, sformat (
@@ -916,7 +920,8 @@
* @param section string section to boot
* @return boolean true on success
*/
- global define boolean FlagOnetimeBoot (string section) {
+ global define boolean FlagOnetimeBoot(string section)
+ {
return blFlagOnetimeBoot (section);
}
Added: trunk/bootloader/src/modules/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/ChangeLog?rev=40623&view=auto
==============================================================================
--- trunk/bootloader/src/modules/ChangeLog (added)
+++ trunk/bootloader/src/modules/ChangeLog Thu Aug 30 15:49:53 2007
@@ -0,0 +1,12 @@
+2007-08-28 Philipp Thomas
+
+ * Bootloader(Summary): Turn code to determine section index into
+ Function and move it to
+ * BootCommon(Section2Index): Here.
+ * BootGRUB(FlagOnetimeBoot): reverse renaming.
+ Use BootCommon::Section2Index to get index of section.
+ * BootLILO(FlagOnetimeBoot): Rename back to old name.
+ * BootELILO(FlagOnetimeBoot): Likewise.
+ * BootPOWERLILO(FlagOnetimeBoot): Likewise.
+ * BootZIPL(FlagOnetimeBoot): Likewise.
+
Added: trunk/bootloader/src/routines/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/ChangeLog?rev=40623&view=auto
==============================================================================
--- trunk/bootloader/src/routines/ChangeLog (added)
+++ trunk/bootloader/src/routines/ChangeLog Thu Aug 30 15:49:53 2007
@@ -0,0 +1,9 @@
+2007-08-28 Philipp Thomas
+
+ * switcher.ycp(blFlagBootDefaultOnce): Renamed back to old name.
+
+
+2007-08-23 Philipp Thomas
+
+ * switcher.ycp(blFlagOneTimeBoot): Rename to blFlagBootDefaultOnce,
+ and map to flagbootdefaultonce.
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org