39 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03#4# Script which clones and installs the latest pm-graph5# from http://github.com/intel/pm-graph.git6 7OUT=`mktemp -d 2>/dev/null`8if [ -z "$OUT" -o ! -e $OUT ]; then9 echo "ERROR: mktemp failed to create folder"10 exit11fi12 13cleanup() {14 if [ -e "$OUT" ]; then15 cd $OUT16 rm -rf pm-graph17 cd /tmp18 rmdir $OUT19 fi20}21 22git clone http://github.com/intel/pm-graph.git $OUT/pm-graph23if [ ! -e "$OUT/pm-graph/sleepgraph.py" ]; then24 echo "ERROR: pm-graph github repo failed to clone"25 cleanup26 exit27fi28 29cd $OUT/pm-graph30echo "INSTALLING PM-GRAPH"31sudo make install32if [ $? -eq 0 ]; then33 echo "INSTALL SUCCESS"34 sleepgraph -v35else36 echo "INSTALL FAILED"37fi38cleanup39