nvidia_x11: fix suspend script paths since 470.57.02 (#131838)

nvidia 470.57.02 changed the path of `nvidia-sleep.sh` and systemd
scripts, making `builder.sh` miss them and suspend-to-ram on systems
where `hardware.nvidia.powerManagement.enable = true` is set fail.

(cherry picked from commit 3f4bb8ff5a8da1d5b2407e0d6cfb2acfc5bb7f90)
This commit is contained in:
André Vitor de Lima Matos 2021-08-02 17:42:47 +00:00 committed by Jonathan Ringer
parent 253365e354
commit 6ae8e459f5

View File

@ -46,11 +46,17 @@ installPhase() {
fi
# Install systemd power management executables
if [ -e systemd/nvidia-sleep.sh ]; then
mv systemd/nvidia-sleep.sh ./
fi
if [ -e nvidia-sleep.sh ]; then
sed -E 's#(PATH=).*#\1"$PATH"#' nvidia-sleep.sh > nvidia-sleep.sh.fixed
install -Dm755 nvidia-sleep.sh.fixed $out/bin/nvidia-sleep.sh
fi
if [ -e systemd/system-sleep/nvidia ]; then
mv systemd/system-sleep/nvidia ./
fi
if [ -e nvidia ]; then
sed -E "s#/usr(/bin/nvidia-sleep.sh)#$out\\1#" nvidia > nvidia.fixed
install -Dm755 nvidia.fixed $out/lib/systemd/system-sleep/nvidia