Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to patch ubuntu-core.snap at revision 122 to support the new hostfs mount point
#!/bin/sh
if [ "$(id -u)" != 0 ]; then
echo "This script requires root access, run it with sudo please"
exit 1
fi
core_snap=/var/lib/snapd/snaps/ubuntu-core_122.snap
case $(md5sum $core_snap | cut -d ' ' -f 1) in
8170579dcd67c5eceb151695c21cdab1)
echo "Patching ubuntu-core snap to include hostfs mount point"
tmp="$(mktemp -d)"
trap 'rm -rf $tmp' EXIT
cd "$tmp" || exit 1
unsquashfs "$core_snap"
mkdir -p squashfs-root/var/lib/snapd/hostfs
( cd "$tmp/squashfs-root" && mksquashfs . "$core_snap" -noappend -comp xz -no-xattrs )
umount /snap/ubuntu-core/122
mount $core_snap /snap/ubuntu-core/122
;;
4ac2f3a98f05acdd72bdf0b14ee6719d)
echo "You are good to go, no patching is required"
;;
*)
echo "Hmm, unsure what to do here"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment