Skip to content

Commit

Permalink
Use GNU tar on Mac OS
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-jay committed May 1, 2024
1 parent 78408e5 commit ad2f954
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git
.github
configs
LICENSE
Expand Down
10 changes: 9 additions & 1 deletion build/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ad2f954

Please sign in to comment.