Skip to content

Commit 096dc64

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 09f7d26 commit 096dc64

File tree

3 files changed

+135
-2
lines changed

3 files changed

+135
-2
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
From e5db53cf8924d705a95702b404929d5d88c91256 Mon Sep 17 00:00:00 2001
2+
From: jbtrystram <[email protected]>
3+
Date: Tue, 21 Oct 2025 13:13:57 +0200
4+
Subject: [PATCH] stages: add new symlink stage
5+
6+
This introduces a new stage, `org.osbuild.symlink`, for creating
7+
symbolic links within the filesystem tree.
8+
9+
This takes a list of paths, each with a `source` and a `link`
10+
parameters, inspired by the copy stage.
11+
12+
The source is a simple string because we want the link to be either
13+
absolute or relative.
14+
---
15+
stages/org.osbuild.symlink | 25 +++++++++++++
16+
stages/org.osbuild.symlink.meta.json | 56 ++++++++++++++++++++++++++++
17+
2 files changed, 81 insertions(+)
18+
create mode 100755 stages/org.osbuild.symlink
19+
create mode 100644 stages/org.osbuild.symlink.meta.json
20+
21+
diff --git a/stages/org.osbuild.symlink b/stages/org.osbuild.symlink
22+
new file mode 100755
23+
index 000000000..cd7ccc2f6
24+
--- /dev/null
25+
+++ b/stages/org.osbuild.symlink
26+
@@ -0,0 +1,25 @@
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+
+ src = path["source"]
40+
+ link = parsing.parse_location(path["link"], args)
41+
+
42+
+ print(f"linking'{link}' -> '{src}'")
43+
+ os.symlink(src, link)
44+
+
45+
+ return 0
46+
+
47+
+
48+
+if __name__ == '__main__':
49+
+ _args = osbuild.api.arguments()
50+
+ r = main(_args, _args["options"])
51+
+ sys.exit(r)
52+
diff --git a/stages/org.osbuild.symlink.meta.json b/stages/org.osbuild.symlink.meta.json
53+
new file mode 100644
54+
index 000000000..2b7b990a9
55+
--- /dev/null
56+
+++ b/stages/org.osbuild.symlink.meta.json
57+
@@ -0,0 +1,56 @@
58+
+{
59+
+ "summary": "Create symlinks",
60+
+ "description": [
61+
+ "Creates symbolic links within the tree or mounts. The source and destination are specified as URLs.",
62+
+ "Only allows tree or mounts URLs."
63+
+ ],
64+
+ "schema_2": {
65+
+ "options": {
66+
+ "additionalProperties": false,
67+
+ "required": ["paths"],
68+
+ "properties": {
69+
+ "paths": {
70+
+ "description": "Array of symlinks to create.",
71+
+ "type": "array",
72+
+ "minItems": 1,
73+
+ "items": {
74+
+ "type": "object",
75+
+ "additionalProperties": false,
76+
+ "required": ["source", "link"],
77+
+ "properties": {
78+
+ "source": {
79+
+ "type": "string",
80+
+ "description": "The source of the link, relative or absolute"
81+
+ },
82+
+ "link": {
83+
+ "oneOf": [
84+
+ {
85+
+ "type": "string",
86+
+ "description": "The link path, if in a mount",
87+
+ "pattern": "^mount://[^/]+/"
88+
+ },
89+
+ {
90+
+ "type": "string",
91+
+ "description": "The link path, if in a tree",
92+
+ "pattern": "^tree:///"
93+
+ }
94+
+ ]
95+
+ }
96+
+ }
97+
+ }
98+
+ }
99+
+ }
100+
+ },
101+
+ "devices": {
102+
+ "type": "object",
103+
+ "additionalProperties": true
104+
+ },
105+
+ "mounts": {
106+
+ "type": "array"
107+
+ },
108+
+ "inputs": {
109+
+ "type": "object",
110+
+ "additionalProperties": true
111+
+ }
112+
+ }
113+
+}

src/cmdlib.sh

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

781781
# and include all GPG keys

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,26 @@ pipelines:
333333
partition:
334334
mpp-format-int: '{image.layout[''boot''].partnum}'
335335
target: /boot
336+
- type: org.osbuild.symlink
337+
options:
338+
paths:
339+
- source: ".bootc-aleph.json"
340+
link: "mount://root/.coreos-aleph-version.json"
341+
- source: ".bootc-aleph.json"
342+
link: "mount://root/.aleph-version.json"
343+
devices:
344+
disk:
345+
type: org.osbuild.loopback
346+
options:
347+
filename: disk.img
348+
partscan: true
349+
mounts:
350+
- name: root
351+
type: org.osbuild.xfs
352+
source: disk
353+
partition:
354+
mpp-format-int: '{image.layout[''root''].partnum}'
355+
target: /
336356
- name: raw-4k-image
337357
build:
338358
mpp-format-string: '{buildroot}'

0 commit comments

Comments
 (0)