Author: juhliarik
Date: Thu Mar 13 18:38:32 2008
New Revision: 45442
URL: http://svn.opensuse.org/viewcvs/yast?rev=45442&view=rev
Log:
added support for updating boot section during installation by kernel
(F#302660)
A src/clients/inst_bootloader.ycp
* added new file responsible for installing bootloader config
files
M src/clients/bootloader_finish.ycp
* added calling new function Bootloader::WriteInstallation()
M src/clients/Makefile.am
* added inst_bootloader.ycp
M src/modules/Bootloader.ycp
* new function for installation WriteInstallation()
M src/generic/widget_funcs.ycp
* added support for localization dialog for selecting files
Added:
trunk/bootloader/src/clients/inst_bootloader.ycp
Modified:
trunk/bootloader/src/clients/Makefile.am
trunk/bootloader/src/clients/bootloader_finish.ycp
trunk/bootloader/src/generic/widget_funcs.ycp
trunk/bootloader/src/modules/Bootloader.ycp
Modified: trunk/bootloader/src/clients/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/Makefile.am?rev=45442&r1=45441&r2=45442&view=diff
==============================================================================
--- trunk/bootloader/src/clients/Makefile.am (original)
+++ trunk/bootloader/src/clients/Makefile.am Thu Mar 13 18:38:32 2008
@@ -7,7 +7,8 @@
bootloader_auto.ycp \
bootloader_proposal.ycp \
bootloader_finish.ycp \
- print-product.ycp
+ print-product.ycp \
+ inst_bootloader.ycp
EXTRA_DIST = \
$(client_DATA)
Modified: trunk/bootloader/src/clients/bootloader_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/bootloader_finish.ycp?rev=45442&r1=45441&r2=45442&view=diff
==============================================================================
--- trunk/bootloader/src/clients/bootloader_finish.ycp (original)
+++ trunk/bootloader/src/clients/bootloader_finish.ycp Thu Mar 13 18:38:32 2008
@@ -160,7 +160,8 @@
if (!Mode::update ())
{
- retcode = Bootloader::Write ();
+ //retcode = Bootloader::Write ();
+ retcode = Bootloader::WriteInstallation();
}
else
{
Added: trunk/bootloader/src/clients/inst_bootloader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/clients/inst_bootloader.ycp?rev=45442&view=auto
==============================================================================
--- trunk/bootloader/src/clients/inst_bootloader.ycp (added)
+++ trunk/bootloader/src/clients/inst_bootloader.ycp Thu Mar 13 18:38:32 2008
@@ -0,0 +1,63 @@
+/**
+ * File:
+ * bootloader/routines/inst_bootloader.ycp
+ *
+ * Module:
+ * Bootloader installation and configuration
+ *
+ * Summary:
+ * Functions to write "dummy" config files for kernel
+ *
+ * Authors:
+ * Jozef Uhliarik
+ *
+ *
+ */
+
+{
+
+textdomain "bootloader";
+
+import "Bootloader";
+import "BootCommon";
+import "Installation";
+import "GetInstArgs";
+
+
+y2milestone ("starting inst_bootloader");
+
+
+if ( GetInstArgs::going_back()) // going backwards?
+{
+ return `auto; // don't execute this once more
+}
+
+Bootloader::blSave (false, false, false);
+map files = BootCommon::GetFilesContents ();
+
+y2milestone("contents FILES: %1", files);
+
+
+foreach (string file, string content, 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);
+});
+
+
+string lt = Bootloader::getLoaderType ();
+
+y2milestone ("Saving /etc/sysconfig/bootloader for %1", lt);
+
+WFM::Execute(.local.mkdir, Installation::destdir + "/etc/sysconfig");
+WFM::Write(.local.string, Installation::destdir + "/etc/sysconfig/bootloader", "LOADER_TYPE=\""+lt+"\"");
+
+y2milestone ("finish inst_bootloader");
+
+return `auto;
+
+}
\ No newline at end of file
Modified: trunk/bootloader/src/generic/widget_funcs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/widget_funcs.ycp?rev=45442&r1=45441&r2=45442&view=diff
==============================================================================
--- trunk/bootloader/src/generic/widget_funcs.ycp (original)
+++ trunk/bootloader/src/generic/widget_funcs.ycp Thu Mar 13 18:38:32 2008
@@ -430,7 +430,7 @@
string base_id = substring(id, 0, size(id)-size("_browse"));
string file_name = UI::AskForExistingFile(
(string)UI::QueryWidget(`id(base_id), `Value), "*",
- "Select a file name");
+ _("Select a file name"));
if (file_name != "" && file_name != nil) {
UI::ChangeWidget(`id(base_id), `Value, file_name);
reason = "ValueChanged";
Modified: trunk/bootloader/src/modules/Bootloader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader.ycp?rev=45442&r1=45441&r2=45442&view=diff
==============================================================================
--- trunk/bootloader/src/modules/Bootloader.ycp (original)
+++ trunk/bootloader/src/modules/Bootloader.ycp Thu Mar 13 18:38:32 2008
@@ -286,8 +286,8 @@
global define list<string> Summary () {
list<string> ret =[];
-//F#300779 - Install diskless client (NFS-root)
-//kokso: additional warning that root partition is nfs type -> bootloader will not be installed
+ // F#300779 - Install diskless client (NFS-root)
+ // kokso: additional warning that root partition is nfs type -> bootloader will not be installed
map dev = Storage::GetDiskPartition(BootCommon::BootPartitionDevice);
@@ -299,7 +299,7 @@
return ret;
}
-//F#300779 - end
+ // F#300779 - end
ret = blSummary ();
// check if default section was changed or not
@@ -528,8 +528,8 @@
return ret;
}
-//F#300779 - Install diskless client (NFS-root)
-//kokso: bootloader will not be installed
+ //F#300779 - Install diskless client (NFS-root)
+ //kokso: bootloader will not be installed
map dev = Storage::GetDiskPartition(BootCommon::BootPartitionDevice);
@@ -540,7 +540,7 @@
}
-//F#300779 -end
+ //F#300779 -end
// update graphics menu where possible
UpdateGfxMenu ();
@@ -593,6 +593,123 @@
return ret;
}
+
+/**
+ * Write bootloader settings during installation
+ * @return boolean true on success
+ */
+global define boolean WriteInstallation ()
+{
+ y2milestone ("Writing bootloader configuration during installation");
+ boolean ret = true;
+
+ // read current settings...
+ ret = blRead (true, false);
+
+ if (BootCommon::write_settings["save_all"]:false)
+ BootCommon::save_all = true;
+ if (BootCommon::save_all)
+ { // force saving everything
+ BootCommon::changed = true;
+ BootCommon::location_changed = true;
+ Initrd::changed = true;
+ }
+
+ map params_to_save = $[];
+
+ string new_vga = getKernelParam (getDefaultSection (), "vga");
+ if (new_vga != old_vga && new_vga != "false" && new_vga != "")
+ {
+ Initrd::setSplash (new_vga);
+ if (Stage::initial ())
+ params_to_save["vga"] = new_vga;
+ }
+
+
+ // save initrd
+ if ((Initrd::changed || ! Mode::normal ())
+ && ! (BootCommon::write_settings["forbid_save_initrd"]:false))
+ {
+ string vga = getKernelParam (getDefaultSection (), "vga");
+ if (vga != "false" && vga != "")
+ {
+ Initrd::setSplash (vga);
+ if (Stage::initial ())
+ params_to_save["vga"] = new_vga;
+ }
+ ret = Initrd::Write ();
+ BootCommon::changed = true;
+ }
+
+ if (! ret)
+ y2error ("Error occurred while creating initrd");
+
+ params_to_save["additional_failsafe_params"] = BootCommon::GetAdditionalFailsafeParams ();
+ params_to_save["installation_kernel_params"] = Kernel::GetCmdLine ();
+
+ if (Stage::initial ())
+ {
+ SCR::Write (.target.ycp, "/var/lib/YaST2/bootloader.ycp",params_to_save);
+ }
+
+ if (getLoaderType () == "none")
+ {
+ return ret;
+ }
+
+ // F#300779 - Install diskless client (NFS-root)
+ // kokso: bootloader will not be installed
+
+ map dev = Storage::GetDiskPartition(BootCommon::BootPartitionDevice);
+
+ if (dev["disk"]:"" == "/dev/nfs")
+ {
+ y2milestone("Bootloader::Write() -> Boot partition is nfs type, bootloader will not be installed.");
+ return ret;
+ }
+
+ // F#300779 -end
+
+ // update graphics menu where possible
+ UpdateGfxMenu ();
+
+ // save bootloader settings
+ boolean reinit = ! (Mode::update () || Mode::normal ());
+ y2milestone ("Reinitialize bootloader library before saving: %1",reinit);
+
+
+ ret = blSave (true, reinit, true) && ret;
+
+ if (! ret)
+ y2error ("Error before configuration files saving finished");
+
+
+ // call bootloader executable
+ y2milestone ("Calling bootloader executable");
+ ret = ret && blWrite ();
+
+ if (! ret)
+ {
+ y2error ("Installing bootloader failed");
+ if (writeErrorPopup ())
+ {
+ repeating_write = true;
+ map res = (map)WFM::call( "bootloader_proposal", ["AskUser",$[ "has_next": false]]);
+ if (res["workflow_sequence"]:nil == `next)
+ return Write ();
+ }
+ }
+ else
+ {
+ if (BootCommon::InstallingToFloppy ())
+ BootCommon::updateTimeoutPopupForFloppy(BootCommon::getLoaderName (getLoaderType (), `summary));
+ }
+ return ret;
+}
+
+
+
+
// write mode settings function
/**
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org