ACC SHELL
/* ------------------------------------------------------------------------------
* Copyright (c) 2007 Novell, Inc. All Rights Reserved.
*
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of version 2 of the GNU General Public License as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, contact Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail, you may find
* current contact information at www.novell.com.
* ------------------------------------------------------------------------------
*/
/**
* File:
* vm_finish.ycp
*
* Module:
* Step of base installation finish
*
* Authors:
* Ladislav Slezak <lslezak@suse.cz>
*
* $Id: vm_finish.ycp 56552 2009-04-01 19:45:27Z charlesa $
*
*/
{
textdomain "vm";
import "Arch";
import "Report";
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 vm_finish");
y2debug("func=%1", func);
y2debug("param=%1", param);
if (func == "Info")
{
// return nil when the system is not Xen domainU,
// no change is allowed
if (Arch::is_xenU())
{
y2milestone("Detected Xen DomainU");
ret = (any)$[
"steps" : 1,
// progress step title
"title" : _("Configuring the virtual machine..."),
"when" : [ `installation, `update, `autoinst ],
];
}
else
{
y2milestone("Xen DomainU not detected, skipping domain configuration");
ret = $[];
}
}
else if (func == "Write")
{
// be sure that we are in Xen domU
if (Arch::is_xenU())
{
// disable HW services - they are useless and usually failing in a virtual machine
list<string> disable_services = ["acpid", "kbd", "earlykbd"];
y2milestone("disabling services: %1", disable_services);
foreach(string s, disable_services, {
integer disabled = (integer) SCR::Execute(.target.bash, sformat("/sbin/insserv -r %1", s));
y2milestone("insserv: service %1 disabled: %2", s, (disabled == 0) ? true : false);
}
);
// We no longer need to do remove these entries now that we use xvc
//SCR::Execute(.target.bash, "/bin/sed -i 's/.*mingetty tty[2-9]$//' /etc/inittab");
// Allow a console in addition to VNC with the PV framebuffer
y2milestone("check for xvc0 in inittab and securetty");
if ( !contains(SCR::Dir(.etc.inittab), "x0") )
{
SCR::Write (.etc.inittab.x0, sformat ("12345:respawn:/sbin/agetty -L 9600 xvc0 xterm"));
SCR::Write (.etc.inittab, nil);
}
SCR::Execute(.target.bash,"/usr/bin/grep -q xvc0 /etc/securetty || echo xvc0 >> /etc/securetty");
// Although console appears to be a tty, do not do character translations
SCR::Execute(.target.bash, "/bin/sed -i 's/^CONSOLE_MAGIC=.*$/CONSOLE_MAGIC=\"\"/' /etc/sysconfig/console");
}
}
else
{
y2error ("unknown function: %1", func);
ret = nil;
}
y2debug("ret=%1", ret);
y2milestone("vm_finish finished");
return ret;
} /* EOF */
ACC SHELL 2018