Last active
June 4, 2020 15:24
-
-
Save maximilize/5043fc09614438791dce3406cc6b69f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# make snappy installations persistent in qubes app vm's | |
# 1. copy this script to /rw/config/snap.sh and make it executable. | |
# 2. add this line to your rc.local: /rw/config/snap.sh --qubes-init | |
if ! test -e /var/lib/snapd/.qubes; then | |
sudo systemctl -q stop snapd.service | |
sudo mkdir -p /rw/snap/{etc,lib,mount} | |
sudo touch /rw/snap/lib/.qubes | |
sudo mount -o bind /rw/snap/lib /var/lib/snapd | |
sudo mount -o bind /rw/snap/mount /snap | |
cd /rw/snap/etc/ | |
for m in $(ls); do | |
sudo cp -a $m /etc/systemd/system | |
sudo systemctl -q enable $m | |
sudo systemctl -q start $m | |
done | |
if [ ! -e /usr/local/bin/snap ]; then | |
sudo ln -s /rw/config/snap.sh /usr/local/bin/snap | |
fi | |
fi | |
if [ "$1" = "--qubes-init" ]; then | |
exit 0 | |
fi | |
/usr/bin/snap $@ | |
rv=$? | |
sudo rm -f /rw/snap/etc/*.mount | |
f=$(ls /etc/systemd/system/multi-user.target.wants/snap-*.mount 2>/dev/null) | |
[ ! -z "$f" ] && sudo cp -L $f /rw/snap/etc | |
exit $rv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment