From: Łukasz Stelmach Date: Fri, 18 Dec 2020 19:11:50 +0000 (+0100) Subject: tizen: make version parsing insensitive to message tranlations X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b404afbd199748ff031eccd7bea9d3cf00f67e7;p=platform%2Fkernel%2Fu-boot.git tizen: make version parsing insensitive to message tranlations Localised versions of version messages present version number at different positions. Matching numbers with grep(1) ensures that version number is extracted properly regardles of the message format. Change-Id: I6dd4bc476aaa43c1a736f269dc14910d8653b730 Signed-off-by: Łukasz Stelmach --- diff --git a/scripts/tizen/sd_fusing_amlogic.sh b/scripts/tizen/sd_fusing_amlogic.sh index 2e904fe8c6..2961682147 100755 --- a/scripts/tizen/sd_fusing_amlogic.sh +++ b/scripts/tizen/sd_fusing_amlogic.sh @@ -55,10 +55,9 @@ function check_ddversion () { # before coreutils dd 8.24, dd doesn't support "status=progress" # and the option causes fusing failure. For backward compatibility, # do not use the option for old dd - local version=`dd --version | head -1 | awk '{print $3}'` - local major=${version%%.*} - local version=${version:`expr index $version .`} - local minor=${version%%.*} + local version=(`dd --version | head -1 | grep -o '[0-9]\+'`) + local major=${version[0]} + local minor=${version[1]} if [ $major -lt 8 ]; then OLD_DD=1 @@ -147,10 +146,9 @@ function mkpart_3 () { # NOTE: sfdisk 2.26 doesn't support units other than sectors and marks --unit option as deprecated. # The input data needs to contain multipliers (MiB) instead. - local version=`sfdisk -v | awk '{print $4}'` - local major=${version%%.*} - local version=${version:`expr index $version .`} - local minor=${version%%.*} + local version=(`sfdisk -v | grep -o '[0-9]\+'`) + local major=${version[0]} + local minor=${version[1]} local sfdisk_new=0 if [ $major -gt 2 ]; then diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index 0b9525793a..bbf97410d8 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -55,10 +55,9 @@ function check_ddversion () { # before coreutils dd 8.24, dd doesn't support "status=progress" # and the option causes fusing failure. For backward compatibility, # do not use the option for old dd - local version=`dd --version | head -1 | awk '{print $3}'` - local major=${version%%.*} - local version=${version:`expr index $version .`} - local minor=${version%%.*} + local version=(`dd --version | head -1 | grep -o '[0-9]\+'`) + local major=${version[0]} + local minor=${version[1]} if [ $major -lt 8 ]; then OLD_DD=1 @@ -147,10 +146,9 @@ function mkpart_3 () { # NOTE: sfdisk 2.26 doesn't support units other than sectors and marks --unit option as deprecated. # The input data needs to contain multipliers (MiB) instead. - local version=`sfdisk -v | awk '{print $4}'` - local major=${version%%.*} - local version=${version:`expr index $version .`} - local minor=${version%%.*} + local version=(`sfdisk -v | grep -o '[0-9]\+'`) + local major=${version[0]} + local minor=${version[1]} local sfdisk_new=0 if [ $major -gt 2 ]; then