Merge branch 'fix/__apt_source/allow-releaseinfo-change' into 'master'

__apt_source: fix complain about suite change

See merge request ungleich-public/cdist!1022
This commit is contained in:
poljakowski 2021-09-21 08:54:49 +02:00
commit 12c536dbf9

View file

@ -22,7 +22,21 @@
name="$__object_id" name="$__object_id"
destination="/etc/apt/sources.list.d/${name}.list" destination="/etc/apt/sources.list.d/${name}.list"
# There are special arguments to apt(8) to prevent aborts if apt woudn't been
# updated after the 19th April 2021 till the bullseye release. The additional
# arguments acknoledge the happend suite change (the apt(8) update does the
# same by itself).
#
# Using '-o $config' instead of the --allow-releaseinfo-change-* parameter
# allows backward compatablility to pre-buster Debian versions.
#
# See more: ticket #861
# https://code.ungleich.ch/ungleich-public/cdist/-/issues/861
apt_opts="-o Acquire::AllowReleaseInfoChange::Suite=true -o Acquire::AllowReleaseInfoChange::Version=true"
# run 'apt-get update' only if something changed with our sources.list file
# it will be run a second time on error as a redundancy messure to success
if grep -q "^__file${destination}" "$__messages_in"; then if grep -q "^__file${destination}" "$__messages_in"; then
printf 'apt-get update || apt-get update\n' printf 'apt-get %s update || apt-get %s update\n' "$apt_opts" "$apt_opts"
fi fi