powertop.trisquel6 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. # powertop.trisquel6: automatically sets up powertop --auto-tune on startup in trisquel 6
  3. #
  4. # Copyright (C) 2014 Francis Rowe <info@gluglug.org.uk>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. set -u -e -v
  20. if [[ $EUID -ne 0 ]]; then
  21. echo "This script must be run as root"
  22. exit 1
  23. fi
  24. # For Trisquel 6.0 (and 6.0.1) users.
  25. # powertop on Trisquel 6 is out of date. We will get it from git.
  26. # We are using a specific git revision (one that I have tested)
  27. # Delete the one that is already installed from repo's (if it is installed)
  28. apt-get -y purge powertop
  29. # Install dependencies:
  30. apt-get -y install libpci-dev libncurses-dev libnl-dev build-essential git autoconf2.13 libtool autotools-dev autopoint pkg-config
  31. # remove previous git clone if it exists:
  32. rm -rf powertop
  33. # Download from git
  34. git clone https://github.com/fenrus75/powertop.git
  35. cd powertop/
  36. # Revert to specific commit (from when powertop was last tested):
  37. git reset --hard e70c89eb5d7b6b8f898bb126adefcbf3202d5acf
  38. # build it
  39. ./autogen.sh
  40. ./configure
  41. make
  42. # install it
  43. make install
  44. # Remove startup symlink if it exists
  45. update-rc.d powertop remove
  46. # Remove previous file if it exists
  47. rm -rf /etc/init.d/powertop
  48. # write the correct commands there:
  49. cp ../powertop.trisquel6.init /etc/init.d/powertop
  50. # make it executable:
  51. chmod +x /etc/init.d/powertop
  52. # Add the service to make it run automatically at boot time:
  53. update-rc.d powertop defaults
  54. # Run powertop now and tell the user
  55. powertop --auto-tune
  56. echo "Done. Run 'powertop --auto-tune' now. This will also run automatically at boot time. Run it again at any time, if needed. This has also been done for you just now."
  57. # Come out of powertop directory (we are done)
  58. cd ../