Skip to content

Commit

Permalink
stages(kickstart): implement reboot option
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Nov 9, 2023
1 parent 2c3f54d commit b0b722d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions stages/org.osbuild.kickstart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ SCHEMA = r"""
"type": "boolean"
}
}
},
"reboot": {
"description": "Reboot after the installation is successfully completed",
"type": "object",
"properties": {
"eject": {
"description": "Attempt to eject the installation media before rebooting",
"type": "boolean"
}
"kexec": {
"description": "Use this option to reboot into the new system using the kexec",
"type": "boolean"
}
}
}
"""
Expand Down Expand Up @@ -302,6 +315,15 @@ def main(tree, options):
if clearpart:
config += [clearpart]

reboot = options.get("reboot", None)
if reboot is not None:
cmd = "reboot"
if reboot.get("eject"):
cmd += " --eject"
if reboot.get("kexec"):
cmd += " --kexec"
config += [cmd]

target = os.path.join(tree, path)
base = os.path.dirname(target)
os.makedirs(base, exist_ok=True)
Expand Down
3 changes: 3 additions & 0 deletions stages/test/test_kickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
},
"lang en_US.UTF-8\nkeyboard us\ntimezone UTC\nzerombr\nclearpart --all --drives=sd*|hd*|vda,/dev/vdc",
),
({"reboot": {}}, "reboot"),
({"reboot": {"eject": True}}, "reboot --eject"),
({"reboot": {"kexec": True}}, "reboot --kexec"),
])
def test_kickstart(tmp_path, test_input, expected):
ks_stage_path = os.path.join(os.path.dirname(__file__), "../org.osbuild.kickstart")
Expand Down

0 comments on commit b0b722d

Please sign in to comment.