Skip to content

Commit fdbd9b4

Browse files
common-utils Azure linux 3 support (#1310)
* added tdnf package manager and some checks for Azure linux * added tdnf package manager and some checks for Azure linux * modified install_cmd * modified install_cmd --------- Co-authored-by: Daniel Doyle <ddoyle2017@github.com>
1 parent 87befbc commit fdbd9b4

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

src/common-utils/install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ fi
3131
if [ "${ID}" = "alpine" ]; then
3232
apk add --no-cache bash
3333
fi
34-
34+
if [ "${ID}" = "azurelinux" ]; then
35+
tdnf install -y curl git
36+
fi
3537
exec /bin/bash "$(dirname $0)/main.sh" "$@"
3638
exit $?

src/common-utils/main.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,18 @@ install_redhat_packages() {
161161
local package_list=""
162162
local remove_epel="false"
163163
local install_cmd=microdnf
164-
if ! type microdnf > /dev/null 2>&1; then
165-
install_cmd=dnf
166-
if ! type dnf > /dev/null 2>&1; then
167-
install_cmd=yum
168-
fi
169-
fi
164+
if type microdnf > /dev/null 2>&1; then
165+
install_cmd=microdnf
166+
elif type tdnf > /dev/null 2>&1; then
167+
install_cmd=tdnf
168+
elif type dnf > /dev/null 2>&1; then
169+
install_cmd=dnf
170+
elif type yum > /dev/null 2>&1; then
171+
install_cmd=yum
172+
else
173+
echo "Unable to find 'tdnf', 'dnf', or 'yum' package manager. Exiting."
174+
exit 1
175+
fi
170176

171177
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
172178
package_list="${package_list} \
@@ -344,7 +350,7 @@ chmod +x /etc/profile.d/00-restore-env.sh
344350
# Get an adjusted ID independent of distro variants
345351
if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then
346352
ADJUSTED_ID="debian"
347-
elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
353+
elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "azurelinux" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
348354
ADJUSTED_ID="rhel"
349355
VERSION_CODENAME="${ID}${VERSION_ID}"
350356
elif [ "${ID}" = "alpine" ]; then

test/common-utils/Azure-linux-CU.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Load Linux distribution info
9+
. /etc/os-release
10+
11+
# Check if the current user is root
12+
check "root user" test "$(whoami)" = "root"
13+
14+
# Check if the Linux distro is Azure Linux
15+
check "azurelinux distro" test "$ID" = "azurelinux"
16+
17+
# Definition specific tests
18+
check "curl" curl --version
19+
check "jq" jq --version
20+
21+
# Report result
22+
reportResults

test/common-utils/scenarios.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,11 @@
292292
"features": {
293293
"common-utils": {}
294294
}
295+
},
296+
"Azure-linux-CU": {
297+
"image": "mcr.microsoft.com/dotnet/sdk:8.0-azurelinux3.0",
298+
"features": {
299+
"common-utils": {}
300+
}
295301
}
296302
}

0 commit comments

Comments
 (0)