Skip to content

Commit 1a1ce82

Browse files
using dnf to check the packages
1 parent 05c37d4 commit 1a1ce82

5 files changed

Lines changed: 57 additions & 14 deletions

File tree

src/powershell/install.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,21 @@ apt_get_update()
155155
echo "Package $package is already installed (APT)."
156156
fi
157157
done
158-
elif command -v rpm > /dev/null 2>&1 && command -v dnf > /dev/null 2>&1; then
159-
# If rpm and dnf exist, assume DNF-based system (RHEL/AlmaLinux)
160-
for package in "$@"; do
161-
if ! rpm -q "$package" > /dev/null 2>&1; then
162-
echo "Package $package not installed. Installing using dnf..."
163-
dnf install -y "$package"
164-
else
165-
echo "Package $package is already installed (DNF)."
166-
fi
167-
done
168-
else
169-
echo "Unsupported package manager. Neither APT nor DNF found."
170-
return 1
171-
fi
158+
elif command -v dnf > /dev/null 2>&1; then
159+
for package in "$@"; do
160+
if ! dnf list installed "$package" > /dev/null 2>&1; then
161+
echo "Package $package not installed. Installing using dnf..."
162+
dnf install -y "$package"
163+
else
164+
echo "Package $package is already installed (DNF)."
165+
fi
166+
done
167+
else
168+
echo "Unsupported package manager. Neither APT nor DNF found."
169+
return 1
170+
fi
171+
172+
172173
}
173174

174175
install_using_apt() {
@@ -307,6 +308,7 @@ install_using_github() {
307308
install_prev_pwsh $pwsh_url
308309
fi
309310

311+
# downlaod the latest version of powershell and extracting the file to powershell directory
310312
wget https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/${powershell_filename}
311313
mkdir ~/powershell
312314
tar -xvf powershell-${POWERSHELL_VERSION}-linux-x64.tar.gz -C ~/powershell
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Run PowerShell command to check installation
4+
pwsh --version &> /dev/null
5+
6+
# Check if the command was successful
7+
if [ $? -eq 0 ]; then
8+
echo "PowerShell is installed."
9+
else
10+
echo "PowerShell is not installed."
11+
exit 1
12+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM almalinux
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
dnf install -y wget
4+
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq
5+
dnf install -y krb5-libs libicu openssl-libs zlib
6+
# Problem: conflicting requests
7+
# - nothing provides krb5 needed by powershell-7.5.0-1.cm.aarch64 from @commandline
8+
latest_release=$(curl -s https://api.github.com/repos/PowerShell/PowerShell/releases/latest) && \
9+
sudo rpmlink=$(echo "$latest_release" | arch=$(arch) yq -r '[.assets[] | select(.name == ("*" + strenv(arch) + ".rpm")) | .browser_download_url'][0]) && \
10+
sudo dnf install -y $rpmlink
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Check installation of cuda-nvtx-12-4 (12.4)
9+
check "cuda-12-4+nvtx" test -e '/usr/local/cuda-12.4/targets/x86_64-linux/include/nvtx3/'
10+
11+
# Verify CUDA toolkit installation
12+
check "nvcc" nvcc --version
13+
14+
# Verify PATH environment variable
15+
check "cuda-path" echo $PATH | grep -q "/usr/local/cuda-12.4/bin"
16+
17+
# Report result
18+
reportResults

0 commit comments

Comments
 (0)