From: Yann E. MORIN" Date: Tue, 14 Feb 2012 00:01:37 +0000 (+0100) Subject: scripts/version: add option to output only the kernel version X-Git-Tag: v3.3.0-0~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d138c37c4ddacc4a099bce68372541b05c2e7d64;p=kconfig-frontends scripts/version: add option to output only the kernel version We'll be using that to version the parser shared library, later. Use '--plain' as argument to get the kernel version. Signed-off-by: "Yann E. MORIN" --- diff --git a/scripts/version.sh b/scripts/version.sh index 36bb0ca..bbfc0e7 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,15 +1,23 @@ #!/bin/sh +if [ "${1}" = "--plain" ]; then + plain=1 +else + plain=0 +fi + k_ver="$( head -n 1 .version |cut -d ' ' -f 1 )" k_cset="$( head -n 1 .version |cut -d ' ' -f 2 )" k_name="$( head -n 1 .version |cut -d ' ' -f 3- )" kf_ver="$( tail -n 1 .version )" +k_ver_plain="$( echo "${k_ver}" |sed -r -e 's/-rc[[:digit:]]+$//;' )" + case "${k_ver}" in - *-rc*) k_ver="${k_ver}_$( printf "%-7.7s" "${k_cset}" )";; - *) ;; + *-rc*) k_ver_extra="_$( printf "%-7.7s" "${k_cset}" )";; + *) k_ver_extra="";; esac -k_ver="$( echo "${k_ver}" |tr '-' '_' )" +k_ver_extra="$( echo "${k_ver_extra}" |tr '-' '_' )" case "${kf_ver}" in hg) kf_ver="-hg_$( hg id -i -r . )";; @@ -17,4 +25,9 @@ case "${kf_ver}" in *) kf_ver="-${kf_ver}";; esac -echo "${k_ver}${kf_ver}" +if [ "${plain}" -eq 1 ]; then + echo "${k_ver_plain}" +else + echo "${k_ver}${k_ver_extra}${kf_ver}" +fi +