From ff5000240466ceec8038f266507ecbd8113ac121 Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Fri, 4 Oct 2024 08:46:21 -0400 Subject: [PATCH] runonce: modernize snap removal also remove use of snapless-chromium as the ppa has not be updated for 2+ years --- scripts/runonce-entries.sh | 21 +++++---------------- scripts/snapless-firefox.sh | 11 ++++++++--- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/scripts/runonce-entries.sh b/scripts/runonce-entries.sh index 956c2ce6c..c24c7dd55 100755 --- a/scripts/runonce-entries.sh +++ b/scripts/runonce-entries.sh @@ -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...\ @@ -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 @@ -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 diff --git a/scripts/snapless-firefox.sh b/scripts/snapless-firefox.sh index 30192baad..c2bdf65fa 100755 --- a/scripts/snapless-firefox.sh +++ b/scripts/snapless-firefox.sh @@ -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