xref: /linux/tools/power/pm-graph/install_latest_from_github.sh (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
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
7OUT=`mktemp -d 2>/dev/null`
8if [ -z "$OUT" -o ! -e $OUT ]; then
9	echo "ERROR: mktemp failed to create folder"
10	exit
11fi
12
13cleanup() {
14	if [ -e "$OUT" ]; then
15		cd $OUT
16		rm -rf pm-graph
17		cd /tmp
18		rmdir $OUT
19	fi
20}
21
22git clone http://github.com/intel/pm-graph.git $OUT/pm-graph
23if [ ! -e "$OUT/pm-graph/sleepgraph.py" ]; then
24	echo "ERROR: pm-graph github repo failed to clone"
25	cleanup
26	exit
27fi
28
29cd $OUT/pm-graph
30echo "INSTALLING PM-GRAPH"
31sudo make install
32if [ $? -eq 0 ]; then
33	echo "INSTALL SUCCESS"
34	sleepgraph -v
35else
36	echo "INSTALL FAILED"
37fi
38cleanup
39