Browse Source

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

``buster-backports`` are now archived
upd
Valentin Lab 6 months ago
parent
commit
8306f1d185
  1. 34
      precise/base-0k/hooks/install.d/00-base.sh

34
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

Loading…
Cancel
Save