Skip to content

Commit 01b2a13

Browse files
committed
osbuild/bootc: properly label the mount points
Properly label the filesystem mount points before calling bootc, otherwise `/sysroot` and `/boot` end up being `unlabeled_t`
1 parent 1f10674 commit 01b2a13

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

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

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,64 @@ pipelines:
262262
partition:
263263
mpp-format-int: '{image.layout[''boot''].partnum}'
264264
target: /boot-mount-point
265+
# Set the context of the root of disk so that we avoid unlabeled_t files.
266+
# Here we make sure to not mount the boot partition because we want to label
267+
# the directory mount point
268+
# https://github.com/coreos/fedora-coreos-tracker/issues/1772
269+
- type: org.osbuild.selinux
270+
options:
271+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
272+
target: mount://root/
273+
inputs:
274+
tree:
275+
type: org.osbuild.tree
276+
origin: org.osbuild.pipeline
277+
references:
278+
- name:deployed-tree
279+
devices:
280+
disk:
281+
type: org.osbuild.loopback
282+
options:
283+
filename: disk.img
284+
partscan: true
285+
mounts:
286+
- name: root
287+
type: org.osbuild.xfs
288+
source: disk
289+
partition:
290+
mpp-format-int: '{image.layout[''root''].partnum}'
291+
target: /
292+
# Then we mount le boot parition and label again so the /boot/efi
293+
# mount point is labeled properly
294+
- type: org.osbuild.selinux
295+
options:
296+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
297+
target: mount://root/boot
298+
inputs:
299+
tree:
300+
type: org.osbuild.tree
301+
origin: org.osbuild.pipeline
302+
references:
303+
- name:deployed-tree
304+
devices:
305+
disk:
306+
type: org.osbuild.loopback
307+
options:
308+
filename: disk.img
309+
partscan: true
310+
mounts:
311+
- name: root
312+
type: org.osbuild.xfs
313+
source: disk
314+
partition:
315+
mpp-format-int: '{image.layout[''root''].partnum}'
316+
target: /
317+
- name: boot
318+
type: org.osbuild.ext4
319+
source: disk
320+
partition:
321+
mpp-format-int: '{image.layout[''boot''].partnum}'
322+
target: /boot
265323
# Use bootc install to-filesystem to install the ostree content from the container image
266324
# inside our disc image
267325
- type: org.osbuild.bootc.install-to-filesystem
@@ -474,6 +532,64 @@ pipelines:
474532
partition:
475533
mpp-format-int: '{image4k.layout[''boot''].partnum}'
476534
target: /boot-mount-point
535+
# Set the context of the root of disk so that we avoid unlabeled_t files.
536+
# Here we make sure to not mount the boot partition because we want to label
537+
# the directory mount point
538+
# https://github.com/coreos/fedora-coreos-tracker/issues/1772
539+
- type: org.osbuild.selinux
540+
options:
541+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
542+
target: mount://root/
543+
inputs:
544+
tree:
545+
type: org.osbuild.tree
546+
origin: org.osbuild.pipeline
547+
references:
548+
- name:deployed-tree
549+
devices:
550+
disk:
551+
type: org.osbuild.loopback
552+
options:
553+
filename: disk.img
554+
partscan: true
555+
mounts:
556+
- name: root
557+
type: org.osbuild.xfs
558+
source: disk
559+
partition:
560+
mpp-format-int: '{image.layout[''root''].partnum}'
561+
target: /
562+
# Then we mount le boot parition and label again so the /boot/efi
563+
# mount point is labeled properly
564+
- type: org.osbuild.selinux
565+
options:
566+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
567+
target: mount://root/boot
568+
inputs:
569+
tree:
570+
type: org.osbuild.tree
571+
origin: org.osbuild.pipeline
572+
references:
573+
- name:deployed-tree
574+
devices:
575+
disk:
576+
type: org.osbuild.loopback
577+
options:
578+
filename: disk.img
579+
partscan: true
580+
mounts:
581+
- name: root
582+
type: org.osbuild.xfs
583+
source: disk
584+
partition:
585+
mpp-format-int: '{image.layout[''root''].partnum}'
586+
target: /
587+
- name: boot
588+
type: org.osbuild.ext4
589+
source: disk
590+
partition:
591+
mpp-format-int: '{image.layout[''boot''].partnum}'
592+
target: /boot
477593
# Use bootc install to-filesystem to install the ostree content from the container image
478594
# inside our disc image
479595
- type: org.osbuild.bootc.install-to-filesystem

0 commit comments

Comments
 (0)