Skip to content

Commit

Permalink
runonce: modernize snap removal
Browse files Browse the repository at this point in the history
also remove use of snapless-chromium as the ppa has not be updated for 2+ years
  • Loading branch information
theofficialgman committed Oct 4, 2024
1 parent 4fcf75e commit ff50002
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
21 changes: 5 additions & 16 deletions scripts/runonce-entries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if command -v snap; then
if printf '%s\n' "$minimumver" "$__os_release" | sort -CV; then
# 20.04 and up has snaps, run the scripts
description="Do you want to remove the snap store? If unsure, think of it as\
description="Do you want to remove all snaps and the snap store? If unsure, think of the snap store as\
\nbloatware from Canonical\
\nIt's controversial for a few reasons:\
\n - the store is closed source, which is a bit weird for a Linux company...\
Expand All @@ -82,25 +82,15 @@ if command -v snap; then
\nbuilding from source whenever possible.\
\nSo as you can probably tell, we're extremely biased against\
\nit and would recommend removing it. But the choice is yours:\
\n \n Do you want to remove the Snap Store?"
\n \n Do you want to remove the Snap Store?\
\nThis script will also install the official Firefox PPA\
\ninstead of the Snap version on 22.04 and newer."
table=("yes" "no")
userinput_func "$description" "${table[@]}"
if [[ $output == "yes" ]]; then
echo -e "\e[32mRemoving the Snap store...\e[0m"
case "$__os_codename" in
# placeholder code in case we decide to remove the "only run this on 20.04 and up" bit
# we should probably add a check to make sure it doesn't remove snap if the user is on something like our free Oracle VMs
# bionic)
# sudo apt purge snapd -y && sudo apt autoremove --purge -y
# ;;
focal | hirsute | impish)
bash -c "$(curl https://raw.githubusercontent.com/$repository_username/L4T-Megascript/$repository_branch/scripts/snapless-chromium.sh)"
;;
noble)
bash -c "$(curl https://raw.githubusercontent.com/$repository_username/L4T-Megascript/$repository_branch/scripts/snapless-firefox.sh)"
;;
*)
bash -c "$(curl https://raw.githubusercontent.com/$repository_username/L4T-Megascript/$repository_branch/scripts/snapless-chromium.sh)"
bionic | focal | jammy | noble)
bash -c "$(curl https://raw.githubusercontent.com/$repository_username/L4T-Megascript/$repository_branch/scripts/snapless-firefox.sh)"
;;
esac
Expand All @@ -112,7 +102,6 @@ if command -v snap; then
sudo apt --fix-broken install
else
echo "Decided to keep the Snap store..."
echo "If you ever change your mind, run the initial setup script again"
fi
fi
fi
Expand Down
11 changes: 8 additions & 3 deletions scripts/snapless-firefox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ Pin-Priority: -1' | sudo tee /etc/apt/preferences.d/firefox >/dev/null
fi
# a standard apt install will not switch an already installed 1:1snap* package to a XXX firefox package since this would constitute a downgrade
# the pin priorities added above will prevent Ubuntu repository firefox packages from even showing or installing in the future but we still need to do the initial downgrade from 1:1snap* to the ppa version of firefox
sudo apt --allow-downgrades install firefox -y || exit 1
# only firefox-esr is supported on ubuntu bionic
if [[ "$__os_release" == "18.04" ]]; then
sudo apt --allow-downgrades install firefox-esr -y || exit 1
else
sudo apt --allow-downgrades install firefox -y || exit 1
fi
;;
*)
# Add repository source to apt sources.list
debian_ppa_installer "mozillateam/ppa" "bionic" "0AB215679C571D1C8325275B9BDB3D89CE49EC21" || exit 1
debian_ppa_installer "mozillateam/ppa" "focal" "0AB215679C571D1C8325275B9BDB3D89CE49EC21" || exit 1
# allow unattented upgrades to upgrade from this ppa if unattented upgrades is enabled
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:bionic";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox >/dev/null
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:focal";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox >/dev/null
sudo apt install firefox -y || exit 1
;;
esac
Expand Down

0 comments on commit ff50002

Please sign in to comment.