From ed52e8fe7ac6483226bbbb4c1754d32276a65e3b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 9 Dec 2020 07:23:32 +0100 Subject: [PATCH] TT#104221 Use bullseye repos in ensure_packages_installed appropriately The ensure_packages_installed function ensures that specified packages are present during runtime. This is used e.g. for installation of virtualbox-guest-additions-iso Debian package from within vagrant_configuration(), which is used to execute /media/cdrom/VBoxLinuxAdditions.run inside the target system. We can't use random Debian repositories though, as the package dependencies need to match the running live system. So far we only used the buster repository, as our current grml-sipwise ISOs are based on something close to buster. On the other hand we can't use virtualbox-guest-additions-iso from Debian/buster in our Debian/bullseye Vagrant boxes, as /sbin/mount.vboxsf doesn't work then. So use the bullseye repository if the release of the target system is bullseye, which seems to work with our current Grml ISOs and current state of bullseye. Change-Id: Iaf965daa6ff7a62e2b3bd8c55b8f761abd94c241 --- templates/scripts/includes/deployment.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index dcff9d9..3ce7d05 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -274,7 +274,19 @@ ensure_packages_installed() { "${TMPDIR}/cachedir/archives/partial" chown _apt -R "${TMPDIR}" - echo "deb ${DEBIAN_URL}/debian/ buster main contrib non-free" > \ + local deb_release + case "${DEBIAN_RELEASE}" in + buster|bullseye) + deb_release="${DEBIAN_RELEASE}" + echo "Using ${deb_release} as Debian repository for ${FUNCNAME[0]}" + ;; + *) + deb_release='buster' + echo "Enabling fallback to Debian ${deb_release} repository for ${FUNCNAME[0]}" + ;; + esac + + echo "deb ${DEBIAN_URL}/debian/ ${deb_release} main contrib non-free" > \ "${TMPDIR}/etc/sources.list" mkdir -p "${TMPDIR}"/etc/apt/apt.conf.d/