1
summary: Check that read-write bind mounts can be created
2
# This is blacklisted on debian because we first have to get the dpkg-vendor patches
5
echo "Having installed the snapd-hacker-toolbelt snap"
6
snap install snapd-hacker-toolbelt
7
echo "We can connect it to the mount-observe slot from the core"
8
snap connect snapd-hacker-toolbelt:mount-observe ubuntu-core:mount-observe
9
echo "We can change its mount profile externally to create a read-only bind-mount"
10
echo "/snap/snapd-hacker-toolbelt/current/src -> /snap/snapd-hacker-toolbelt/current/dst"
11
mkdir -p /var/lib/snapd/mount
12
echo "/snap/snapd-hacker-toolbelt/current/src /snap/snapd-hacker-toolbelt/current/dst none bind,rw 0 0" > /var/lib/snapd/mount/snap.snapd-hacker-toolbelt.busybox.fstab
15
echo "We can now look at the .id file in the destination directory"
16
[ "$(/snap/bin/snapd-hacker-toolbelt.busybox cat /snap/snapd-hacker-toolbelt/current/dst/.id)" = "source" ]
17
echo "As well as the current mount points"
18
# FIXME: this doesn't show 'rw', bind mounts confuse most tools and it
19
# seems that busybox is not any different here.
20
/snap/bin/snapd-hacker-toolbelt.busybox mount | grep snapd-hacker-toolbelt
22
snap remove snapd-hacker-toolbelt
23
rm -rf /var/snap/snapd-hacker-toolbelt
24
rm -f /var/lib/snapd/mount/snap.snapd-hacker-toolbelt.busybox.fstab