Skip to content

Instantly share code, notes, and snippets.

@tomdavidson
Last active January 30, 2024 08:11
Show Gist options
  • Save tomdavidson/33b42eb24a23adff47b7afe4387f8cf5 to your computer and use it in GitHub Desktop.
Save tomdavidson/33b42eb24a23adff47b7afe4387f8cf5 to your computer and use it in GitHub Desktop.
snapd liberation without waiting for 24.04
#!/usr/bin/env bash
# Ditch snap on kubuntu - including the bs ubuntu does
# Run on a new systems without downloading by
# `$ wget -O - https://gist.githubusercontent.com/tomdavidson/33b42eb24a23adff47b7afe4387f8cf5/raw/0e7e298f519e894790c8b46d667b0210033f0c11/no-snap.sh | bash`
sudo systemctl disable snapd
sudo systemctl disable snapd.service
sudo systemctl disable snapd.socket
sudo systemctl disable snapd.seeded.service
# cant figure out how to get the snap removeal to unmount tis read only drive.
sudo apt remove -y --purge firefox
sudo umount /var/snap/firefox/common/host-hunspell
# brutish but snap does not seem to make this easy when snaps depend on each other.
while [ -n "$(snap list | awk '!/^Name/ {print $1}')" ]
do
SNAPS=( $(snap list | awk '!/^Name/ {print $1}') )
for s in "${SNAPS[@]}"
do
sudo snap disable "$s"
sudo snap remove --purge "$s"
done
done;
sudo rm -rf /etc/systemd/system/snapd.mounts.target.wants
sudo apt remove --purge -y snapd gnome-software-plugin-snap plasma-discover-backend-snap
sudo rm -rf /var/cache/snapd/ /var/snap/
sudo tee /etc/apt/preferences.d/no-snapd > /dev/null << ENDOFFILE
Package: snapd
Pin: release *
Pin-Priority: -10
ENDOFFILE
sudo apt update -y
sudo apt install -y plasma-discover plasma-discover-backend-flatpak plasma-discover-backend-fwupd
sudo apt autoremove -y
# Installing the ff replacement is really part of going snap-free so just include it hear before
# anything else tries to install ff.
sudo apt purge -y firefox
sudo add-apt-repository -y ppa:mozillateam/ppa
sudo tee /etc/apt/preferences.d/no-snap-firefox > /dev/null << ENDOFFILE
Package: firefox*
Pin: release o=Ubuntu*
Pin-Priority: -10
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
ENDOFFILE
sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox > /dev/null << ENDOFFILE
Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";
ENDOFFILE
sudo apt update -y
sudo apt install -y -t 'o=LP-PPA-mozillateam' firefox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment