Path: blob/master/tools/power/cpupower/utils/version-gen.sh
26292 views
#!/bin/sh1# SPDX-License-Identifier: GPL-2.02#3# Script which prints out the version to use for building cpupowerutils.4# Must be called from tools/power/cpupower/5#6# Heavily based on tools/perf/util/PERF-VERSION-GEN .78LF='9'1011# First check if there is a .git to get the version from git describe12# otherwise try to get the version from the kernel makefile13if test -d ../../../.git -o -f ../../../.git &&14VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&15case "$VN" in16*$LF*) (exit 1) ;;17v[0-9]*)18git update-index -q --refresh19test -z "$(git diff-index --name-only HEAD --)" ||20VN="$VN-dirty" ;;21esac22then23VN=$(echo "$VN" | sed -e 's/-/./g');24else25eval $(grep '^VERSION[[:space:]]*=' ../../../Makefile|tr -d ' ')26eval $(grep '^PATCHLEVEL[[:space:]]*=' ../../../Makefile|tr -d ' ')27eval $(grep '^SUBLEVEL[[:space:]]*=' ../../../Makefile|tr -d ' ')28eval $(grep '^EXTRAVERSION[[:space:]]*=' ../../../Makefile|tr -d ' ')2930VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"31fi3233VN=$(expr "$VN" : v*'\(.*\)')3435echo $VN363738