Skip to content

Commit 7a904d3

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 83fdbc4 commit 7a904d3

File tree

3 files changed

+124
-295
lines changed

3 files changed

+124
-295
lines changed

build.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,25 +177,25 @@ write_archive_info() {
177177
}
178178

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

184184
## To make it easier to apply patches we'll move around the osbuild
185185
## code on the system first:
186-
#rmdir /usr/lib/osbuild/osbuild
187-
#mv /usr/lib/python3.13/site-packages/osbuild /usr/lib/osbuild/
188-
#mkdir /usr/lib/osbuild/tools
189-
#mv /usr/bin/osbuild-mpp /usr/lib/osbuild/tools/
186+
rmdir /usr/lib/osbuild/osbuild
187+
mv /usr/lib/python3.13/site-packages/osbuild /usr/lib/osbuild/
188+
mkdir /usr/lib/osbuild/tools
189+
mv /usr/bin/osbuild-mpp /usr/lib/osbuild/tools/
190190

191191
## Now all the software is under the /usr/lib/osbuild dir and we can patch
192-
#cat foo.patch | patch -d /usr/lib/osbuild -p1
192+
patch -d /usr/lib/osbuild -p1 < src/0001-stages-ignition-parametrize-the-path-to-boot.patch
193193
#
194194
## And then move the files back; supermin appliance creation will need it back
195195
## in the places delivered by the RPM.
196-
#mv /usr/lib/osbuild/tools/osbuild-mpp /usr/bin/osbuild-mpp
197-
#mv /usr/lib/osbuild/osbuild /usr/lib/python3.13/site-packages/osbuild
198-
#mkdir /usr/lib/osbuild/osbuild
196+
mv /usr/lib/osbuild/tools/osbuild-mpp /usr/bin/osbuild-mpp
197+
mv /usr/lib/osbuild/osbuild /usr/lib/python3.13/site-packages/osbuild
198+
mkdir /usr/lib/osbuild/osbuild
199199
}
200200

201201
if [ $# -ne 0 ]; then
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)