From 436c7cae3d100947af8a0acfd0fc1e2089f1d9e1 Mon Sep 17 00:00:00 2001 From: Serge Guzik Date: Wed, 13 Feb 2019 17:41:30 +0200 Subject: [PATCH] fix: macOS distro uncompressing on macOS --- warp4j | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/warp4j b/warp4j index e6f5583..c3bb60b 100755 --- a/warp4j +++ b/warp4j @@ -497,8 +497,19 @@ function ensure_distro_unpacked() { tar --strip-components=1 -C $unpacked_dir -xzf $download_dir/*.tar.gz ;; $MAC) + # to uncompess distro for macOS we need to use wildcards + # to use wildcards with GNU tar (on Linux) '--wildcard' option is required + # to use wildcards with BSD tar (on macOS) no options required + # if invoked with '--wildcards' BSD tar with exit with message: + # "Option --wildcards is not supported" + local tar_cmd + if tar --wildcards 2>&1 | grep "not supported" > /dev/null ; then + tar_cmd="tar" + else + tar_cmd="tar --wildcards" + fi mkdir -p $unpacked_dir - tar --wildcards --strip-components=3 -C $unpacked_dir -xzf $download_dir/*.tar.gz \ + $tar_cmd --strip-components=3 -C $unpacked_dir -xzf $download_dir/*.tar.gz \ "jdk*/Contents/Home" ;; $WIN)