github.com/kubiko/snapd@v0.0.0-20201013125620-d4f3094d9ddf/cmd/snap-confine/spread-tests/main/mount-profiles-missing-src/task.yaml (about)

     1  summary: Check that missing source 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 destination directory, missing the source directory"
    12      mkdir -p /var/snap/snapd-hacker-toolbelt/common/dst
    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