|
Lines 136-146
define boolean checkExists (string name) {
Link Here
|
| 136 |
} |
136 |
} |
| 137 |
|
137 |
|
| 138 |
/** |
138 |
/** |
|
|
139 |
* Check if service is enabled (in any runlevel) |
| 140 |
* |
| 141 |
* Forwards to chkconfig -l which decides between init and systemd |
| 142 |
* |
| 143 |
* @param name service name |
| 144 |
* @return true if service is set to run in any runlevel |
| 145 |
*/ |
| 146 |
global define boolean Enabled (string name) { |
| 147 |
if(!checkExists (name)) return false; |
| 148 |
|
| 149 |
return (SCR::Execute (.target.bash, sformat ("%1 is-enabled %2.service", invoker, name)) == 0); |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 139 |
* Get service info without peeking if service runs. |
153 |
* Get service info without peeking if service runs. |
| 140 |
* @param name name of the service |
154 |
* @param name name of the service |
| 141 |
* @return Service information or empty map ($[]) |
155 |
* @return Service information or empty map ($[]) |
| 142 |
*/ |
156 |
*/ |
| 143 |
global define map Info (string name) { |
157 |
global define map Info (string name) { |
|
|
158 |
y2error("### Calling Service::Info is broken with systemd! ###"); |
| 144 |
if(!checkExists (name)) return $[]; |
159 |
if(!checkExists (name)) return $[]; |
| 145 |
map read = (map) SCR::Read (.init.scripts.runlevel, name); |
160 |
map read = (map) SCR::Read (.init.scripts.runlevel, name); |
| 146 |
map detail = read[name]:$[]; |
161 |
map detail = read[name]:$[]; |
|
Lines 219-226
global define boolean Adjust (string name, string action) {
Link Here
|
| 219 |
return false; |
234 |
return false; |
| 220 |
} |
235 |
} |
| 221 |
|
236 |
|
| 222 |
map service = Info (name); |
237 |
boolean is_enabled = Enabled(name); |
| 223 |
boolean is_enabled = size (service["start"]:[]) != 0; |
|
|
| 224 |
|
238 |
|
| 225 |
if (action == "disable") { |
239 |
if (action == "disable") { |
| 226 |
if (is_enabled) |
240 |
if (is_enabled) |
|
Lines 283-302
global define boolean Finetune (string name, list rl) {
Link Here
|
| 283 |
} |
297 |
} |
| 284 |
|
298 |
|
| 285 |
/** |
299 |
/** |
| 286 |
* Check if service is enabled (in any runlevel) |
|
|
| 287 |
* |
| 288 |
* Forwards to chkconfig -l which decides between init and systemd |
| 289 |
* |
| 290 |
* @param name service name |
| 291 |
* @return true if service is set to run in any runlevel |
| 292 |
*/ |
| 293 |
global define boolean Enabled (string name) { |
| 294 |
if(!checkExists (name)) return false; |
| 295 |
|
| 296 |
return (SCR::Execute (.target.bash, sformat ("%1 is-enabled %2.service", invoker, name)) == 0); |
| 297 |
} |
| 298 |
|
| 299 |
/** |
| 300 |
* Run init script. |
300 |
* Run init script. |
| 301 |
* @param name init service name |
301 |
* @param name init service name |
| 302 |
* @param param init script argument |
302 |
* @param param init script argument |
| 303 |
- |
|
|