Skip to content

Commit 921f1d7

Browse files
Install nvidia driver in default location (#104)
* Install nvidia driver in default location * remove helper func, comments
1 parent b6f0fd2 commit 921f1d7

2 files changed

Lines changed: 2 additions & 52 deletions

File tree

config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ DRIVER_VERSION="${DRIVER_VERSION}"
22
DRIVER_KIND="${DRIVER_KIND}"
33
NVIDIA_CONTAINER_TOOLKIT_VER="1.17.6"
44
NVIDIA_PACKAGES="libnvidia-container1 libnvidia-container-tools nvidia-container-toolkit-base nvidia-container-toolkit"
5-
GPU_DEST="/usr/local/nvidia"
5+
GPU_DEST="/usr/bin"

install.sh

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -58,62 +58,12 @@ fi
5858

5959
# install nvidia drivers
6060
pushd /opt/gpu
61-
/opt/gpu/${RUNFILE}/nvidia-installer -s -k=$KERNEL_NAME --log-file-name=${LOG_FILE_NAME} -a --no-drm --dkms --utility-prefix="${GPU_DEST}" --opengl-prefix="${GPU_DEST}"
61+
/opt/gpu/${RUNFILE}/nvidia-installer -s -k=$KERNEL_NAME --log-file-name=${LOG_FILE_NAME} -a --no-drm --dkms
6262
popd
6363

6464
# move nvidia libs to correct location from temporary overlayfs
6565
cp -a /tmp/overlay/lib64 ${GPU_DEST}/lib64
6666

67-
handle_nvidia_systemd_units() {
68-
SYSTEMD_SRC="/usr/lib/nvidia/systemd"
69-
SYSTEMD_DEST="/etc/systemd/system"
70-
moved_units=()
71-
72-
# Check if the source directory exists
73-
if [[ -d "$SYSTEMD_SRC" ]]; then
74-
# Use find to list *.service files in the source directory
75-
found_files=$(find "$SYSTEMD_SRC" -maxdepth 1 -name "*.service")
76-
if [ -z "$found_files" ]; then
77-
echo "No systemd unit files found in $SYSTEMD_SRC"
78-
else
79-
# Loop through each found file, move it, and record its name
80-
while IFS= read -r unit; do
81-
mv "$unit" "$SYSTEMD_DEST/"
82-
unit_name=$(basename "$unit")
83-
moved_units+=("$unit_name")
84-
echo "Moved $unit_name to $SYSTEMD_DEST"
85-
done <<< "$found_files"
86-
fi
87-
else
88-
echo "Source directory $SYSTEMD_SRC does not exist. Skipping systemd unit file move."
89-
fi
90-
91-
# Reload systemd to pick up the moved unit files
92-
systemctl daemon-reload
93-
94-
# Enable and restart only the moved units
95-
for unit_name in "${moved_units[@]}"; do
96-
systemctl enable "$unit_name"
97-
systemctl restart "$unit_name"
98-
echo "$unit_name enabled and restarted."
99-
done
100-
}
101-
102-
# grid starts a daemon that prevents copying binaries
103-
if [ "${DRIVER_KIND}" == "grid" ]; then
104-
systemctl stop nvidia-gridd || true
105-
fi
106-
107-
# move nvidia binaries to /usr/bin...because we like that?
108-
cp -rvT ${GPU_DEST}/bin /usr/bin || true
109-
110-
# restart that daemon, lol
111-
if [ "${DRIVER_KIND}" == "grid" ]; then
112-
systemctl restart nvidia-gridd || true
113-
fi
114-
115-
handle_nvidia_systemd_units
116-
11767
# configure system to know about nvidia lib paths
11868
echo "${GPU_DEST}/lib64" > /etc/ld.so.conf.d/nvidia.conf
11969
ldconfig

0 commit comments

Comments
 (0)