install_latest_from_github.sh 703 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. #
  4. # Script which clones and installs the latest pm-graph
  5. # from http://github.com/intel/pm-graph.git
  6. OUT=`mktemp -d 2>/dev/null`
  7. if [ -z "$OUT" -o ! -e $OUT ]; then
  8. echo "ERROR: mktemp failed to create folder"
  9. exit
  10. fi
  11. cleanup() {
  12. if [ -e "$OUT" ]; then
  13. cd $OUT
  14. rm -rf pm-graph
  15. cd /tmp
  16. rmdir $OUT
  17. fi
  18. }
  19. git clone http://github.com/intel/pm-graph.git $OUT/pm-graph
  20. if [ ! -e "$OUT/pm-graph/sleepgraph.py" ]; then
  21. echo "ERROR: pm-graph github repo failed to clone"
  22. cleanup
  23. exit
  24. fi
  25. cd $OUT/pm-graph
  26. echo "INSTALLING PM-GRAPH"
  27. sudo make install
  28. if [ $? -eq 0 ]; then
  29. echo "INSTALL SUCCESS"
  30. sleepgraph -v
  31. else
  32. echo "INSTALL FAILED"
  33. fi
  34. cleanup