Skip to content

Commit 526ef43

Browse files
added tdnf package manager and some checks for Azure linux
1 parent 7ff1d71 commit 526ef43

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

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=dnf
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/scenarios.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,13 @@
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+
"remoteUser": "vscode"
301+
}
302+
}
295303
}
296304
}

0 commit comments

Comments
 (0)