From 8306f1d185bb751839e9e8e895f34d54e5b87030 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 14 May 2024 14:58:13 +0200 Subject: [PATCH] new: [base] manage ``buster`` deprecating repositories ``buster-backports`` are now archived --- precise/base-0k/hooks/install.d/00-base.sh | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/precise/base-0k/hooks/install.d/00-base.sh b/precise/base-0k/hooks/install.d/00-base.sh index 1335c6a..66a309c 100755 --- a/precise/base-0k/hooks/install.d/00-base.sh +++ b/precise/base-0k/hooks/install.d/00-base.sh @@ -41,7 +41,7 @@ apt:update() { echo "Failed to 'apt-get update', looking for fixes..." old_tried_length="${#tried[@]}" failed_fetch=$(printf "%s" "$out" | egrep "^E: Failed to fetch .*404\s+Not Found") - failed_release=$(printf "%s" "$out" | egrep "^[EW]: The repository '.*' does (no longer|not) have a Release file.$") + failed_release=$(printf "%s" "$out" | egrep "^[EW]: The repository '.*' (does (no longer|not) have|no longer has) a Release file.$") changed_release=$(printf "%s" "$out" | egrep "^[EW]: Repository '.*' changed its 'Suite' value from .* to .*$") if [[ " ${tried[*]} " != *" stretch-updates-fix "* ]] && [[ "$failed_fetch" == *" http://archive.debian.org/dists/stretch/updates/"* ]]; then @@ -55,21 +55,23 @@ apt:update() { sed -ri 's%^(\s*deb(-src)? http://archive.debian.org/? stretch/updates .*)$%# \1%g' /etc/apt/sources.list fi - - if [[ " ${tried[*]} " != *" stretch-archive-fix "* ]] && - [[ "$failed_release" == *"'http://deb.debian.org/debian stretch"* ]]; then - tried+=("stretch-archive-fix") - [ -z "$backup" ] && { - backup=1 - echo "Backup old /etc/apt/sources.list" - cp -v /etc/apt/sources.list{,.myc-update} - } - echo "Applying stretch-archive-fix" - sed -i 's,http://deb.debian.org,http://archive.debian.org,g; - s,http://security.debian.org,http://archive.debian.org,g; - s,\(.*stretch-updates\),#\1,' \ - /etc/apt/sources.list - fi + for distrib in stretch buster; do + for variant in "$distrib"{,-{updates,backports},/updates}; do + if [[ " ${tried[*]} " != *" ${variant}-archive-fix "* ]] && + [[ "$failed_release" == *"'http://deb.debian.org/debian $variant "* ]]; then + tried+=("${variant}-archive-fix") + [ -z "$backup" ] && { + backup=1 + echo "Backup old /etc/apt/sources.list" + cp -v /etc/apt/sources.list{,.myc-update} + } + echo "Applying ${variant}-archive-fix" + sed -ri 's,http://(deb|security).debian.org/debian '"$variant"',http://archive.debian.org/debian '"$variant"',g' \ + /etc/apt/sources.list + #s,^(deb(-src)? http://deb.debian.org/debian '"$variant"'),#\1,' \ + fi + done + done if [[ " ${tried[*]} " != *" change-release-fix "* ]] && [[ "$changed_release" == *"'http://deb.debian.org/debian "* ]]; then