Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ DRIVER_VERSION="${DRIVER_VERSION}"
DRIVER_KIND="${DRIVER_KIND}"
NVIDIA_CONTAINER_TOOLKIT_VER="1.17.6"
NVIDIA_PACKAGES="libnvidia-container1 libnvidia-container-tools nvidia-container-toolkit-base nvidia-container-toolkit"
GPU_DEST="/usr/local/nvidia"
GPU_DEST="/usr/bin"
52 changes: 1 addition & 51 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,62 +58,12 @@ fi

# install nvidia drivers
pushd /opt/gpu
/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}"
/opt/gpu/${RUNFILE}/nvidia-installer -s -k=$KERNEL_NAME --log-file-name=${LOG_FILE_NAME} -a --no-drm --dkms
popd

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

handle_nvidia_systemd_units() {
SYSTEMD_SRC="/usr/lib/nvidia/systemd"
SYSTEMD_DEST="/etc/systemd/system"
moved_units=()

# Check if the source directory exists
if [[ -d "$SYSTEMD_SRC" ]]; then
# Use find to list *.service files in the source directory
found_files=$(find "$SYSTEMD_SRC" -maxdepth 1 -name "*.service")
if [ -z "$found_files" ]; then
echo "No systemd unit files found in $SYSTEMD_SRC"
else
# Loop through each found file, move it, and record its name
while IFS= read -r unit; do
mv "$unit" "$SYSTEMD_DEST/"
unit_name=$(basename "$unit")
moved_units+=("$unit_name")
echo "Moved $unit_name to $SYSTEMD_DEST"
done <<< "$found_files"
fi
else
echo "Source directory $SYSTEMD_SRC does not exist. Skipping systemd unit file move."
fi

# Reload systemd to pick up the moved unit files
systemctl daemon-reload

# Enable and restart only the moved units
for unit_name in "${moved_units[@]}"; do
systemctl enable "$unit_name"
systemctl restart "$unit_name"
echo "$unit_name enabled and restarted."
done
}

# grid starts a daemon that prevents copying binaries
if [ "${DRIVER_KIND}" == "grid" ]; then
systemctl stop nvidia-gridd || true
fi

# move nvidia binaries to /usr/bin...because we like that?
cp -rvT ${GPU_DEST}/bin /usr/bin || true

# restart that daemon, lol
if [ "${DRIVER_KIND}" == "grid" ]; then
systemctl restart nvidia-gridd || true
fi

handle_nvidia_systemd_units

# configure system to know about nvidia lib paths
echo "${GPU_DEST}/lib64" > /etc/ld.so.conf.d/nvidia.conf
ldconfig
Expand Down