debian-forge/stages/io.weldr.systemd
2019-07-09 10:29:48 +02:00

24 lines
585 B
Python
Executable file

#!/usr/bin/python3
import json
import subprocess
import sys
def main(tree, options):
enabled_services = options["enabled_services"]
disabled_services = options.get("disabled_services", [])
for service in enabled_services:
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__':
args = json.load(sys.stdin)
r = main(args["tree"], args["options"])
sys.exit(r)