install_tlp.sh 933 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. $su pacman -S tlp acpi_call
  11. $su sed -i 's/#CPU_SCALING_GOVERNOR_ON_AC=powersave/CPU_SCALING_GOVERNOR_ON_AC=powersave/g' /etc/tlp.conf
  12. $su sed -i 's/#CPU_SCALING_GOVERNOR_ON_BAT=powersave/CPU_SCALING_GOVERNOR_ON_BAT=powersave/g' /etc/tlp.conf
  13. $su sed -i 's/#CPU_MIN_PERF_ON_AC=0/CPU_MIN_PERF_ON_AC=0/g' /etc/tlp.conf
  14. $su sed -i 's/#CPU_MAX_PERF_ON_AC=100/CPU_MAX_PERF_ON_AC=50/g' /etc/tlp.conf
  15. $su sed -i 's/#CPU_MIN_PERF_ON_BAT=0/CPU_MIN_PERF_ON_BAT=0/g' /etc/tlp.conf
  16. $su sed -i 's/#CPU_MAX_PERF_ON_BAT=30/CPU_MAX_PERF_ON_BAT=30/g' /etc/tlp.conf
  17. $su sed -i 's/#CPU_BOOST_ON_AC=1/CPU_BOOST_ON_AC=0/g' /etc/tlp.conf
  18. $su sed -i 's/#CPU_BOOST_ON_BAT=0/CPU_BOOST_ON_BAT=0/g' /etc/tlp.conf
  19. $su sed -i 's/#USB_AUTOSUSPEND=1/USB_AUTOSUSPEND=0/g' /etc/tlp.conf
  20. $su tlp start