ACC SHELL
/**
* File:
* bootloader_finish.ycp
*
* Module:
* Step of base installation finish
*
* Authors:
* Jiri Srain <jsrain@suse.cz>
* Olaf Dabrunz <od@suse.de>
*
* $Id: bootloader_finish.ycp 57011 2009-04-28 14:50:01Z juhliarik $
*
*/
{
textdomain "bootloader";
import "Arch";
import "Bootloader";
import "Installation";
import "Linuxrc";
import "Misc";
import "Mode";
import "BootCommon";
// added for fate# 303395
import "Linuxrc";
any ret = nil;
string func = "";
map param = $[];
/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
func = (string)WFM::Args(0);
if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
param = (map)WFM::Args(1);
}
y2milestone ("starting bootloader_finish");
y2debug("func=%1", func);
y2debug("param=%1", param);
if (func == "Info")
{
return (any)$[
"steps" : 3,
// progress step title
"title" : _("Saving bootloader configuration..."),
"when" : [ `installation, `live_installation, `update, `autoinst ],
];
}
else if (func == "Write")
{
// provide the /dev content from the inst-sys also inside the chroot of just the upgraded system
// umount of this bind mount will happen in umount_finish
if (Mode::update ())
{
string cmd = "targetdir=" + Installation::destdir + "
if test ${targetdir} = / ; then echo targetdir is / ; exit 1 ; fi
grep -E \"^[^ ]+ ${targetdir}/dev \" < /proc/mounts
if test $? = 0
then
echo targetdir ${targetdir} already mounted.
exit 1
else
mkdir -vp ${targetdir}/dev
cp --preserve=all --recursive --remove-destination /lib/udev/devices/* ${targetdir}/dev
mount -v --bind /dev ${targetdir}/dev
fi
";
y2milestone ("mount --bind cmd: %1", cmd);
map out = (map)WFM::Execute (.local.bash_output, cmd);
if (out["exit"]:0 != 0)
{
y2error ("unable to bind mount /dev in chroot");
}
y2milestone ("mount --bind /dev /mnt/dev output: %1", out);
}
SCR::Execute (.target.bash, "/sbin/SuSEconfig --module bootsplash");
// --------------------------------------------------------------
// message after first round of packet installation
// now the installed system is run and more packages installed
// just warn the user that the screen is going back to text mode
// and yast2 will come up again.
// dont mention this "going back to text mode" here, maybe this
// wont be necessary in the final version
// we should tell the user to remove the cd on an SMP or Laptop system
// where we do a hard reboot. However, the cdrom is still mounted here
// and cant be removed.
map finish_ret = nil;
if (Arch::s390 ())
{
string reipl_client = "reipl_bootloader_finish";
// Calling a special reIPL client
// it returns a result map (keys: (boolean) different, (string) ipl_msg)
if (WFM::ClientExists (reipl_client)) {
finish_ret = (map) WFM::call (reipl_client);
y2milestone ("result of reipl_bootloader_finish [%1, %2]", finish_ret["different"]:"N/A", finish_ret["ipl_msg"]:"N/A2");
y2milestone ("finish_ret[\"different\"]:true == true : %1", finish_ret["different"]:true == true);
if (finish_ret["different"]:false == true) {
y2milestone ("finish_ret[\"different\"] is true");
} else {
y2milestone ("finish_ret[\"different\"] is not true (either undefined or false)");
}
} else {
y2error ("No such client: %1", reipl_client);
}
}
if (Arch::s390 () && finish_ret["different"]:true == true)
{
// reIPL message
string ipl_msg = "";
ipl_msg = finish_ret["ipl_msg"]:"";
// SSH modification
string usessh_msg = "";
if (Linuxrc::usessh ()) {
// TRANSLATORS: part of the reboot message
// (message ID#SSH)
usessh_msg = _("Then reconnect and run the following:
/usr/lib/YaST2/startup/YaST2.ssh
");
}
// TRANSLATORS: reboot message
// %1 is replaced with additional message from reIPL
// %2 is replaced with additional message when using SSH
// See message ID#SSH
Misc::boot_msg = sformat(_("
Your system will now shut down.%1%2
For details, read the related chapter
in the documentation.
"), ipl_msg, usessh_msg);
}
else
{
if (Linuxrc::usessh () && !Linuxrc::vnc())
// Final message after all packages from CD1 are installed
// and we're ready to start (boot into) the installed system
// Message that will be displayed along with information
// how the boot loader was installed
Misc::boot_msg = _("The system will reboot now.
After reboot, reconnect and run the following:
/usr/lib/YaST2/startup/YaST2.ssh");
else
// Final message after all packages from CD1 are installed
// and we're ready to start (boot into) the installed system
// Message that will be displayed along with information
// how the boot loader was installed
Misc::boot_msg = _("The system will reboot now...");
}
//--------------------------------------------------------------
// Install bootloader (always, see #23018)
// should also set Misc::boot_msg appropriate
// FIXME: this is the plan B solution, try to solve plan A in
// BootCommon.ycp:CreateLinuxSection() (line 435)
// resolve symlinks in kernel and initrd paths
// In Mode::update(), the configuration is not yet read (for some
// unresearched reason). Therefore, for Mode::update(), there is another
// call of ResolveSymlinksInSections() after a Read() in
// Bootloader::ReadOrProposeIfNeeded() (which is called the first time
// Write() is reached from the call-chain that starts below:
// Bootloader::Update() -> Write()).
// perl-BL delayed section removal
Bootloader::RunDelayedUpdates();
if (!Mode::update ())
Bootloader::ResolveSymlinksInSections();
boolean retcode = false;
if (!Mode::update ())
{
retcode = Bootloader::WriteInstallation();
}
else
{
retcode = Bootloader::Update (
Installation::installedVersion,
Installation::updateVersion);
}
if (retcode) {
// re-read external changes, then boot through to second stage of
// installation or update
Bootloader::Read ();
// fate #303395: Use kexec to avoid booting between first and second stage
// copy vmlinuz, initrd and flush kernel option into /var/lib/YaST2
retcode = false;
if (Linuxrc::InstallInf ("kexec_reboot") == "1")
{
retcode = Bootloader::CopyKernelInird();
} else {
y2milestone("Installation started with kexec_reboot set 0");
}
// (bnc #381192) don't use it if kexec is used
// update calling onetime boot bnc #339024
if (!retcode)
{
string bl = Bootloader::getLoaderType();
if (bl == "grub")
{
if (BootCommon::isDefaultBootSectioLinux(Bootloader::getDefaultSection ()))
{
return Bootloader::FlagOnetimeBoot(Bootloader::getDefaultSection ());
} else {
return Bootloader::FlagOnetimeBoot(BootCommon::findRelativeDefaultLinux ());
}
} else {
return Bootloader::FlagOnetimeBoot(Bootloader::getDefaultSection ());
}
}
}
else
return retcode;
}
else
{
y2error ("unknown function: %1", func);
ret = nil;
}
y2debug("ret=%1", ret);
y2milestone("bootloader_finish finished");
return ret;
} /* EOF */
ACC SHELL 2018