From ad2f954c837cd21a6ca1010c9e4f53fd9a65f601 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Wed, 1 May 2024 12:30:43 +1000 Subject: [PATCH] Use GNU tar on Mac OS --- .dockerignore | 1 + build/docker.sh | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 6a61f38..a284fa0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ +.git .github configs LICENSE diff --git a/build/docker.sh b/build/docker.sh index 9f1e94d..475a395 100755 --- a/build/docker.sh +++ b/build/docker.sh @@ -11,6 +11,7 @@ ARCHS=("amd64" "arm64") function map_depedencies() { # Check if Mac-GNU alternative binaries are installed getopt_cmd="getopt" + tar_cmd="tar" if [[ "$(uname)" == "Darwin" ]] ; then getopt_cmd="$(brew --prefix)/opt/gnu-getopt/bin/getopt" @@ -20,6 +21,13 @@ function map_depedencies() { Run \"brew install gnu-getopt\"" exit 2 fi + tar_cmd="$(brew --prefix)/opt/gnu-tar/bin/gtar" + if [[ ! -x "$(type -P "${tar_cmd}")" ]] ; then + echo >&2 " + ERROR: GNU version of tar not installed + Run \"brew install gnu-tar\"" + exit 3 + fi fi } @@ -48,7 +56,7 @@ function copy_binaries() { name="$(get_binary_name "${arch}")" id=$(docker create "${IMAGE}:${arch}") # docker cp produces a tar stream - docker cp "$id:/app/ebs-bootstrap" - | tar xf - --transform "s/ebs-bootstrap/${name}/" + docker cp "$id:/app/ebs-bootstrap" - | "${tar_cmd}" xf - --transform "s/ebs-bootstrap/${name}/" docker rm -v "$id" echo "🟢 Built and copied binary: ${name}" done