Skip to content

Commit

Permalink
- applied lnussel's patch:
Browse files Browse the repository at this point in the history
  Don't use Info function to check enable state (bnc#807507)
- 2.23.22
  • Loading branch information
tgoettlicher authored and kobliha committed Mar 15, 2013
1 parent 8b5d795 commit f600967
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
32 changes: 16 additions & 16 deletions library/runlevel/src/Service.ycp
Expand Up @@ -184,12 +184,27 @@ global string GetServiceId(string name)
return substring(id, 0, pos);
}

/**
* Check if service is enabled (in any runlevel)
*
* Forwards to chkconfig -l which decides between init and systemd
*
* @param name service name
* @return true if service is set to run in any runlevel
*/
global define boolean Enabled (string name) {
if(!checkExists (name)) return false;

return (SCR::Execute (.target.bash, sformat ("%1 is-enabled %2.service", invoker, name)) == 0);
}

/**
* Get service info without peeking if service runs.
* @param name name of the service
* @return Service information or empty map ($[])
*/
global define map Info (string name) {
y2error("### Calling Service::Info is broken with systemd! ###");
if(!checkExists (name)) return $[];
map read = (map) SCR::Read (.init.scripts.runlevel, name);
map detail = read[name]:$[];
Expand Down Expand Up @@ -268,8 +283,7 @@ global define boolean Adjust (string name, string action) {
return false;
}

map service = Info (name);
boolean is_enabled = size (service["start"]:[]) != 0;
boolean is_enabled = Enabled(name);

if (action == "disable") {
if (is_enabled)
Expand Down Expand Up @@ -331,20 +345,6 @@ global define boolean Finetune (string name, list rl) {
}
}

/**
* Check if service is enabled (in any runlevel)
*
* Forwards to chkconfig -l which decides between init and systemd
*
* @param name service name
* @return true if service is set to run in any runlevel
*/
global define boolean Enabled (string name) {
if(!checkExists (name)) return false;

return (SCR::Execute (.target.bash, sformat ("%1 is-enabled %2.service", invoker, name)) == 0);
}

/**
* Run init script.
* @param name init service name
Expand Down
7 changes: 7 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Mar 6 10:07:05 CET 2013 - tgoettlicher@suse.de

- applied lnussel's patch:
Don't use Info function to check enable state (bnc#807507)
- 2.23.23

-------------------------------------------------------------------
Tue Mar 5 15:56:58 CET 2013 - mvidner@suse.cz

Expand Down

0 comments on commit f600967

Please sign in to comment.