[CRIU] [PATCH 1/6] zdtm: Make kernel version check more POSIX-like
Andrew Vagin
avagin at parallels.com
Tue Aug 12 04:01:37 PDT 2014
Acked-by: Andrew Vagin <avagin at parallels.com>
On Wed, Aug 06, 2014 at 06:02:09PM -0400, Christopher Covington wrote:
> Arrays and "&&" in test are not supported by Busybox v1.19.4. The
> `set` command can put field-separated arguments into the positional
> parameters, which is relatively equivalent to using an array.
>
> Signed-off-by: Christopher Covington <cov at codeaurora.org>
> ---
> test/zdtm.sh | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 1c7bfef..19f74da 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -257,9 +257,6 @@ check_criu()
>
> check_mainstream()
> {
> - local -a ver_arr
> - local ver_str=`uname -r`
> -
> zdtm_sep "CRIU CHECK"
>
> $CRIU check && return 0
> @@ -273,12 +270,12 @@ git://git.kernel.org/pub/scm/linux/kernel/git/gorcunov/linux-cr.git
> ===================================================================
> EOF
>
> - ver_arr=(`echo ${ver_str//./ }`)
> + set -- `uname -r | sed 's/\./ /g'`
>
> - [ "${ver_arr[0]}" -gt 3 ] && return 0
> - [[ "${ver_arr[0]}" -eq 3 && "${ver_arr[1]}" -ge 11 ]] && return 0
> + [ $1 -gt 3 ] && return 0
> + [ $1 -eq 3 -a $2 -ge 11 ] && return 0
>
> - echo "A version of kernel should be greater or equal to 3.11" >&2
> + echo "Kernel version should be greater than or equal to 3.11" >&2
>
> return 1
> }
> --
> Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by the Linux Foundation.
>
More information about the CRIU
mailing list