introduce disabled services into the systemd stage
This commit is contained in:
parent
e9fb1ded15
commit
9ea6150ee7
1 changed files with 8 additions and 1 deletions
|
|
@ -1,16 +1,23 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def main(tree, options):
|
def main(tree, options):
|
||||||
enabled_services = options["enabled_services"]
|
enabled_services = options["enabled_services"]
|
||||||
|
disabled_services = options.get("disabled_services", [])
|
||||||
|
|
||||||
for service in enabled_services:
|
for service in enabled_services:
|
||||||
subprocess.run([f"systemctl", "--root", tree, "enable", service], check=True)
|
subprocess.run([f"systemctl", "--root", tree, "enable", service], check=True)
|
||||||
|
|
||||||
|
for service in disabled_services:
|
||||||
|
subprocess.run([f"systemctl", "--root", tree, "disable", service], check=True)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = json.load(sys.stdin)
|
args = json.load(sys.stdin)
|
||||||
r = main(args["tree"], args["options"])
|
r = main(args["tree"], args["options"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue