github.com/chipaca/snappy@v0.0.0-20210104084008-1f06296fe8ad/cmd/snap-confine/spread-tests/main/mount-profiles-missing-dst/task.yaml (about)

     1  summary: Check that missing destination directory aborts mount processing
     2  # This is blacklisted on debian because we first have to get the dpkg-vendor patches
     3  systems: [-debian-8]
     4  prepare: |
     5      echo "Having installed the snapd-hacker-toolbelt snap"
     6      snap install snapd-hacker-toolbelt
     7      echo "We can change its mount profile externally to create a read-only bind-mount"
     8      echo "/var/snap/snapd-hacker-toolbelt/common/src -> /var/snap/snapd-hacker-toolbelt/common/dst"
     9      mkdir -p /var/lib/snapd/mount
    10      echo "/var/snap/snapd-hacker-toolbelt/common/src /var/snap/snapd-hacker-toolbelt/common/dst none bind,ro 0 0" > /var/lib/snapd/mount/snap.snapd-hacker-toolbelt.busybox.fstab
    11      echo "We can now create the source directory, missing the destination directory"
    12      mkdir -p /var/snap/snapd-hacker-toolbelt/common/src
    13  execute: |
    14      echo "We can now run busybox.true and expect it to fail"
    15      ( cd / && ! /snap/bin/snapd-hacker-toolbelt.busybox true ) 
    16  restore: |
    17      snap remove --purge snapd-hacker-toolbelt
    18      rm -rf /var/snap/snapd-hacker-toolbelt
    19      rm -f /var/lib/snapd/mount/snap.snapd-hacker-toolbelt.busybox.fstab