bootstrap.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Simple bootstrap script to build and run the daemon
  3. if [ "$EUID" -eq 0 ]
  4. then echo "Please don't run bootstrap.sh as root."
  5. exit
  6. fi
  7. set -e
  8. # Check for scaling governor support and warn about it
  9. if [ ! -f "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" ]; then
  10. echo "WARNING: CPUFreq scaling governor device file was not found at \"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor\"."
  11. echo "This probably means that you have disabled processor scheduling features in your BIOS. See README.md (or GitHub issue #44) for more information."
  12. echo "This means GameMode's CPU governor control feature will not work (other features will still work)."
  13. # Allow to continue the install, as gamemode has other useful features
  14. read -p "Would you like to continue anyway [Y/N]? " -r
  15. [[ $REPLY =~ ^[Yy]$ ]]
  16. fi
  17. # Echo the rest so it's obvious
  18. set -x
  19. meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
  20. cd build
  21. ninja
  22. # Verify user wants to install
  23. set +x
  24. read -p "Install to /usr? [Yy] " -r
  25. [[ $REPLY =~ ^[Yy]$ ]]
  26. set -x
  27. sudo ninja install
  28. # Verify user wants to run the daemon
  29. set +x
  30. read -p "Enable and run the daemon? [Yy] " -r
  31. [[ $REPLY =~ ^[Yy]$ ]]
  32. set -x
  33. systemctl --user daemon-reload
  34. systemctl --user enable gamemoded
  35. systemctl --user restart gamemoded
  36. systemctl --user status gamemoded