Skip to content

Commit fcf8045

Browse files
committed
osbuild/ bootc-install: symlink aleph files
Create symlinks to the aleph file created by bootc so our tests and tooling find the aleph at the expected path. Shipping the osbuild patches until [1] is merged. [1]: osbuild/osbuild#2226
1 parent ad581ef commit fcf8045

File tree

4 files changed

+210
-13
lines changed

4 files changed

+210
-13
lines changed

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ patch_osbuild() {
208208
/usr/lib/coreos-assembler/0002-osbuild-util-containers.py-rename-variable.patch \
209209
/usr/lib/coreos-assembler/0003-osbuild-util-containers.py-drop-copy-when-using-cont.patch \
210210
/usr/lib/coreos-assembler/0004-drop-remove_signatures-from-org.osbuild.container-de.patch \
211-
/usr/lib/coreos-assembler/0005-tools-osbuild-mpp-support-mpp-resolve-for-org.osbuil.patch |
211+
/usr/lib/coreos-assembler/0005-tools-osbuild-mpp-support-mpp-resolve-for-org.osbuil.patch \
212+
/usr/lib/coreos-assembler/0001-stages-add-new-link-stage.patch |
212213
patch -d /usr/lib/osbuild -p1
213214

214215
# And then move the files back; supermin appliance creation will need it back
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
From f53b6e1c5a8f0c26ee4f92641274a8cdba4b1d5a Mon Sep 17 00:00:00 2001
2+
From: jbtrystram <jbtrystram@redhat.com>
3+
Date: Tue, 21 Oct 2025 13:13:57 +0200
4+
Subject: [PATCH 1/2] stages: add new link stage
5+
6+
This introduces a new stage, `org.osbuild.ln`, for creating
7+
links within the filesystem tree.
8+
9+
This takes a list of paths, each with a `target` and a `link_name`
10+
parameters, inspired by the copy stage.
11+
12+
The target is a simple string because we want the link to be either
13+
absolute or relative.
14+
---
15+
stages/org.osbuild.ln | 31 ++++++++++++++++
16+
stages/org.osbuild.ln.meta.json | 66 +++++++++++++++++++++++++++++++++
17+
2 files changed, 97 insertions(+)
18+
create mode 100755 stages/org.osbuild.ln
19+
create mode 100644 stages/org.osbuild.ln.meta.json
20+
21+
diff --git a/stages/org.osbuild.ln b/stages/org.osbuild.ln
22+
new file mode 100755
23+
index 00000000..8268685d
24+
--- /dev/null
25+
+++ b/stages/org.osbuild.ln
26+
@@ -0,0 +1,31 @@
27+
+#!/usr/bin/python3
28+
+import os
29+
+import sys
30+
+
31+
+import osbuild.api
32+
+from osbuild.util import parsing
33+
+
34+
+
35+
+def main(args, options):
36+
+ items = options["paths"]
37+
+
38+
+ for path in items:
39+
+ target = path["target"]
40+
+ link_name = parsing.parse_location(path["link_name"], args)
41+
+ symbolic = path.get("symbolic", False)
42+
+
43+
+ print(f"Linking '{link_name}' -> '{target}'")
44+
+ if symbolic:
45+
+ print(f"Creating symbolic link: '{link_name}' -> '{target}'")
46+
+ os.symlink(target, link_name)
47+
+ else:
48+
+ print(f"Creating hard link: '{link_name}' -> '{target}'")
49+
+ os.link(target, link_name)
50+
+
51+
+ return 0
52+
+
53+
+
54+
+if __name__ == '__main__':
55+
+ _args = osbuild.api.arguments()
56+
+ r = main(_args, _args["options"])
57+
+ sys.exit(r)
58+
diff --git a/stages/org.osbuild.ln.meta.json b/stages/org.osbuild.ln.meta.json
59+
new file mode 100644
60+
index 00000000..81f297be
61+
--- /dev/null
62+
+++ b/stages/org.osbuild.ln.meta.json
63+
@@ -0,0 +1,66 @@
64+
+{
65+
+ "summary": "Create links",
66+
+ "description": [
67+
+ "Creates links within the tree or mounts. The target and link_name are specified as URLs.",
68+
+ "Only allows tree or mounts URLs."
69+
+ ],
70+
+ "schema_2": {
71+
+ "options": {
72+
+ "additionalProperties": false,
73+
+ "required": [
74+
+ "paths"
75+
+ ],
76+
+ "properties": {
77+
+ "paths": {
78+
+ "description": "Array of links to create.",
79+
+ "type": "array",
80+
+ "minItems": 1,
81+
+ "items": {
82+
+ "type": "object",
83+
+ "additionalProperties": false,
84+
+ "required": [
85+
+ "target",
86+
+ "link_name"
87+
+ ],
88+
+ "properties": {
89+
+ "target": {
90+
+ "type": "string",
91+
+ "description": "The target for the link, relative or absolute"
92+
+ },
93+
+ "link_name": {
94+
+ "oneOf": [
95+
+ {
96+
+ "type": "string",
97+
+ "description": "The link path, if in a mount",
98+
+ "pattern": "^mount://[^/]+/"
99+
+ },
100+
+ {
101+
+ "type": "string",
102+
+ "description": "The link path, if in a tree",
103+
+ "pattern": "^tree://"
104+
+ }
105+
+ ]
106+
+ },
107+
+ "symbolic": {
108+
+ "type": "boolean",
109+
+ "description": "Use a symbolic link instead of hard-linking. Defaults to False.",
110+
+ "default": false
111+
+ }
112+
+ }
113+
+ }
114+
+ }
115+
+ }
116+
+ },
117+
+ "devices": {
118+
+ "type": "object",
119+
+ "additionalProperties": true
120+
+ },
121+
+ "mounts": {
122+
+ "type": "array"
123+
+ },
124+
+ "inputs": {
125+
+ "type": "object",
126+
+ "additionalProperties": true
127+
+ }
128+
+ }
129+
+}
130+
--
131+
2.51.0
132+

src/cmdlib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@ runvm() {
778778
# include COSA in the image
779779
find /usr/lib/coreos-assembler/ -type f > "${vmpreparedir}/hostfiles"
780780
cat <<EOF >> "${vmpreparedir}/hostfiles"
781-
/usr/lib/osbuild/stages/org.osbuild.coreos.live-artifacts.mono
782-
/usr/lib/osbuild/stages/org.osbuild.coreos.live-artifacts.mono.meta.json
781+
/usr/lib/osbuild/stages/org.osbuild.ln
782+
/usr/lib/osbuild/stages/org.osbuild.ln.meta.json
783783
EOF
784784

785785
# and include all GPG keys

src/osbuild-manifests/coreos.osbuild.x86_64.bootc.mpp.yaml

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,20 @@ pipelines:
267267
- type: org.osbuild.bootc.install-to-filesystem
268268
inputs:
269269
images:
270-
type: org.osbuild.containers
271-
origin: org.osbuild.pipeline
272-
references:
273-
name:oci-archive:
274-
name: coreos.ociarchive
270+
mpp-if: ociarchive != ''
271+
then:
272+
type: org.osbuild.containers
273+
origin: org.osbuild.pipeline
274+
references:
275+
name:oci-archive:
276+
name: coreos.ociarchive
277+
else:
278+
type: org.osbuild.containers
279+
origin: org.osbuild.source
280+
mpp-resolve-images:
281+
images:
282+
- source: $container_repo
283+
tag: $container_tag
275284
options:
276285
kernel-args:
277286
- '$ignition_firstboot'
@@ -333,6 +342,28 @@ pipelines:
333342
partition:
334343
mpp-format-int: '{image.layout[''boot''].partnum}'
335344
target: /boot
345+
- type: org.osbuild.ln
346+
options:
347+
paths:
348+
- target: ".bootc-aleph.json"
349+
link_name: "mount://root/.coreos-aleph-version.json"
350+
symbolic: true
351+
- target: ".bootc-aleph.json"
352+
link_name: "mount://root/.aleph-version.json"
353+
symbolic: true
354+
devices:
355+
disk:
356+
type: org.osbuild.loopback
357+
options:
358+
filename: disk.img
359+
partscan: true
360+
mounts:
361+
- name: root
362+
type: org.osbuild.xfs
363+
source: disk
364+
partition:
365+
mpp-format-int: '{image.layout[''root''].partnum}'
366+
target: /
336367
- name: raw-4k-image
337368
build:
338369
mpp-format-string: '{buildroot}'
@@ -448,11 +479,20 @@ pipelines:
448479
- type: org.osbuild.bootc.install-to-filesystem
449480
inputs:
450481
images:
451-
type: org.osbuild.containers
452-
origin: org.osbuild.pipeline
453-
references:
454-
name:oci-archive:
455-
name: coreos.ociarchive
482+
mpp-if: ociarchive != ''
483+
then:
484+
type: org.osbuild.containers
485+
origin: org.osbuild.pipeline
486+
references:
487+
name:oci-archive:
488+
name: coreos.ociarchive
489+
else:
490+
type: org.osbuild.containers
491+
origin: org.osbuild.source
492+
mpp-resolve-images:
493+
images:
494+
- source: $container_repo
495+
tag: $container_tag
456496
options:
457497
kernel-args:
458498
- '$ignition_firstboot'
@@ -518,6 +558,30 @@ pipelines:
518558
partition:
519559
mpp-format-int: '{image4k.layout[''boot''].partnum}'
520560
target: /boot
561+
- type: org.osbuild.ln
562+
options:
563+
paths:
564+
- target: ".bootc-aleph.json"
565+
link_name: "mount://root/.coreos-aleph-version.json"
566+
symbolic: true
567+
- target: ".bootc-aleph.json"
568+
link_name: "mount://root/.aleph-version.json"
569+
symbolic: true
570+
devices:
571+
disk:
572+
type: org.osbuild.loopback
573+
options:
574+
filename: disk.img
575+
partscan: true
576+
sector-size:
577+
mpp-format-int: "{four_k_sector_size}"
578+
mounts:
579+
- name: root
580+
type: org.osbuild.xfs
581+
source: disk
582+
partition:
583+
mpp-format-int: '{image4k.layout[''root''].partnum}'
584+
target: /
521585
- mpp-import-pipelines:
522586
path: platform.aliyun.ipp.yaml
523587
- mpp-import-pipelines:

0 commit comments

Comments
 (0)