Skip to content

Commit 30bce85

Browse files
committed
osbuild: support org.osbuild.copy from tree
Upstream PR: osbuild/osbuild#1567
1 parent 410cf90 commit 30bce85

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ patch_osbuild() {
189189
/usr/lib/coreos-assembler/0002-stages-sgdisk-support-label-option.patch \
190190
/usr/lib/coreos-assembler/0001-stages-zipl.inst-improve-kernel-initrd-path-resoluti.patch \
191191
/usr/lib/coreos-assembler/0002-stages-zipl.inst-support-appending-kernel-options.patch \
192+
/usr/lib/coreos-assembler/0001-stages-copy-allow-copying-from-the-tree.patch \
192193
| patch -d /usr/lib/osbuild -p1
193194

194195
# And then move the files back; supermin appliance creation will need it back
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
From 3ecec2e2848a51803e4a9953b132a6eaf4e5043c Mon Sep 17 00:00:00 2001
2+
From: Dusty Mabe <[email protected]>
3+
Date: Thu, 1 Feb 2024 23:14:06 -0500
4+
Subject: [PATCH] stages(copy): allow copying from the tree
5+
6+
It seems like an artifical limitation to prevent copying from one
7+
location in the tree to another. It just so happens we need this
8+
functionality when building CoreOS images because we want to take
9+
a file embedded in the OSTree at a location and copy it to another
10+
location in the tree. The particular example here is we want to copy
11+
/usr/share/coreos-assembler/platforms.json -> /boot/coreos/platforms.json
12+
See https://github.com/coreos/coreos-assembler/pull/3709
13+
14+
Allowing to copy from/to the tree we can now do something like:
15+
16+
```
17+
- type: org.osbuild.copy
18+
options:
19+
paths:
20+
- from: tree:///usr/share/coreos-assembler/platforms.json
21+
to: tree:///boot/coreos/platforms.json
22+
mounts:
23+
- name: ostree.deployment
24+
type: org.osbuild.ostree.deployment
25+
options:
26+
deployment:
27+
ref: ostree/1/1/0
28+
osname:
29+
fedora-coreos
30+
```
31+
---
32+
stages/org.osbuild.copy | 17 +++++++++++++----
33+
1 file changed, 13 insertions(+), 4 deletions(-)
34+
35+
diff --git a/stages/org.osbuild.copy b/stages/org.osbuild.copy
36+
index 3c137af5..d476efdb 100755
37+
--- a/stages/org.osbuild.copy
38+
+++ b/stages/org.osbuild.copy
39+
@@ -45,9 +45,18 @@ SCHEMA_2 = r"""
40+
"required": ["from", "to"],
41+
"properties": {
42+
"from": {
43+
- "type": "string",
44+
- "description": "The source",
45+
- "pattern": "^input:\/\/[^\/]+\/"
46+
+ "oneOf": [
47+
+ {
48+
+ "type": "string",
49+
+ "description": "The source, if an input",
50+
+ "pattern": "^input:\/\/[^\/]+\/"
51+
+ },
52+
+ {
53+
+ "type": "string",
54+
+ "description": "The source, if the tree",
55+
+ "pattern": "^tree:\/\/\/"
56+
+ }
57+
+ ]
58+
},
59+
"to": {
60+
"oneOf": [
61+
@@ -58,7 +67,7 @@ SCHEMA_2 = r"""
62+
},
63+
{
64+
"type": "string",
65+
- "description": "The destination, if a tree",
66+
+ "description": "The destination, if the tree",
67+
"pattern": "^tree:\/\/\/"
68+
}
69+
]
70+
--
71+
2.43.0
72+

0 commit comments

Comments
 (0)