I have bash script that should run on Debian 9 and newer. It contains apt-get -qq update
command. With new releases of Debian it is not possible to simply run apt-get update
on Debian 9 due to new repositories, I get errors like this:
E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
apt-get update --allow-releaseinfo-change
can fix this problem (I know it can be a security issue Disadvantage of using --allow-releaseinfo-change for apt-get update but it does not bother me at the moment).
But it is not possible to run this command on Debian 9:
E: Command line option --allow-releaseinfo-change is not understood in combination with the other options
I have this workaround:
if [ $(lsb_release -cs) == "stretch" ]; then
apt-get update
else
apt-get update --allow-releaseinfo-change
fi
Is there a better way how to solve this issue?