Create stages/org.osbuild.chattr stage

Add or remove the immutable bit to the specified mount directory.

The need we have for this right now is for the CoreOS builds where
the immutable bit being set on an OSTree deployment root doesn't
survive the `cp -a --reflink=auto` in the org.osbuild.copy stage when
being copied from the directory tree into the mounted XFS filesystem
we created on the disk image. Thus we have to workaround this loss
of attribute by applying the attribute directly on the mounted
filesystem from the disk.
This commit is contained in:
Luke Yang 2024-01-22 10:28:01 -05:00 committed by Dusty Mabe
parent bd6b8ffb83
commit 477a21043e
3 changed files with 228 additions and 0 deletions

View file

@ -736,6 +736,45 @@
"target": "/boot/efi"
}
]
},
{
"type": "org.osbuild.chattr",
"options": {
"items": {
"mount://root/": {
"immutable": true
}
}
},
"devices": {
"disk": {
"type": "org.osbuild.loopback",
"options": {
"filename": "disk.img",
"partscan": true
}
}
},
"mounts": [
{
"name": "root",
"type": "org.osbuild.xfs",
"source": "disk",
"partition": 4,
"target": "/"
},
{
"name": "ostree.deployment",
"type": "org.osbuild.ostree.deployment",
"options": {
"source": "mount",
"deployment": {
"ref": "ostree/1/1/0",
"osname": "fedora-coreos"
}
}
}
]
}
]
},
@ -945,6 +984,46 @@
"target": "/boot/efi"
}
]
},
{
"type": "org.osbuild.chattr",
"options": {
"items": {
"mount://root/": {
"immutable": true
}
}
},
"devices": {
"disk": {
"type": "org.osbuild.loopback",
"options": {
"filename": "disk.img",
"partscan": true,
"sector-size": 4096
}
}
},
"mounts": [
{
"name": "root",
"type": "org.osbuild.xfs",
"source": "disk",
"partition": 4,
"target": "/"
},
{
"name": "ostree.deployment",
"type": "org.osbuild.ostree.deployment",
"options": {
"source": "mount",
"deployment": {
"ref": "ostree/1/1/0",
"osname": "fedora-coreos"
}
}
}
]
}
]
},

View file

@ -265,6 +265,32 @@ pipelines:
partition:
mpp-format-int: '{image.layout[''EFI-SYSTEM''].partnum}'
target: /boot/efi
- type: org.osbuild.chattr
options:
items:
mount://root/:
immutable: true
devices:
disk:
type: org.osbuild.loopback
options:
filename: disk.img
partscan: true
mounts:
- name: root
type: org.osbuild.xfs
source: disk
partition:
mpp-format-int: '{image.layout[''root''].partnum}'
target: /
- name: ostree.deployment
type: org.osbuild.ostree.deployment
options:
source: mount
deployment:
ref: ostree/1/1/0
osname:
mpp-format-string: '{osname}'
- name: raw-4k-image
build: name:build
stages:
@ -407,6 +433,34 @@ pipelines:
partition:
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].partnum}'
target: /boot/efi
- type: org.osbuild.chattr
options:
items:
mount://root/:
immutable: true
devices:
disk:
type: org.osbuild.loopback
options:
filename: disk.img
partscan: true
sector-size:
mpp-format-int: "{four_k_sector_size}"
mounts:
- name: root
type: org.osbuild.xfs
source: disk
partition:
mpp-format-int: '{image4k.layout[''root''].partnum}'
target: /
- name: ostree.deployment
type: org.osbuild.ostree.deployment
options:
source: mount
deployment:
ref: ostree/1/1/0
osname:
mpp-format-string: '{osname}'
- name: raw-metal-image
build: name:build
stages: