stages/ignition: parametrize the path to boot
Allow passing a mount to specify where to write the igntion.firstboot file. This keeps the default `tree:///` value to not break existing stages.
This commit is contained in:
parent
de22369919
commit
f4698da5bb
2 changed files with 12 additions and 4 deletions
|
|
@ -2,9 +2,12 @@
|
|||
import sys
|
||||
|
||||
import osbuild.api
|
||||
from osbuild.util import parsing
|
||||
|
||||
|
||||
def main(tree, options):
|
||||
def main(args, options):
|
||||
target = options.get("target", "tree:///boot")
|
||||
location = parsing.parse_location(target, args)
|
||||
network = options.get("network", [])
|
||||
|
||||
# grub, when detecting the '/boot/ignition.firstboot' file
|
||||
|
|
@ -13,7 +16,7 @@ def main(tree, options):
|
|||
# itself will be sourced this the 'ignition_network_kcmdline'
|
||||
# that is also in the "ignition_firstboot" variable can be
|
||||
# overwritten with the contents of `network`
|
||||
with open(f"{tree}/boot/ignition.firstboot", "w", encoding="utf8") as f:
|
||||
with open(f"{location}/ignition.firstboot", "w", encoding="utf8") as f:
|
||||
if network:
|
||||
netstr = " ".join(network)
|
||||
f.write(f"set ignition_network_kcmdline='{netstr}'")
|
||||
|
|
@ -22,6 +25,6 @@ def main(tree, options):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["tree"], args.get("options", {}))
|
||||
_args = osbuild.api.arguments()
|
||||
r = main(_args, _args["options"])
|
||||
sys.exit(r)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@
|
|||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"target": {
|
||||
"type": "string",
|
||||
"description": "Location to write the 'ignition.firstboot' file.",
|
||||
"default": "tree:///boot"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue