debian-forge/osbuild
Dusty Mabe bd6b8ffb83 mounts/ostree.deployment: support deployments on mount
Instead of operating directly on the tree for a stage we can operate
on a mount too. This is useful in the case where operating on the
directory tree of files isn't sufficient and the modifications need
to be made directly to the filesystems on the disk image that we are
creating.

One such example of this is we are having a problem right now 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.

In this change here we also add a check in osbuild/mounts.py to not
attempt a umount of the root of the mounts directory if that path
is no longer a mountpoint, which can happen when the umount -R
from the mounts/org.osbuild.ostree.deployment also removes the
overmount.

Here is an example of how this would be used:

```
  - type: org.osbuild.chattr
    options:
      immutable: true
      path: mount://root/
    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:
            osname: fedora-coreos
            ref: ostree/1/1/0
```

The initial mount on `/` is the filesystem from the root partition
on the disk. The second mount (of type org.osbuild.ostree.deployment)
then reconfigures things similar to how an OSTree system is set up.
2024-01-31 16:46:01 -05:00
..
formats format/v2: add new "partition" field to "describe_mount" 2023-12-22 10:18:29 -05:00
testutil test: add new testutil.assert_jsonschema_error_contains() helper 2024-01-23 12:00:59 +01:00
util create org.osbuild.ostree.aleph stage 2023-12-19 17:58:39 +01:00
__init__.py Post release version bump 2024-01-31 17:48:02 +00:00
__main__.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
api.py Fix errors reported by new version of mypy 2023-04-12 11:57:18 +02:00
buildroot.py add --break for requesting a debug shell 2024-01-10 08:39:27 -08:00
devices.py osbuild: error when {Device,Mount} is modified after creation 2024-01-19 02:54:26 +01:00
host.py tox: add tox 2023-08-01 15:01:13 +02:00
inputs.py osbuild: error when {Device,Mount} is modified after creation 2024-01-19 02:54:26 +01:00
loop.py devices/loopback: make setting sector_size meaningful 2023-11-29 10:37:08 +01:00
main_cli.py osbuild: add "mypy-strict" check 2024-01-23 12:01:45 +01:00
meta.py osbuild. add comment why AST is used and not importlib 2023-11-22 09:52:47 +01:00
mixins.py osbuild: error when {Device,Mount} is modified after creation 2024-01-19 02:54:26 +01:00
monitor.py osbuild: improve monitor docstrings/signatures 2023-11-28 09:56:56 +01:00
mounts.py mounts/ostree.deployment: support deployments on mount 2024-01-31 16:46:01 -05:00
objectstore.py objectstore: add new skip_preserve_owner to Object.export() 2023-12-20 09:28:39 +01:00
pipeline.py add --break for requesting a debug shell 2024-01-10 08:39:27 -08:00
remoteloop.py loop: use LOOP_CONFIGURE instead of LOOP_SET_FD 2023-05-05 15:42:47 +02:00
sources.py sources: rename download -> fetch_all 2024-01-26 09:58:48 +01:00