stages/systemd: add default_target
Allow setting the default to boot into.
This commit is contained in:
parent
64713449ce
commit
d2dbdcf5ef
1 changed files with 8 additions and 0 deletions
|
|
@ -27,6 +27,10 @@ STAGE_OPTS = """
|
|||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "Array of systemd unit names to be enabled"
|
||||
},
|
||||
"default_target": {
|
||||
"type": "string",
|
||||
"description": "The default target to boot into"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
|
@ -34,6 +38,7 @@ STAGE_OPTS = """
|
|||
def main(tree, options):
|
||||
enabled_services = options["enabled_services"]
|
||||
disabled_services = options.get("disabled_services", [])
|
||||
default_target = options.get("default_target")
|
||||
|
||||
for service in enabled_services:
|
||||
subprocess.run([f"systemctl", "--root", tree, "enable", service], check=True)
|
||||
|
|
@ -41,6 +46,9 @@ def main(tree, options):
|
|||
for service in disabled_services:
|
||||
subprocess.run([f"systemctl", "--root", tree, "disable", service], check=True)
|
||||
|
||||
if default_target:
|
||||
subprocess.run([f"systemctl", "--root", tree, "set-default", default_target], check=True)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue