Skip to content

Commit 3e3edbe

Browse files
committed
update syntax and if statement to check for actual devices not just runtime
1 parent e8ba0f3 commit 3e3edbe

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

  • root/etc/s6-overlay/s6-rc.d/init-video

root/etc/s6-overlay/s6-rc.d/init-video/run

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ do
3535
done
3636

3737
# check if nvidia gpu is present
38-
if which nvidia-smi >/dev/null 2>&1; then
38+
if which nvidia-smi > /dev/null 2>&1 && ls -A /dev/dri 2>/dev/null; then
3939
# nvidia-container-toolkit may not place files correctly, so we set them up here
4040
echo "**** NVIDIA GPU detected ****"
41-
4241
OPENCL_ICDS=$(find /etc/OpenCL/vendors -name '*nvidia*.icd' 2>/dev/null)
4342
# if no opencl icd found
4443
if [ -z "${OPENCL_ICDS}" ]; then
4544
echo "**** Setting up OpenCL ICD for NVIDIA ****"
4645
mkdir -pm755 /etc/OpenCL/vendors/
4746
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
4847
fi
49-
5048
# find vulkan icds
5149
ICDS=$(find /usr/share/vulkan/icd.d /etc/vulkan/icd.d -name '*nvidia*.json' 2>/dev/null)
5250
# if no icd found
@@ -70,7 +68,6 @@ if which nvidia-smi >/dev/null 2>&1; then
7068
}
7169
EOF
7270
fi
73-
7471
# find glvnd egl_vendor files
7572
EGLS=$(find /usr/share/glvnd/egl_vendor.d /etc/glvnd/egl_vendor.d -name '*nvidia*.json' 2>/dev/null)
7673
# if no egl_vendor file found

0 commit comments

Comments
 (0)