[no-relnote] Fix DEB/RPM systemd install scripts

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This commit is contained in:
Carlos Eduardo Arango Gutierrez 2025-06-25 14:18:35 +02:00
parent ced79e51ed
commit 99aeed95c7
No known key found for this signature in database
GPG Key ID: 42D9CB42F300A852
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