From 047353213d4440af511404ed4fa4a8a8f3d158c8 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Tue, 10 Sep 2024 13:10:57 +0000 Subject: [PATCH] Introduce per project customization scripts interface Do project specific installations by calling project specific scripts located in scripts/project_specific/ directory. The scripts are executed in alphabetical order. Also move keystone oidc and nova console into own files Change-Id: I1f381e85f095eee2bede3f4925f51c9103d83467 --- scripts/install.sh | 7 ++--- scripts/install_packages.sh | 21 --------------- .../keystone/01_add_oauth_modules.sh | 26 +++++++++++++++++++ .../nova/01_install_console.sh} | 0 4 files changed, 30 insertions(+), 24 deletions(-) create mode 100755 scripts/project_specific/keystone/01_add_oauth_modules.sh rename scripts/{install_nova_console.sh => project_specific/nova/01_install_console.sh} (100%) diff --git a/scripts/install.sh b/scripts/install.sh index 82670d30..5b793f66 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -79,12 +79,13 @@ if [[ "${PLUGIN}" == "no" ]]; then $(dirname $0)/pip_install.sh ${PYDEP_PACKAGES[@]} fi -if [[ ${PROJECT} == 'nova' ]]; then - $(dirname $0)/install_nova_console.sh -fi $(dirname $0)/clone_project.sh $(dirname $0)/install_packages.sh $(dirname $0)/pip_install.sh ${NO_INDEX} /tmp/${PROJECT} ${PIP_PACKAGES} +for project_script in $(ls $(dirname $0)/project_specific/${PROJECT}); do + echo "Running $PROJECT specific script $project_script" + $(dirname $0)/project_specific/${PROJECT}/$project_script +done $(dirname $0)/configure_packages.sh $(dirname $0)/collect_info.sh $(dirname $0)/cleanup.sh diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh index baf3a5b6..e577fd74 100755 --- a/scripts/install_packages.sh +++ b/scripts/install_packages.sh @@ -10,27 +10,6 @@ if [[ ! -z ${PACKAGES} ]]; then case ${distro} in ubuntu) 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 [[ "${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 - 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 - apt-get purge -y wget - fi ;; centos) yum -y --setopt=skip_missing_names_on_install=False install ${PACKAGES[@]} ${DIST_PACKAGES} diff --git a/scripts/project_specific/keystone/01_add_oauth_modules.sh b/scripts/project_specific/keystone/01_add_oauth_modules.sh new file mode 100755 index 00000000..0b8e9561 --- /dev/null +++ b/scripts/project_specific/keystone/01_add_oauth_modules.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -ex + +if [[ ${distro} -eq "ubuntu" ]]; then + # 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 [[ "${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 + 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 + apt-get purge -y wget + fi +fi diff --git a/scripts/install_nova_console.sh b/scripts/project_specific/nova/01_install_console.sh similarity index 100% rename from scripts/install_nova_console.sh rename to scripts/project_specific/nova/01_install_console.sh