nvidia f*ck u
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# Applies NVIDIA suspend/resume blank-screen fix on EndeavourOS (dracut, nvidia-open-dkms).
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$EUID" -eq 0 ]; then
|
||||
echo "Run this as your normal user, not root (it calls sudo itself)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> Writing /etc/modprobe.d/nvidia.conf"
|
||||
sudo tee /etc/modprobe.d/nvidia.conf > /dev/null <<'EOF'
|
||||
options nvidia-drm modeset=1
|
||||
options nvidia NVreg_PreserveVideoMemoryAllocations=1
|
||||
EOF
|
||||
|
||||
echo "==> Rebuilding initramfs"
|
||||
if command -v dracut-rebuild >/dev/null 2>&1; then
|
||||
sudo dracut-rebuild
|
||||
else
|
||||
sudo dracut --force --regenerate-all
|
||||
fi
|
||||
|
||||
echo "==> Enabling nvidia suspend/resume/hibernate services"
|
||||
sudo systemctl enable nvidia-suspend.service nvidia-resume.service nvidia-hibernate.service
|
||||
|
||||
echo "==> Installing systemd-sleep VT-switch hook"
|
||||
sudo tee /usr/lib/systemd/system-sleep/nvidia-resume-fix.sh > /dev/null <<'EOF'
|
||||
#!/bin/sh
|
||||
case "$1" in
|
||||
post)
|
||||
CUR=$(cat /sys/class/tty/tty0/active | grep -o '[0-9]*')
|
||||
ALT=2
|
||||
[ "$CUR" = "2" ] && ALT=3
|
||||
chvt "$ALT"
|
||||
sleep 1
|
||||
chvt "$CUR"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
sudo chmod +x /usr/lib/systemd/system-sleep/nvidia-resume-fix.sh
|
||||
|
||||
echo
|
||||
echo "Done. A reboot is required for the modeset/initramfs changes to take effect."
|
||||
echo "Run: sudo reboot"
|
||||
Reference in New Issue
Block a user