From 9b49c3d6dca34f9c522f8dc266edc5cee1c4d80e Mon Sep 17 00:00:00 2001 From: tmadlener Date: Wed, 13 Mar 2024 15:26:30 +0100 Subject: [PATCH] Sanitize as early as possible and make list commands working again --- scripts/cvmfs/setup.sh | 73 ++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/scripts/cvmfs/setup.sh b/scripts/cvmfs/setup.sh index 3155431b..bd95fcf6 100644 --- a/scripts/cvmfs/setup.sh +++ b/scripts/cvmfs/setup.sh @@ -27,36 +27,19 @@ function _k4_check_release() { } function _k4_setup_list_releases() { + # List the available release for the passed OS. Assumes that OS has been + # sanitized before local os=$1 - if [ "$os" = "almalinux" ] || [ "$os" = "almalinux9" ]; then - name="almalinux9" - elif [ "$os" = "centos" ] || [ "$os" = "centos7" ]; then - name="centos7" - elif [ "$os" = "ubuntu" ] || [ "$os" = "ubuntu22" ]; then - name="ubuntu22" - else - echo "Unsupported OS, aborting..." - _setup_script_usage - return 1 - fi - find ${SCRIPT_BASE_DIR}/releases/ -maxdepth 2 -type d -name "*$name*" | + find ${SCRIPT_BASE_DIR}/releases/ -maxdepth 2 -type d -name "*${os}*" | \awk -F/ '{print $(NF-1)}' | sort } function _k4_setup_list_packages() { + # List the available packages and their version for a given OS and release. + # Both of them are assumed to have been sanitized before local os=$1 - if [ "$os" = "almalinux" ] || [ "$os" = "almalinux9" ]; then - name="almalinux9" - elif [ "$os" = "centos" ] || [ "$os" = "centos7" ]; then - name="centos7" - elif [ "$os" = "ubuntu" ] || [ "$os" = "ubuntu22" ]; then - name="ubuntu22" - else - echo "Unsupported OS, aborting..." - _setup_script_usage - return 1 - fi - find ${SCRIPT_BASE_DIR}/releases/$rel/*$name*/ -maxdepth 2 -mindepth 2 -not -path '*/\.*' -type d | awk -F/ '{if ($NF ~ /develop/) printf "%s develop", $(NF-1); else {split($(NF),arr,"-"); printf "%s ", $(NF-1); printf "%s", arr[1]; for (i=2; i