From 30990872f149e4f68d071624f0e5d68f0d5932d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 24 Oct 2022 13:12:44 +0200 Subject: [PATCH] ubuntu: Ensure RATS-TLS is only installed on 20.04 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're currently using Ubuntu 20.04 as the base for the Ubuntu rootfs, meaning that right now there's no issue with the approach currently taken. However, if we do a bump of an Ubuntu version, we could face issues as the rats-tls package is only provided for Ubuntu 20.04. Signed-off-by: Fabiano FidĂȘncio --- tools/osbuilder/rootfs-builder/ubuntu/config.sh | 14 ++++++++++---- .../osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh | 12 +++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/osbuilder/rootfs-builder/ubuntu/config.sh b/tools/osbuilder/rootfs-builder/ubuntu/config.sh index 4311660a69..40692c9c00 100644 --- a/tools/osbuilder/rootfs-builder/ubuntu/config.sh +++ b/tools/osbuilder/rootfs-builder/ubuntu/config.sh @@ -21,13 +21,19 @@ case "$ARCH" in esac if [ "${AA_KBC}" == "eaa_kbc" ] && [ "${ARCH}" == "x86_64" ]; then - PACKAGES+=" apt gnupg" - AA_KBC_EXTRAS=" -RUN echo 'deb [arch=amd64] http://mirrors.openanolis.cn/inclavare-containers/ubuntu20.04 bionic main' \| tee /etc/apt/sources.list.d/inclavare-containers.list; \ - curl -L http://mirrors.openanolis.cn/inclavare-containers/ubuntu20.04/DEB-GPG-KEY.key \| apt-key add -; \ + source /etc/os-release + + if [ "${VERSION_ID}" == "20.04" ]; then + PACKAGES+=" apt gnupg" + AA_KBC_EXTRAS=" +RUN echo 'deb [arch=amd64] http://mirrors.openanolis.cn/inclavare-containers/ubuntu${VERSION_ID} bionic main' \| tee /etc/apt/sources.list.d/inclavare-containers.list; \ + curl -L http://mirrors.openanolis.cn/inclavare-containers/ubuntu${VERSION_ID}/DEB-GPG-KEY.key \| apt-key add -; \ apt-get update; \ apt-get install -y rats-tls " + else + echo "rats-tls is only provided for Ubuntu 20.04, there's yet no packages for Ubuntu ${VERSION_ID}" + fi fi if [ "$(uname -m)" != "$ARCH" ]; then diff --git a/tools/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh b/tools/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh index 90c13dd0a0..8c617cd4b5 100644 --- a/tools/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh +++ b/tools/osbuilder/rootfs-builder/ubuntu/rootfs_lib.sh @@ -34,11 +34,17 @@ EOF rm -rf $rootfs_dir/usr/share/{bash-completion,bug,doc,info,lintian,locale,man,menu,misc,pixmaps,terminfo,zsh} if [ "${AA_KBC}" == "eaa_kbc" ] && [ "${ARCH}" == "x86_64" ]; then - curl -L http://mirrors.openanolis.cn/inclavare-containers/ubuntu20.04/DEB-GPG-KEY.key | chroot "$rootfs_dir" apt-key add - - cat << EOF | chroot "$rootfs_dir" -echo 'deb [arch=amd64] http://mirrors.openanolis.cn/inclavare-containers/ubuntu20.04 bionic main' | tee /etc/apt/sources.list.d/inclavare-containers.list + source /etc/os-release + + if [ "${VERSION_ID}" == "20.04" ]; then + curl -L http://mirrors.openanolis.cn/inclavare-containers/ubuntu${VERSION_ID}/DEB-GPG-KEY.key | chroot "$rootfs_dir" apt-key add - + cat << EOF | chroot "$rootfs_dir" +echo 'deb [arch=amd64] http://mirrors.openanolis.cn/inclavare-containers/ubuntu${VERSION_ID} bionic main' | tee /etc/apt/sources.list.d/inclavare-containers.list apt-get update apt-get install -y rats-tls EOF + else + echo "rats-tls is only provided for Ubuntu 20.04, there's yet no packages for Ubuntu ${VERSION_ID}" + fi fi }