Skip to content
Snippets Groups Projects
Verified Commit 53d67eb1 authored by Peter Jung's avatar Peter Jung
Browse files

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: default avatarPeter Jung <ptr1337@archlinux.org>
parent 38739835
No related branches found
No related tags found
1 merge request!16nvidia-utils: Enable required systemd services
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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment