Skip to content

Commit 3415376

Browse files
committed
osbuild: use bootc install to deploy the container
Instead of deploying the container to the tree then copy all the contents to the disk image, use bootc to directly manage the installation to the target filesystems. Right now this requires to use the image as the buildroot so this requires python (for osbuild). This is tracked in [1]. [1] bootc-dev/bootc#1410 Requires osbuild/osbuild#2149
1 parent 43b99d5 commit 3415376

File tree

3 files changed

+117
-286
lines changed

3 files changed

+117
-286
lines changed

build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ write_archive_info() {
177177
}
178178

179179
patch_osbuild() {
180+
# return # we have no patches right now
180181
## Add a few patches that either haven't made it into a release or
181182
## that will be obsoleted with other work that will be done soon.
182183

@@ -191,6 +192,7 @@ patch_osbuild() {
191192
#cat foo.patch | patch -d /usr/lib/osbuild -p1
192193
patch -d /usr/lib/osbuild -p1 < /usr/lib/coreos-assembler/0001-live-artifacts-read-os-name-from-usr-lib-os-release.patch
193194

195+
patch -d /usr/lib/osbuild -p1 < src/0001-stages-ignition-parametrize-the-path-to-boot.patch
194196
## And then move the files back; supermin appliance creation will need it back
195197
## in the places delivered by the RPM.
196198
mv /usr/lib/osbuild/tools/osbuild-mpp /usr/bin/osbuild-mpp
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From e37bd5d256c02f2a7693ec220322cf131e8e5274 Mon Sep 17 00:00:00 2001
2+
From: jbtrystram <[email protected]>
3+
Date: Thu, 17 Jul 2025 15:59:27 +0200
4+
Subject: [PATCH] stages/ignition: parametrize the path to boot
5+
6+
Allow passing a mount to specify where to write the igntion.firstboot
7+
file.
8+
This keeps the default `tree:///` value to not break existing stages.
9+
---
10+
stages/org.osbuild.ignition | 13 ++++++++-----
11+
stages/org.osbuild.ignition.meta.json | 5 +++++
12+
2 files changed, 13 insertions(+), 5 deletions(-)
13+
14+
diff --git a/stages/org.osbuild.ignition b/stages/org.osbuild.ignition
15+
index 23f91c48..4466cabf 100755
16+
--- a/stages/org.osbuild.ignition
17+
+++ b/stages/org.osbuild.ignition
18+
@@ -2,18 +2,17 @@
19+
import sys
20+
21+
import osbuild.api
22+
+from osbuild.util import parsing
23+
24+
25+
-def main(tree, options):
26+
- network = options.get("network", [])
27+
-
28+
+def main(network, location):
29+
# grub, when detecting the '/boot/ignition.firstboot' file
30+
# will set the "ignition_firstboot" option so that ignition
31+
# gets triggered during that boot. Additionally, the file
32+
# itself will be sourced this the 'ignition_network_kcmdline'
33+
# that is also in the "ignition_firstboot" variable can be
34+
# overwritten with the contents of `network`
35+
- with open(f"{tree}/boot/ignition.firstboot", "w", encoding="utf8") as f:
36+
+ with open(f"{location}/ignition.firstboot", "w", encoding="utf8") as f:
37+
if network:
38+
netstr = " ".join(network)
39+
f.write(f"set ignition_network_kcmdline='{netstr}'")
40+
@@ -23,5 +22,9 @@ def main(tree, options):
41+
42+
if __name__ == '__main__':
43+
args = osbuild.api.arguments()
44+
- r = main(args["tree"], args.get("options", {}))
45+
+ options = args.get("options", {})
46+
+ target = options.get("target", "tree:///boot")
47+
+ location = parsing.parse_location(target, args)
48+
+ network = options.get("network", [])
49+
+ r = main(network, location)
50+
sys.exit(r)
51+
diff --git a/stages/org.osbuild.ignition.meta.json b/stages/org.osbuild.ignition.meta.json
52+
index 612d59c7..dd295c24 100644
53+
--- a/stages/org.osbuild.ignition.meta.json
54+
+++ b/stages/org.osbuild.ignition.meta.json
55+
@@ -22,6 +22,11 @@
56+
"items": {
57+
"type": "string"
58+
}
59+
+ },
60+
+ "target": {
61+
+ "type": "string",
62+
+ "description": "Location to write the 'ignition.firstboot' file.",
63+
+ "default": "tree:///boot"
64+
}
65+
}
66+
}
67+
--
68+
2.50.1
69+

0 commit comments

Comments
 (0)