@@ -719,52 +719,47 @@ _start_daemons() {
719719}
720720
721721_store_driver_config () {
722- local config_file=" /run/nvidia/driver-config.state"
723- echo " Storing driver configuration state..."
724- _build_driver_config > " $config_file "
725- echo " Driver configuration stored at $config_file "
722+ local config_file=" /run/nvidia/driver-config.state"
723+ echo " Storing driver configuration state..."
724+ _build_driver_config > " $config_file "
725+ echo " Driver configuration stored at $config_file "
726+ }
727+
728+ _wait_for_signal () {
729+ echo " Done, now waiting for signal"
730+ sleep infinity &
731+ trap " echo 'Caught signal'; _shutdown && { kill $! ; exit 0; }" HUP INT QUIT PIPE TERM
732+ trap - EXIT
733+ while true ; do wait $! || continue ; done
734+ exit 0
726735}
727736
728737_userspace_only_install () {
729738 echo " Detected matching loaded driver & config (${DRIVER_VERSION} ); performing userspace-only install"
730-
731739 _unmount_rootfs
732740 _update_package_cache
733-
734- # Skip kernel-related steps for userspace-only install
735- # KERNEL_VERSION is already set from uname -r, no need to resolve from yum
736- # Kernel headers/devel/modules are not needed for userspace-only install
737-
741+
738742 cd /drivers
739743 [ ! -d " NVIDIA-Linux-${DRIVER_ARCH} -${DRIVER_VERSION} " ] && sh NVIDIA-Linux-${DRIVER_ARCH} -${DRIVER_VERSION} .run -x
740744 cd NVIDIA-Linux-${DRIVER_ARCH} -${DRIVER_VERSION}
741-
742-
743- echo " DEBUG: Current directory: $( pwd) "
744- echo " DEBUG: Checking for ./nvidia-installer:"
745- ls -la ./nvidia-installer 2>&1 || echo " ./nvidia-installer NOT FOUND"
746- echo " DEBUG: Checking PATH for nvidia-installer:"
747- which nvidia-installer 2>&1 || echo " nvidia-installer NOT in PATH"
748-
749745
750746 echo " Installing userspace components (libraries and binaries)..."
751747 local install_args=" --silent --no-kernel-module --no-nouveau-check --no-nvidia-modprobe --no-drm --no-peermem --ui=none"
752748 [ " ${ACCEPT_LICENSE} " = " yes" ] && install_args=" $install_args --accept-license"
753749 IGNORE_CC_MISMATCH=1 ./nvidia-installer $install_args
754-
755- # Copy kernel module sources if not already present (needed for other containers)
750+
751+ # Copy kernel module sources if not already present (needed for sidecar containers)
756752 if [ ! -d " /usr/src/nvidia-${DRIVER_VERSION} " ]; then
757753 _resolve_kernel_type || exit 1
758754 mkdir -p /usr/src/nvidia-${DRIVER_VERSION}
759755 cp -r LICENSE mkprecompiled ${KERNEL_TYPE} /usr/src/nvidia-${DRIVER_VERSION} /
760756 sed ' 9,${/^\(kernel\|LICENSE\)/!d}' .manifest > /usr/src/nvidia-${DRIVER_VERSION} /.manifest
761757 fi
762-
758+
763759 _mount_rootfs
764760 _start_daemons
765761 _write_kernel_update_hook
766762 _store_driver_config
767-
768763 echo " Userspace-only install complete"
769764}
770765
@@ -826,13 +821,7 @@ _load() {
826821 _mount_rootfs
827822 _write_kernel_update_hook
828823 _store_driver_config
829-
830- echo " Done, now waiting for signal"
831- sleep infinity &
832- trap " echo 'Caught signal'; _shutdown && { kill $! ; exit 0; }" HUP INT QUIT PIPE TERM
833- trap - EXIT
834- while true ; do wait $! || continue ; done
835- exit 0
824+ _wait_for_signal
836825}
837826
838827init () {
@@ -855,13 +844,7 @@ init() {
855844
856845 if _should_use_fast_path; then
857846 _userspace_only_install
858-
859- echo " Userspace-only install complete, now waiting for signal"
860- sleep infinity &
861- trap " echo 'Caught signal'; _shutdown && { kill $! ; exit 0; }" HUP INT QUIT PIPE TERM
862- trap - EXIT
863- while true ; do wait $! || continue ; done
864- exit 0
847+ _wait_for_signal
865848 fi
866849
867850 _unload_driver || exit 1
0 commit comments