/** * File: * Package: Auto-installation * Author: Uwe Gansert * Summary: * * Changes: * initial 0.2: * added Pkg::TargetInit 0.3: * support for 0.4: * support for the feature 0.5: * support for the new "keep install network" feature of 10.3 * Version: 0.5 * $Id$ this client can be called from a running system, to do the autoyast configuration. You have to provide a profile and autoyast will configure your system like in the profile. Only stage2 configuration can be done. yast2 ./ayast_setup.ycp setup filename=/tmp/my.xml */ { textdomain "autoinst"; y2milestone("----------------------------------------"); y2milestone("ayast_setup started"); import "Profile"; import "Popup"; import "Wizard"; import "Mode"; import "CommandLine"; import "Stage"; import "AutoInstall"; import "AutoinstSoftware"; symbol GUI() { Mode::SetUI("commandline"); CommandLine::Error(_("Empty parameter list")); return `dummy; } void Setup() { AutoInstall::Save(); Wizard::CreateDialog(); Mode::SetMode("autoinstallation"); Stage::Set ("continue"); WFM::CallFunction("inst_autopost", []); AutoinstSoftware::addPostPackages(Profile::current["software","post-packages"]:[]); // the following is needed since 10.3 // otherwise the already configured network gets removed if( !haskey(Profile::current, "networking") ) { Profile::current = add( Profile::current, "networking", $[ "keep_install_network":true ] ); } Pkg::TargetInit ("/", false); WFM::CallFunction("inst_rpmcopy", []); WFM::CallFunction("inst_autoconfigure", []); } boolean openFile( map options ) { if ( options["filename"]:nil == nil ) { CommandLine::Error(_("Path to autoyast profile must be set")); return false; } if( !Profile::ReadXML( options["filename"]:"" ) ) { Mode::SetUI("commandline"); CommandLine::Print(_("Error while parsing the control file. Check the log files for more details or fix the control file and try again. ")); return false; } Setup(); return true; } map cmdline = $[ "id" : "ayast_setup", "help" : _("Client for autoyast configuration on the running system"), "guihandler": GUI, "actions" : $[ "setup" : $[ "handler" : openFile, "help" : _("Configure the system using given autoyast profile"), "example" : "setup filename=/path/to/profile" ] ], "options" : $[ "filename": $[ "type" : "string", "help" : _("Path to autoyast profile") ] ], "mappings" : $[ "setup" : ["filename"] ] ]; any ret = CommandLine::Run( cmdline ); y2debug("ret = %1", ret); y2milestone("----------------------------------------"); y2milestone("ayast_setup finished"); }