python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / support / dependencies / check-host-tar.sh
blob932d3c4fb20004bfa76a718050cffb9ac8df6c58
1 #!/bin/sh
3 candidate="$1"
5 tar=`which $candidate`
6 if [ ! -x "$tar" ]; then
7 tar=`which tar`
8 if [ ! -x "$tar" ]; then
9 # echo nothing: no suitable tar found
10 exit 1
14 # Output of 'tar --version' examples:
15 # tar (GNU tar) 1.15.1
16 # tar (GNU tar) 1.25
17 # bsdtar 2.8.3 - libarchive 2.8.3
18 version=`$tar --version | head -n 1 | sed 's/^.*\s\([0-9]\+\.\S\+\).*$/\1/'`
19 major=`echo "$version" | cut -d. -f1`
20 minor=`echo "$version" | cut -d. -f2`
21 bugfix=`echo "$version" | cut -d. -f3`
22 version_bsd=`$tar --version | grep 'bsdtar'`
23 if [ ! -z "${version_bsd}" ] ; then
24 # mark as invalid version - not all command line options are available
25 major=0
26 minor=0
29 # Minimal version = 1.17 (previous versions do not correctly unpack archives
30 # containing hard-links if the --strip-components option is used).
31 major_min=1
32 minor_min=17
33 if [ $major -gt $major_min ]; then
34 echo $tar
35 else
36 if [ $major -eq $major_min -a $minor -ge $minor_min ]; then
37 echo $tar
38 else
39 # echo nothing: no suitable tar found
40 exit 1