Commit 472bcdb
committed
refactor: only run systemctl when systemd is running as init
Based on reviewer feedback, changed the logic to only attempt
systemctl commands when systemd is actually running as PID 1
(has_systemd() returns true).
This is cleaner and more explicit:
- Systems with systemd running: use systemctl
- Systems with service command: use service
- Container environments: skip service management gracefully
The previous approach of running systemctl even when systemd
wasn't running was for image portability (container->VM), but
this is a niche use case.
Signed-off-by: Gajesh Bhat <gajeshbht@gmail.com>1 parent 5a42430 commit 472bcdb
1 file changed
Lines changed: 7 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
317 | 316 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 317 | + | |
323 | 318 | | |
324 | 319 | | |
325 | 320 | | |
326 | | - | |
327 | | - | |
328 | | - | |
| 321 | + | |
| 322 | + | |
329 | 323 | | |
330 | 324 | | |
331 | | - | |
| 325 | + | |
332 | 326 | | |
333 | 327 | | |
334 | 328 | | |
| |||
0 commit comments