Skip to content

Commit

Permalink
Merge pull request #1 from yast/drop_suseconfig
Browse files Browse the repository at this point in the history
do not call /sbin/SuSEconfig, it has been dropped (bnc#828254)
  • Loading branch information
lslezak committed Jul 16, 2013
2 parents f0b207e + 31875e9 commit 4693165
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 106 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.22.0
2.24.0
6 changes: 6 additions & 0 deletions package/yast2-sysconfig.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jul 16 08:45:18 UTC 2013 - lslezak@suse.cz

- do not call /sbin/SuSEconfig, it has been dropped (bnc#828254)
- 2.24.0

-------------------------------------------------------------------
Fri Mar 30 14:18:00 UTC 2012 - lslezak@suse.cz

Expand Down
130 changes: 25 additions & 105 deletions src/Sysconfig.ycp
Expand Up @@ -1008,19 +1008,13 @@ define symbol StartCommand(string start_command, string label, string error, str
global define boolean Write() ``{

// remember all actions - start each action only once
map<string,boolean> Configmodules = $[];
map<string,boolean> Restarted = $[];
map<string,boolean> Reloaded = $[];
map<string,boolean> Commands = $[];
// will be complete SuSEconfig started?
boolean CompleteSuSEconfig = false;

// aborted?
boolean abort = false;

// SuSEconfig script name
string SuSEconfigName = "SuSEconfig";

// start presave commands
foreach (string vid, string new_val, modified_variables, ``{
if (abort)
Expand All @@ -1043,17 +1037,6 @@ global define boolean Write() ``{
{
abort = true;
}
else if (precommandresult == `failed)
{
// PreSaveCommand returned non zero value
// remove activation data for failed variable
// (insert empty Command: to not start complete SuSEconfig)
actions[vid] = $["Cmd" : ""];
}
else if (precommandresult != `success && precommandresult != `skip)
{
y2error("Unknown return value from StartCommand(): %1", precommandresult);
}
}
}
);
Expand All @@ -1069,58 +1052,39 @@ global define boolean Write() ``{

string restart_service = (string) (activate["Rest"]:nil);
string reload_service = (string) (activate["Reld"]:nil);
string config_module = (string) (activate["Cfg"]:nil);
string bash_command = (string) (activate["Cmd"]:nil);

if (config_module == nil && reload_service == nil && restart_service == nil && bash_command == nil && CompleteSuSEconfig == false && !write_only)
{
// start complete SuSEconfig (backward compatibility)
CompleteSuSEconfig = true;
}
else
{
if (restart_service != nil && size(restart_service) > 0)
{
list<string> parsed = String::ParseOptions(restart_service, parse_param);
foreach(string s, parsed,
``{
Restarted[s] = true;
}
);
}

if (reload_service != nil && size(reload_service) > 0)
{
list<string> parsed = String::ParseOptions(reload_service, parse_param);
foreach(string s, parsed,
``{
Reloaded[s] = true;
}
);
}

if (config_module != nil && size(config_module) > 0)
{
list<string> parsed = String::ParseOptions(config_module, parse_param);
foreach(string s, parsed,
``{
Configmodules[s] = true;
}
);
}

if (bash_command != nil && size(bash_command) > 0)
{
Commands[bash_command] = true;
}
}
if (restart_service != nil && size(restart_service) > 0)
{
list<string> parsed = String::ParseOptions(restart_service, parse_param);
foreach(string s, parsed,
``{
Restarted[s] = true;
}
);
}

if (reload_service != nil && size(reload_service) > 0)
{
list<string> parsed = String::ParseOptions(reload_service, parse_param);
foreach(string s, parsed,
``{
Reloaded[s] = true;
}
);
}

if (bash_command != nil && size(bash_command) > 0)
{
Commands[bash_command] = true;
}
});

// write dialog caption
string caption = _("Saving sysconfig Configuration");

// set the right number of stages
integer steps = size(modified_variables) + size(Restarted) + size(Reloaded) + size(Commands) + ((CompleteSuSEconfig) ? 1 : size(Configmodules)) + 1 /* flush*/ + 3 /* 3 stages */;
integer steps = size(modified_variables) + size(Restarted) + size(Reloaded) + size(Commands) + 1 /* flush*/ + 3 /* 3 stages */;

// We do not set help text here, because it was set outside
Progress::New(caption, " ", steps, [
Expand Down Expand Up @@ -1165,50 +1129,6 @@ global define boolean Write() ``{
// now start required activation commands
Progress::NextStage();

// start SuSEconfig
if (CompleteSuSEconfig == true)
{
// action command is missing, start complete SuSEconfig (backward compatibility)
string start_command = "/sbin/SuSEconfig";
// message
string confirm = _("All configuration scripts will be started.");
// progeress bar label
string label = _("Starting configuration scripts...");
// Error message
string error = _("Configuration script failed.");

Progress::NextStep();

if (StartCommand(start_command, label, error, confirm, ConfirmActions) == `abort)
{
return false;
}
}
else if (size(Configmodules) > 0)
{
// start only required SuSEconfig modules
foreach(string modulename, boolean dummy, Configmodules,
``{
if (abort) return;

// action command is missing, start complete SuSEconfig (backward compatibility)
string start_command = sformat("/sbin/SuSEconfig --module %1", modulename);
string confirm = sformat(_("Configuration module %1 will be started."), modulename);
// progress bar label - %1 is module name
string label = sformat(_("Starting configuration module %1..."), modulename);
// error message (config module failed) - %1 is module name
string error = sformat(_("Configuration module %1 failed."), modulename);

Progress::NextStep();

if (StartCommand(start_command, label, error, confirm, ConfirmActions) == `abort)
{
abort = true;
}
}
);
}

if (abort) return false;

if (size(Reloaded) > 0)
Expand Down

0 comments on commit 4693165

Please sign in to comment.