Browse Source

new: [base] manage ``buster`` deprecating repositories

``buster-backports`` are now archived
pull/43/head
Valentin Lab 7 months ago
parent
commit
8306f1d185
  1. 20
      precise/base-0k/hooks/install.d/00-base.sh

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

@ -41,7 +41,7 @@ apt:update() {
echo "Failed to 'apt-get update', looking for fixes..." echo "Failed to 'apt-get update', looking for fixes..."
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|no longer has) a Release file.$")
changed_release=$(printf "%s" "$out" | egrep "^[EW]: Repository '.*' changed its 'Suite' value from .* to .*$") 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
@ -55,21 +55,23 @@ apt:update() {
sed -ri 's%^(\s*deb(-src)? http://archive.debian.org/? stretch/updates .*)$%# \1%g' /etc/apt/sources.list sed -ri 's%^(\s*deb(-src)? http://archive.debian.org/? stretch/updates .*)$%# \1%g' /etc/apt/sources.list
fi fi
if [[ " ${tried[*]} " != *" stretch-archive-fix "* ]] &&
[[ "$failed_release" == *"'http://deb.debian.org/debian stretch"* ]]; then
tried+=("stretch-archive-fix")
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" ] && { [ -z "$backup" ] && {
backup=1 backup=1
echo "Backup old /etc/apt/sources.list" echo "Backup old /etc/apt/sources.list"
cp -v /etc/apt/sources.list{,.myc-update} 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,' \
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 /etc/apt/sources.list
#s,^(deb(-src)? http://deb.debian.org/debian '"$variant"'),#\1,' \
fi fi
done
done
if [[ " ${tried[*]} " != *" change-release-fix "* ]] && if [[ " ${tried[*]} " != *" change-release-fix "* ]] &&
[[ "$changed_release" == *"'http://deb.debian.org/debian "* ]]; then [[ "$changed_release" == *"'http://deb.debian.org/debian "* ]]; then

Loading…
Cancel
Save