This commit is contained in:
Carlos Eduardo Arango Gutierrez 2025-06-25 17:02:03 +02:00 committed by GitHub
commit 97adac144c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 12 deletions

View File

@ -6,14 +6,13 @@ case "$1" in
configure) configure)
/usr/bin/nvidia-ctk --quiet config --config-file=/etc/nvidia-container-runtime/config.toml --in-place /usr/bin/nvidia-ctk --quiet config --config-file=/etc/nvidia-container-runtime/config.toml --in-place
# Enable nvidia-cdi-refresh services on both install and upgrade
if command -v systemctl >/dev/null 2>&1 \ if command -v systemctl >/dev/null 2>&1 \
&& systemctl --quiet is-system-running 2>/dev/null; then && systemctl --quiet is-system-running 2>/dev/null; then
systemctl daemon-reload || true systemctl daemon-reload || { echo "Warning: Failed to reload systemd daemon" >&2; true; }
systemctl enable --now nvidia-cdi-refresh.path || { echo "Warning: Failed to enable nvidia-cdi-refresh.path" >&2; true; }
if [ -z "$2" ]; then # $2 empty → first install systemctl enable --now nvidia-cdi-refresh.service || { echo "Warning: Failed to enable nvidia-cdi-refresh.service" >&2; true; }
systemctl enable --now nvidia-cdi-refresh.path || true
fi
fi fi
;; ;;

View File

@ -51,15 +51,12 @@ if [ $1 -gt 1 ]; then # only on package upgrade
cp -af %{_bindir}/nvidia-container-runtime-hook %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit cp -af %{_bindir}/nvidia-container-runtime-hook %{_localstatedir}/lib/rpm-state/nvidia-container-toolkit
fi fi
# Reload systemd unit cache # Reload systemd unit cache and enable nvidia-cdi-refresh services on both install and upgrade
if command -v systemctl >/dev/null 2>&1 \ if command -v systemctl >/dev/null 2>&1 \
&& systemctl --quiet is-system-running 2>/dev/null; then && systemctl --quiet is-system-running 2>/dev/null; then
systemctl daemon-reload || true systemctl daemon-reload || { echo "Warning: Failed to reload systemd daemon" >&2; true; }
systemctl enable --now nvidia-cdi-refresh.path || { echo "Warning: Failed to enable nvidia-cdi-refresh.path" >&2; true; }
# On fresh install ($1 == 1) enable the path unit so it starts at boot systemctl enable --now nvidia-cdi-refresh.service || { echo "Warning: Failed to enable nvidia-cdi-refresh.service" >&2; true; }
if [ "$1" -eq 1 ]; then
systemctl enable --now nvidia-cdi-refresh.path || true
fi
fi fi
%posttrans %posttrans