Browse Source

fix: [base] make ``apt-get update`` pass on debian 10 after release info change

pull/31/head
Valentin Lab 1 year ago
parent
commit
7f1c70c232
  1. 9
      precise/base-0k/hooks/install.d/00-base.sh

9
precise/base-0k/hooks/install.d/00-base.sh

@ -42,6 +42,7 @@ apt:update() {
old_tried_length="${#tried[@]}" old_tried_length="${#tried[@]}"
failed_fetch=$(printf "%s" "$out" | egrep "^E: Failed to fetch .*404\s+Not Found") 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 a Release file.$")
changed_release=$(printf "%s" "$out" | egrep "^[EW]: Repository '.*' changed its 'Suite' value from .* to .*$")
if [[ " ${tried[*]} " != *" stretch-updates-fix "* ]] && if [[ " ${tried[*]} " != *" stretch-updates-fix "* ]] &&
[[ "$failed_fetch" == *" http://archive.debian.org/dists/stretch/updates/"* ]]; then [[ "$failed_fetch" == *" http://archive.debian.org/dists/stretch/updates/"* ]]; then
tried+=("stretch-updates-fix") tried+=("stretch-updates-fix")
@ -70,6 +71,14 @@ apt:update() {
/etc/apt/sources.list /etc/apt/sources.list
fi fi
if [[ " ${tried[*]} " != *" change-release-fix "* ]] &&
[[ "$changed_release" == *"'http://deb.debian.org/debian "* ]]; then
tried+=("change-release-fix")
echo "Applying change-release-fix"
apt-get update --allow-releaseinfo-change </dev/null || true
fi
if [[ "$old_tried_length" == "${#tried[@]}" ]]; then if [[ "$old_tried_length" == "${#tried[@]}" ]]; then
echo "Failing 'apt-get update'. Couldn't fix it automatically. Stopping." echo "Failing 'apt-get update'. Couldn't fix it automatically. Stopping."
if [ -n "$backup" ]; then if [ -n "$backup" ]; then

Loading…
Cancel
Save