diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh index 8f1ece4d7..a89490347 100755 --- a/src/common-utils/install.sh +++ b/src/common-utils/install.sh @@ -31,6 +31,8 @@ fi if [ "${ID}" = "alpine" ]; then apk add --no-cache bash fi - +if [ "${ID}" = "azurelinux" ]; then + tdnf install -y curl git +fi exec /bin/bash "$(dirname $0)/main.sh" "$@" exit $? diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index b5fe11f57..abef18430 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -161,12 +161,18 @@ install_redhat_packages() { local package_list="" local remove_epel="false" local install_cmd=microdnf - if ! type microdnf > /dev/null 2>&1; then - install_cmd=dnf - if ! type dnf > /dev/null 2>&1; then - install_cmd=yum - fi - fi + if type microdnf > /dev/null 2>&1; then + install_cmd=microdnf + elif type tdnf > /dev/null 2>&1; then + install_cmd=tdnf + elif type dnf > /dev/null 2>&1; then + install_cmd=dnf + elif type yum > /dev/null 2>&1; then + install_cmd=yum + else + echo "Unable to find 'tdnf', 'dnf', or 'yum' package manager. Exiting." + exit 1 +fi if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then package_list="${package_list} \ @@ -344,7 +350,7 @@ chmod +x /etc/profile.d/00-restore-env.sh # Get an adjusted ID independent of distro variants if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then ADJUSTED_ID="debian" -elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then +elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "azurelinux" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then ADJUSTED_ID="rhel" VERSION_CODENAME="${ID}${VERSION_ID}" elif [ "${ID}" = "alpine" ]; then diff --git a/test/common-utils/Azure-linux-CU.sh b/test/common-utils/Azure-linux-CU.sh new file mode 100644 index 000000000..eeba25d10 --- /dev/null +++ b/test/common-utils/Azure-linux-CU.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Load Linux distribution info +. /etc/os-release + +# Check if the current user is root +check "root user" test "$(whoami)" = "root" + +# Check if the Linux distro is Azure Linux +check "azurelinux distro" test "$ID" = "azurelinux" + +# Definition specific tests +check "curl" curl --version +check "jq" jq --version + +# Report result +reportResults diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json index a929f534a..4ffbde1ac 100644 --- a/test/common-utils/scenarios.json +++ b/test/common-utils/scenarios.json @@ -292,5 +292,11 @@ "features": { "common-utils": {} } + }, + "Azure-linux-CU": { + "image": "mcr.microsoft.com/dotnet/sdk:8.0-azurelinux3.0", + "features": { + "common-utils": {} + } } } \ No newline at end of file