Sven-Hendrik Haase pushed to branch main at Arch Linux / Packaging / Packages / 
nvidia-utils


Commits:
53d67eb1 by Peter Jung at 2024-10-15T16:03:15+02:00
nvidia-utils: Enable nvidia services as default in .install

The post_install will enable the services as default on first installation. 
This is an requirement for having sleep working on NVIDIa GPUs, specially on 
wayland.

post_upgrade will only enable the services once on upgrade for the upcoming 
version. This is intended that the user only gets in enabled once, to reflect 
our default behavior. If the user wants to disable them again, they want be 
forced to be installed.

Besides that we are removing some old comments, which are not revelant anymore.

Signed-off-by: Peter Jung <[email protected]>

- - - - -


1 changed file:

- nvidia-utils.install


Changes:

=====================================
nvidia-utils.install
=====================================
@@ -1,10 +1,26 @@
+post_install() {
+  # Enable NVIDIA Services at first installation
+  # The services are mandatory, see under systemd configuration
+  # 
https://download.nvidia.com/XFree86/Linux-x86_64/560.35.03/README/powermanagement.html#SystemdConfigur74e29
+  # This is also an requirement to have sleep working together with 
PreserveAllocations
+  # 
https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/commit/55644f78820fd382fbdf283b1fd7f08e6b7c22d7
+  # 
https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/merge_requests/16
+  systemctl enable nvidia-resume nvidia-hibernate nvidia-suspend
+}
+
 post_upgrade() {
-  echo "If you run into trouble with CUDA not being available, run 
nvidia-modprobe first."
-  echo "If you use GDM on Wayland, you might have to run systemctl enable 
--now nvidia-resume.service"
-  echo "If you use sleep on wayland, you might have to run systemctl enable 
nvidia-resume nvidia-hibernate nvidia-suspend"
+  # Only enable the services for the 560.35.03-16 version
+  # This avoids, that the services are automatically enabled in every upgrade
+  if (( $(vercmp $2 560.35.03-16) < 0)); then
+    for service in nvidia-resume nvidia-hibernate nvidia-suspend; do
+        if ! systemctl is-enabled --quiet $service; then
+            echo "Enabling $service..."
+            systemctl enable $service
+        fi
+    done
+  fi
 }
-# For the latter nore, see also https://gitlab.gnome.org/GNOME/gdm/-/issues/784
 
-post_install() {
-  post_upgrade
+post_remove() {
+  systemctl disable nvidia-resume nvidia-hibernate nvidia-suspend
 }



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/commit/53d67eb1f0695081d0a9cce4e165d5ff35539678

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/commit/53d67eb1f0695081d0a9cce4e165d5ff35539678
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to