From 361fd6e1045a13c793b84335790e30b828eea7c2 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Wed, 21 Sep 2022 14:46:24 -0400 Subject: [PATCH] Do not always install libapache2-mod-oauth2 This package is unavailable for 22.04 (the current LTS version of Ubuntu). It is in 22.10 and may be backported to 22.04 through the backports repo, but currently there is no prebuilt trusted source for this package on 22.04. This package is getting deployed on all ubuntu systems. In my opinion, it should not have been merged, but we can gate the install around a PROFILE='mod_oauth2' rather than revert the change entirely. Related-Id: Ib3eac4269f7ac8365623f95a81b07a6436464ed0 Change-Id: I282b7b0aefa8aabc1f5c6495564d13b70cd0ec5d --- Dockerfile | 4 ++++ scripts/install_packages.sh | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a026a3..4e56b02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,10 @@ ARG REGISTRY_PROTOCOL="detect" ARG REGISTRY_INSECURE="False" ARG KEEP_ALL_WHEELS="False" +# NOTE: This option is only applicable to apt/dpkg systems. The value is noop +# for rpm based systems. This will not show up in the final image regardless. +ARG DEBIAN_FRONTEND=noninteractive + ARG UID=42424 ARG GID=42424 diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh index 2534a42..5f470d4 100755 --- a/scripts/install_packages.sh +++ b/scripts/install_packages.sh @@ -13,18 +13,26 @@ done if [[ ! -z ${PACKAGES} ]]; then case ${distro} in ubuntu) - export DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${PACKAGES[@]} ${DIST_PACKAGES} + # NOTE: This doesn't belong here. This should be a user shim or a + # custom base image configuration change to the apt sources + # "libapache2-mod-oauth2" package is available in Ubuntu 22.10 # NOTE(mnaser): mod_oauth2 is not available inside packaging repos, so we manually # install it here. - if [ ${PROJECT} == 'keystone' ] && [ $(uname -p) == "x86_64" ]; then + if [[ "${PROFILES[*]}" =~ "mod_oauth2" ]] && [[ ${PROJECT} == 'keystone' ]] && [[ $(uname -p) == "x86_64" ]]; then source /etc/lsb-release apt-get install -y --no-install-recommends wget apache2 - wget --no-check-certificate https://github.com/zmartzone/mod_oauth2/releases/download/v3.2.2/libapache2-mod-oauth2_3.2.2-1.${DISTRIB_CODENAME}+1_amd64.deb https://github.com/zmartzone/liboauth2/releases/download/v1.4.3/liboauth2_1.4.3-1.${DISTRIB_CODENAME}+1_amd64.deb - apt-get -y --no-install-recommends install ./libapache2-mod-oauth2_3.2.2-1.${DISTRIB_CODENAME}+1_amd64.deb ./liboauth2_1.4.3-1.${DISTRIB_CODENAME}+1_amd64.deb + wget --no-check-certificate \ + https://github.com/zmartzone/mod_oauth2/releases/download/v3.2.2/libapache2-mod-oauth2_3.2.2-1.${DISTRIB_CODENAME}+1_amd64.deb \ + https://github.com/zmartzone/liboauth2/releases/download/v1.4.3/liboauth2_1.4.3-1.${DISTRIB_CODENAME}+1_amd64.deb + apt-get -y --no-install-recommends install \ + ./libapache2-mod-oauth2_3.2.2-1.${DISTRIB_CODENAME}+1_amd64.deb \ + ./liboauth2_1.4.3-1.${DISTRIB_CODENAME}+1_amd64.deb a2enmod oauth2 - rm -rfv ./libapache2-mod-oauth2_3.2.2-1.${DISTRIB_CODENAME}+1_amd64.deb ./liboauth2_1.4.3-1.${DISTRIB_CODENAME}+1_amd64.deb + rm -rfv \ + ./libapache2-mod-oauth2_3.2.2-1.${DISTRIB_CODENAME}+1_amd64.deb \ + ./liboauth2_1.4.3-1.${DISTRIB_CODENAME}+1_amd64.deb apt-get purge -y wget fi ;;