ACC SHELL

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

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

{

textdomain "installation";

import "Linuxrc";
import "Installation";
import "String";

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

if (func == "Info")
{
    return (any)$[
	"steps" : 1,
	// progress step title
	"title" : _("Copying SSH settings to installed system..."),
	"when" : Linuxrc::usessh () ? [ `installation, `autoinst ] : [],
    ];
}
else if (func == "Write")
{
    WFM::Execute (.local.bash, "umask 077 ; awk  -F : ' /^root:/ { print $1\":\"$2 }' < /etc/shadow > "
                + "'" + String::Quote (Installation::destdir) + "/tmp/rootpwd.txt'");
    SCR::Execute (.target.bash, "/bin/cat /tmp/rootpwd.txt | /usr/sbin/chpasswd -e ; rm -fv /tmp/rootpwd.txt");
    WFM::Execute (.local.bash, "/bin/cp -a /etc/ssh/*key* '" + String::Quote (Installation::destdir) + "/etc/ssh/'");
}
else
{
    y2error ("unknown function: %1", func);
    ret = nil;
}

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


} /* EOF */

ACC SHELL 2018