Skip to content

Commit bb4270f

Browse files
committed
Add required osbuild patches to use bootc install
Theses are patch from the following PRs: osbuild/osbuild#2152 osbuild/osbuild#2149
1 parent 55e4ec1 commit bb4270f

4 files changed

+218
-1
lines changed

build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,15 @@ patch_osbuild() {
190190
## Now all the software is under the /usr/lib/osbuild dir and we can patch
191191
#cat foo.patch | patch -d /usr/lib/osbuild -p1
192192
patch -d /usr/lib/osbuild -p1 < /usr/lib/coreos-assembler/0001-live-artifacts-read-os-name-from-usr-lib-os-release.patch
193+
patch -d /usr/lib/osbuild -p1 < /usr/lib/coreos-assembler/0001-stages-ignition-parametrize-the-path-to-boot.patch
194+
patch -d /usr/lib/osbuild -p1 < /usr/lib/coreos-assembler/0005-stages-bootc.install-to-filesystem-parametrize-state.patch
195+
patch -d /usr/lib/osbuild -p1 < /usr/lib/coreos-assembler/0006-stages-bootc.install-make-boot-and-root-mount-spec-c.patch
193196

194197
## And then move the files back; supermin appliance creation will need it back
195198
## in the places delivered by the RPM.
196199
mv /usr/lib/osbuild/tools/osbuild-mpp /usr/bin/osbuild-mpp
197200
mv /usr/lib/osbuild/osbuild /usr/lib/python3.13/site-packages/osbuild
198-
mkdir /usr/lib/osbuild/osbuild
201+
mkdir -p /usr/lib/osbuild/osbuild
199202
}
200203

201204
if [ $# -ne 0 ]; then
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
From f4698da5bb76e369ccf5478d65a96862562aa2bb 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 1/6] 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 | 11 +++++++----
11+
stages/org.osbuild.ignition.meta.json | 5 +++++
12+
2 files changed, 12 insertions(+), 4 deletions(-)
13+
14+
diff --git a/stages/org.osbuild.ignition b/stages/org.osbuild.ignition
15+
index 23f91c48..3e5b1903 100755
16+
--- a/stages/org.osbuild.ignition
17+
+++ b/stages/org.osbuild.ignition
18+
@@ -2,9 +2,12 @@
19+
import sys
20+
21+
import osbuild.api
22+
+from osbuild.util import parsing
23+
24+
25+
-def main(tree, options):
26+
+def main(args, options):
27+
+ target = options.get("target", "tree:///boot")
28+
+ location = parsing.parse_location(target, args)
29+
network = options.get("network", [])
30+
31+
# grub, when detecting the '/boot/ignition.firstboot' file
32+
@@ -13,7 +16,7 @@ def main(tree, options):
33+
# itself will be sourced this the 'ignition_network_kcmdline'
34+
# that is also in the "ignition_firstboot" variable can be
35+
# overwritten with the contents of `network`
36+
- with open(f"{tree}/boot/ignition.firstboot", "w", encoding="utf8") as f:
37+
+ with open(f"{location}/ignition.firstboot", "w", encoding="utf8") as f:
38+
if network:
39+
netstr = " ".join(network)
40+
f.write(f"set ignition_network_kcmdline='{netstr}'")
41+
@@ -22,6 +25,6 @@ def main(tree, options):
42+
43+
44+
if __name__ == '__main__':
45+
- args = osbuild.api.arguments()
46+
- r = main(args["tree"], args.get("options", {}))
47+
+ _args = osbuild.api.arguments()
48+
+ r = main(_args, _args["options"])
49+
sys.exit(r)
50+
diff --git a/stages/org.osbuild.ignition.meta.json b/stages/org.osbuild.ignition.meta.json
51+
index 612d59c7..dd295c24 100644
52+
--- a/stages/org.osbuild.ignition.meta.json
53+
+++ b/stages/org.osbuild.ignition.meta.json
54+
@@ -22,6 +22,11 @@
55+
"items": {
56+
"type": "string"
57+
}
58+
+ },
59+
+ "target": {
60+
+ "type": "string",
61+
+ "description": "Location to write the 'ignition.firstboot' file.",
62+
+ "default": "tree:///boot"
63+
}
64+
}
65+
}
66+
--
67+
2.50.1
68+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From bb33a9fbd3d60e807aa8038e5e5e965f827cbcc7 Mon Sep 17 00:00:00 2001
2+
From: jbtrystram <[email protected]>
3+
Date: Mon, 21 Jul 2025 20:33:29 +0200
4+
Subject: [PATCH 5/6] stages/bootc.install-to-filesystem: parametrize stateroot
5+
value
6+
7+
This adds an extra option to make the stateroot name customizable.
8+
9+
Fixes https://github.com/osbuild/osbuild/issues/2151
10+
---
11+
stages/org.osbuild.bootc.install-to-filesystem | 3 +++
12+
...org.osbuild.bootc.install-to-filesystem.meta.json | 12 ++++++------
13+
2 files changed, 9 insertions(+), 6 deletions(-)
14+
15+
diff --git a/stages/org.osbuild.bootc.install-to-filesystem b/stages/org.osbuild.bootc.install-to-filesystem
16+
index 6edcbf8f..3d4c67cc 100755
17+
--- a/stages/org.osbuild.bootc.install-to-filesystem
18+
+++ b/stages/org.osbuild.bootc.install-to-filesystem
19+
@@ -43,6 +43,9 @@ def main(options, inputs, paths):
20+
target_imgref = options.get("target-imgref")
21+
if target_imgref:
22+
pargs.extend(["--target-imgref", target_imgref])
23+
+ stateroot = options.get("stateroot")
24+
+ if stateroot:
25+
+ pargs.extend(["--stateroot", stateroot])
26+
# add target and go
27+
pargs.append(dst)
28+
subprocess.run(pargs, env=env, check=True)
29+
diff --git a/stages/org.osbuild.bootc.install-to-filesystem.meta.json b/stages/org.osbuild.bootc.install-to-filesystem.meta.json
30+
index 02268b27..a5a157c6 100644
31+
--- a/stages/org.osbuild.bootc.install-to-filesystem.meta.json
32+
+++ b/stages/org.osbuild.bootc.install-to-filesystem.meta.json
33+
@@ -7,16 +7,12 @@
34+
"mounted in the \"mounts\" path.",
35+
"Buildhost commands used: bootc"
36+
],
37+
- "capabilities": [
38+
- "CAP_MAC_ADMIN"
39+
- ],
40+
+ "capabilities": ["CAP_MAC_ADMIN"],
41+
"schema_2": {
42+
"inputs": {
43+
"type": "object",
44+
"additionalProperties": false,
45+
- "required": [
46+
- "images"
47+
- ],
48+
+ "required": ["images"],
49+
"properties": {
50+
"images": {
51+
"type": "object",
52+
@@ -44,6 +40,10 @@
53+
"target-imgref": {
54+
"description": "Specify the image to fetch for subsequent updates",
55+
"type": "string"
56+
+ },
57+
+ "stateroot": {
58+
+ "type": "string",
59+
+ "description": "The stateroot name to use. If not specified, defer to bootc's default"
60+
}
61+
}
62+
},
63+
--
64+
2.50.1
65+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From 8e23f3fd16c96f5122d7572efb98776540683df4 Mon Sep 17 00:00:00 2001
2+
From: jbtrystram <[email protected]>
3+
Date: Mon, 21 Jul 2025 20:49:13 +0200
4+
Subject: [PATCH 6/6] stages/bootc.install: make boot and root mount spec
5+
customizable
6+
7+
Allow passing custom mount specs for boot and root. Optional fields.
8+
---
9+
stages/org.osbuild.bootc.install-to-filesystem | 17 +++++++++++++++++
10+
...sbuild.bootc.install-to-filesystem.meta.json | 16 ++++++++++++++--
11+
2 files changed, 31 insertions(+), 2 deletions(-)
12+
13+
diff --git a/stages/org.osbuild.bootc.install-to-filesystem b/stages/org.osbuild.bootc.install-to-filesystem
14+
index 3d4c67cc..634263e2 100755
15+
--- a/stages/org.osbuild.bootc.install-to-filesystem
16+
+++ b/stages/org.osbuild.bootc.install-to-filesystem
17+
@@ -46,6 +46,23 @@ def main(options, inputs, paths):
18+
stateroot = options.get("stateroot")
19+
if stateroot:
20+
pargs.extend(["--stateroot", stateroot])
21+
+ # Passing the flag with an empty value is intentional:
22+
+ # it triggers a supported behaviour where mountspec
23+
+ # kernel arguments are ommited.
24+
+ # See https://github.com/bootc-dev/bootc/pull/1451
25+
+ if "root-mount-spec" in options:
26+
+ root_spec = options["root-mount-spec"]
27+
+ if root_spec == "":
28+
+ pargs.extend(["--root-mount-spec="])
29+
+ else:
30+
+ pargs.extend(["--root-mount-spec", root_spec])
31+
+ if "boot-mount-spec" in options:
32+
+ boot_spec = options["boot-mount-spec"]
33+
+ if boot_spec == "":
34+
+ pargs.extend(["--boot-mount-spec="])
35+
+ else:
36+
+ pargs.extend(["--boot-mount-spec", boot_spec])
37+
+
38+
# add target and go
39+
pargs.append(dst)
40+
subprocess.run(pargs, env=env, check=True)
41+
diff --git a/stages/org.osbuild.bootc.install-to-filesystem.meta.json b/stages/org.osbuild.bootc.install-to-filesystem.meta.json
42+
index a5a157c6..53369218 100644
43+
--- a/stages/org.osbuild.bootc.install-to-filesystem.meta.json
44+
+++ b/stages/org.osbuild.bootc.install-to-filesystem.meta.json
45+
@@ -7,12 +7,16 @@
46+
"mounted in the \"mounts\" path.",
47+
"Buildhost commands used: bootc"
48+
],
49+
- "capabilities": ["CAP_MAC_ADMIN"],
50+
+ "capabilities": [
51+
+ "CAP_MAC_ADMIN"
52+
+ ],
53+
"schema_2": {
54+
"inputs": {
55+
"type": "object",
56+
"additionalProperties": false,
57+
- "required": ["images"],
58+
+ "required": [
59+
+ "images"
60+
+ ],
61+
"properties": {
62+
"images": {
63+
"type": "object",
64+
@@ -44,6 +48,14 @@
65+
"stateroot": {
66+
"type": "string",
67+
"description": "The stateroot name to use. If not specified, defer to bootc's default"
68+
+ },
69+
+ "root-mount-spec": {
70+
+ "type": "string",
71+
+ "description": "Source device specification for the root filesystem. If not provided, the UUID of the target filesystem will be used."
72+
+ },
73+
+ "boot-mount-spec": {
74+
+ "type": "string",
75+
+ "description": "Mount specification for the /boot filesystem. If `/boot` is detected as a mounted partition, then its UUID will be used."
76+
}
77+
}
78+
},
79+
--
80+
2.50.1
81+

0 commit comments

Comments
 (0)