ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/save_hw_status_finish.ycp

/**
 * File:
 *  save_hw_status_finish.ycp
 *
 * Module:
 *  Step of base installation finish
 *
 * Authors:
 *  Jiri Srain <jsrain@suse.cz>
 *
 * $Id: save_hw_status_finish.ycp 54888 2009-01-22 11:47:19Z locilka $
 *
 */

{

textdomain "installation";

import "Mode";
import "HwStatus";
import "HWConfig";
import "Package";

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 save_hw_status_finish");
y2debug("func=%1", func);
y2debug("param=%1", param);

if (func == "Info")
{
    return (any)$[
	"steps" : 1,
	// progress step title
	"title" : _("Saving hardware configuration..."),
	"when" : [ `installation, `update, `autoinst ],
    ];
}
else if (func == "Write")
{
    // Package yast2-printer needs to be installed
    if (Package::Installed ("yast2-printer")) {
	list<string> parports = (list<string>) SCR::Read (.proc.parport.devices);
	if (parports != nil && size (parports) > 0) {
	    HWConfig::SetValue ("static-printer", "STARTMODE", "auto");
	    HWConfig::SetValue ("static-printer", "MODULE", "lp");
	}
    } else {
	y2warning ("Package yast2-printer is not installed, skipping static-printer write...");
    }

    // PS/2 mouse on PPC
    map out = (map)SCR::Execute (.target.bash_output,
"#!/bin/sh
set -e
if test -f /etc/sysconfig/hardware/hwcfg-static-psmouse
then
 exit 0
fi
if test -d /proc/device-tree
then
cd /proc/device-tree
if find * -name name -print0 | xargs -0 grep -qw 8042
then
cat > /etc/sysconfig/hardware/hwcfg-static-psmouse <<EOF
MODULE='psmouse'
EOF
fi
fi
");
    if ((integer) out["exit"]:0 != 0) {
	y2error ("Error saving PS/2 mouse: %1", out);
    } else {
	y2milestone ("PS/2 mouse saving process returnes: %1", out);
    }

    y2milestone ("PS/2 mouse saving process returnes: %1", out);
    if (Mode::update ())
    {
	// ensure "no" status for all pci and isapnp devices
	HwStatus::Update();
    }

    // write "yes" status for known devices (mouse, keyboard, storage, etc.)
    HwStatus::Save();
}
else
{
    y2error ("unknown function: %1", func);
    ret = nil;
}

y2debug("ret=%1", ret);
y2milestone("save_hw_status_finish finished");
return ret;


} /* EOF */

ACC SHELL 2018