From 67451248eb9f067577f8137e8f50c18c25c4e55c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 9 Feb 2019 13:59:03 -0800 Subject: [PATCH] upgrades: Fix premature adding of buster-backports sources It is incorrect to check for backports availability, FreedomBox systems got added buster-backports sources prematurely. This will lead to apt update failures resulting in FreedomBox becoming unable to install new apps. Fix this by removing old sources and adding new sources only after performing (this time correct) backports URL check. Closes: #1496. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- actions/upgrades | 6 +++++- debian/postrm | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/actions/upgrades b/actions/upgrades index 2ca807f76..4ddfa606d 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -147,7 +147,11 @@ deb-src {protocol}://deb.debian.org/debian buster-backports main def _check_and_backports_sources(): """Add buster backports sources after checking if it is available.""" - sources_list = '/etc/apt/sources.list.d/freedombox.list' + old_sources_list = '/etc/apt/sources.list.d/freedombox.list' + if os.path.exists(old_sources_list): + os.remove(old_sources_list) + + sources_list = '/etc/apt/sources.list.d/freedombox2.list' if os.path.exists(sources_list): print('Repositories list up-to-date. Skipping update.') return diff --git a/debian/postrm b/debian/postrm index 98fc69274..decc0700f 100755 --- a/debian/postrm +++ b/debian/postrm @@ -14,6 +14,10 @@ purge) rm -f /etc/apt/sources.list.d/freedombox.list fi + if [ -e '/etc/apt/sources.list.d/freedombox2.list' ]; then + rm -f /etc/apt/sources.list.d/freedombox2.list + fi + if [ -e '/etc/apt/preferences.d/50freedombox.pref' ]; then rm -f /etc/apt/preferences.d/50freedombox.pref fi