From 620c0c1bf51aae643ecac61cf8666eb8bb7cdc32 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Thu, 18 Feb 2021 16:29:38 +0800 Subject: [PATCH] On sdcard upgrade to 5.0, try to disable vscode.list if it was installed by a raspberrypi-sys-mods upgrade, or prevent the future install if it's not yet present. --- debian/piaware-release.postinst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/debian/piaware-release.postinst b/debian/piaware-release.postinst index 13daa8b..e6c8009 100644 --- a/debian/piaware-release.postinst +++ b/debian/piaware-release.postinst @@ -61,6 +61,33 @@ update_mirrors() { return 0 } +disable_vscode_list() { + # raspberrypi-sys-mods 20210208 unconditionally installs /etc/apt/sources.list.d/vscode.list on upgrade from pre-20210208 + # Reverse that by commenting out the deb line if the current list exactly matches the auto-installed version + + listfile=/etc/apt/sources.list.d/vscode.list + if [ -f $listfile ] + then + hash=$( md5sum $listfile | cut -c1-32 ) + if [ "$hash" = "99f25608417d470e40f49e209ae9b76c" ] + then + echo "Disabling repository list at ${listfile}" >&2 + echo "previously installed by raspberrypi-sys-mods.." >&2 + sed -e 's@^deb@#deb@' $listfile >${listfile}.new && mv ${listfile}.new $listfile + fi + else + # Does not exist yet, maybe the raspberrypi-sys-mods upgrade hasn't happened yet, install a placeholder + # to prevent future upgrades from installing it + echo "Installing an empty repository list at ${listfile}" >&2 + echo "to prevent that repository being installed by raspberrypi-sys-mods.." >&2 + cat >${listfile} <