From eab2940bf6d56538159808acb174bbda6271d343 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Sat, 19 Dec 2020 07:25:34 +0100 Subject: [PATCH] Reimplement $dist/updates vs $dist-security more backwards-compatible This reverts most code, but not the implemented functionality of commit 2fba5cb90e30f2bfab07782c9fa3b99275e769da. Requiring a config file change to still be able to install old distributions would make a bump of the major version necessary according to Semantic Versioning. Let's avoid that: The list of distributions with the old path scheme is finite and will never change again. Hence it's ok and especially backwards compatible to hardcode this list in hooks/debian/20-setup-apt. It's also less and more obvious (but not necessarily easier to read) code. But it's all in one place and not scattered over three files. And it's just one line instead like a dozen or two dozens. Closes: #972749 (kinda again) --- etc/distributions.conf | 18 +++++++++--------- hooks/common.sh | 21 --------------------- hooks/debian/20-setup-apt | 3 +-- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/etc/distributions.conf b/etc/distributions.conf index 4628b63..07bddce 100644 --- a/etc/distributions.conf +++ b/etc/distributions.conf @@ -5,17 +5,17 @@ # codename = distribution and further keywords # # Known distributions: debian, ubuntu -# Known keywords: eol, pygrub, default-keyring, dont-test, security-subdir +# Known keywords: eol, pygrub, default-keyring, dont-test # Known generic keywords: *.gpg (uses the according /usr/share/keyrings/….gpg file) # -sarge = debian security-subdir eol -etch = debian security-subdir eol -lenny = debian security-subdir eol -squeeze = debian security-subdir eol default-keyring -wheezy = debian security-subdir eol -jessie = debian security-subdir eol -stretch = debian security-subdir -buster = debian security-subdir +sarge = debian eol +etch = debian eol +lenny = debian eol +squeeze = debian eol default-keyring +wheezy = debian eol +jessie = debian eol +stretch = debian +buster = debian bullseye = debian bookworm = debian dont-test trixie = debian dont-test diff --git a/hooks/common.sh b/hooks/common.sh index b5fc417..a1b441b 100755 --- a/hooks/common.sh +++ b/hooks/common.sh @@ -422,24 +422,3 @@ installGentooPackage () logMessage "NOTE: Not doing anything - this is a stub - FIXME" } - - - - -# -# findDistributionConf path -# -# returns either a relative or an absolut path to distributions.conf -# -findDistributionsConf () -{ - prefix=$1 - - if [ -f etc/distributions.conf ]; then - echo etc/distributions.conf - elif [ -f ${prefix:-}/etc/xen-tools/distributions.conf ]; then - echo ${prefix:-}/etc/xen-tools/distributions.conf - elif [ -f /etc/xen-tools/distributions.conf ]; then - echo /etc/xen-tools/distributions.conf - fi -} diff --git a/hooks/debian/20-setup-apt b/hooks/debian/20-setup-apt index 63497c8..e495632 100755 --- a/hooks/debian/20-setup-apt +++ b/hooks/debian/20-setup-apt @@ -20,7 +20,6 @@ else . ./hooks/common.sh fi -distributions_conf=$(findDistributionsConf $prefix) # # Log our start @@ -67,7 +66,7 @@ if ( test "${dist}" "!=" "sid" && test "${dist}" "!=" "unstable" && \ test -e /etc/apt/sources.list && \ grep ^deb.*security -r /etc/apt/sources.list /etc/apt/sources.list.d >/dev/null 2>/dev/null ) ; then - if fgrep "${dist}" $distributions_conf | fgrep -q security-subdir; then + if echo "${dist}" | egrep -q '\b(sarge|etch|lenny|squeeze|wheezyjessie|stretch|buster)\b'; then cat <> ${prefix}/etc/apt/sources.list #