X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=scripts%2Fdtc-version.sh;h=53ff868bcdcecfe861304400d6e8b4ddcbeafefe;hb=71dfe179cd3840f56bc812131b4031b0976efbc1;hp=0744c39eb04cb227f54c138363228b619b397da2;hpb=78cb000b84d478c51326cc816280c25dafe447e6;p=platform%2Fkernel%2Fu-boot.git diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh index 0744c39..53ff868 100755 --- a/scripts/dtc-version.sh +++ b/scripts/dtc-version.sh @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ # # dtc-version dtc-command # @@ -9,12 +10,17 @@ dtc="$*" if [ ${#dtc} -eq 0 ]; then - echo "Error: No dtc command specified." + echo "Error: No dtc command specified" printf "Usage:\n\t$0 \n" exit 1 fi -MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1) +if ! which $dtc >/dev/null ; then + echo "Error: Cannot find dtc: $dtc" + exit 1 +fi + +MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1 | tr -d v) MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2) PATCH=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 3 | cut -d - -f 1)