commit 01e05bb9d0a301a426c2d5965e86519224617111
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Fri Sep 10 14:04:34 2021 +0100
Add systemd preset to power sub-package
70-nvidia.preset | 8 ++++++++
xorg-x11-drv-nvidia.spec | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/70-nvidia.preset b/70-nvidia.preset
new file mode 100644
index 0000000..56f61b1
--- /dev/null
+++ b/70-nvidia.preset
@@ -0,0 +1,8 @@
+# Enable complete power management. From:
+# file:///usr/share/doc/nvidia-driver/html/powermanagement.html
+
+enable nvidia-suspend.service
+enable nvidia-hibernate.service
+
+# Resume is triggered by nvidia-sleep.sh:
+disable nvidia-resume.service
diff --git a/xorg-x11-drv-nvidia.spec b/xorg-x11-drv-nvidia.spec
index 43aeaa1..deaed9f 100644
--- a/xorg-x11-drv-nvidia.spec
+++ b/xorg-x11-drv-nvidia.spec
@@ -41,6 +41,7 @@ Source13: 10-nvidia.rules
Source14: nvidia-fallback.service
Source15: rhel_nvidia.conf
Source16: nvidia-power-management.conf
+Source17: 70-nvidia.preset
ExclusiveArch: x86_64 i686
@@ -365,7 +366,8 @@ install -p -m 0644 %{SOURCE13} %{buildroot}%{_udevrulesdir}
install -p -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}
# Systemd units and script for suspending/resuming
-mkdir %{buildroot}%{_systemd_util_dir}/system-sleep/
+mkdir %{buildroot}%{_systemd_util_dir}/system-{sleep,preset}/
+install -p -m 0644 %{SOURCE17} %{buildroot}%{_systemd_util_dir}/system-preset/
install -p -m 0644 systemd/system/nvidia-{hibernate,resume,suspend}.service
%{buildroot}%{_unitdir}
install -p -m 0755 systemd/system-sleep/nvidia
%{buildroot}%{_systemd_util_dir}/system-sleep/
install -p -m 0755 systemd/nvidia-sleep.sh %{buildroot}%{_bindir}
@@ -555,6 +557,7 @@ fi ||:
%files power
%config %{_modprobedir}/nvidia-power-management.conf
%{_bindir}/nvidia-sleep.sh
+%{_systemd_util_dir}/system-preset/70-nvidia.preset
%{_systemd_util_dir}/system-sleep/nvidia
%{_unitdir}/nvidia-hibernate.service
%{_unitdir}/nvidia-resume.service