drivers: power: report battery voltage in AOSP compatible format
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / tools / perf / util / PERF-VERSION-GEN
CommitLineData
07800601
IM
1#!/bin/sh
2
c29ede61
ACM
3if [ $# -eq 1 ] ; then
4 OUTPUT=$1
5fi
6
7GVF=${OUTPUT}PERF-VERSION-FILE
07800601
IM
8
9LF='
10'
11
0e2af956 12#
869599ce 13# First check if there is a .git to get the version from git describe
0e2af956
IM
14# otherwise try to get the version from the kernel Makefile
15#
869599ce 16if test -d ../../.git -o -f ../../.git &&
688b2c2f 17 VN=$(git tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*")
07800601 18then
688b2c2f 19 VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD))
07800601
IM
20 VN=$(echo "$VN" | sed -e 's/-/./g');
21else
37aa9a2e 22 VN=$(MAKEFLAGS= make -sC ../.. kernelversion)
07800601
IM
23fi
24
25VN=$(expr "$VN" : v*'\(.*\)')
26
27if test -r $GVF
28then
3cecaa20 29 VC=$(sed -e 's/^#define PERF_VERSION "\(.*\)"/\1/' <$GVF)
07800601
IM
30else
31 VC=unset
32fi
33test "$VN" = "$VC" || {
34 echo >&2 "PERF_VERSION = $VN"
3cecaa20 35 echo "#define PERF_VERSION \"$VN\"" >$GVF
07800601
IM
36}
37
38