1
0

bootstrap.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. if [ "$TRAVIS" != "true" ]; then
  14. # Allow to continue the install, as gamemode has other useful features
  15. read -p "Would you like to continue anyway [Y/N]? " -r
  16. [[ $REPLY =~ ^[Yy]$ ]]
  17. fi
  18. fi
  19. # accept a prefix value as: prefix=/path ./bootstrap.sh
  20. : ${prefix:=/usr}
  21. # Echo the rest so it's obvious
  22. set -x
  23. meson --prefix=$prefix build --buildtype debugoptimized -Dwith-systemd-user-unit-dir=/etc/systemd/user "$@"
  24. cd build
  25. ninja
  26. # Verify user wants to install
  27. set +x
  28. if [ "$TRAVIS" != "true" ]; then
  29. read -p "Install to $prefix? [y/N] " -r
  30. [[ $REPLY =~ ^[Yy]$ ]]
  31. fi
  32. set -x
  33. sudo ninja install
  34. # Restart polkit so we don't get pop-ups whenever we pkexec
  35. if systemctl list-unit-files |grep -q polkit.service; then
  36. sudo systemctl try-restart polkit
  37. fi
  38. # Reload systemd configuration so that it picks up the new service.
  39. systemctl --user daemon-reload