Skip to content

Commit

Permalink
Fix make unarchive on Windows
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Dominic Della Valle <ddvpublic@gmail.com>
  • Loading branch information
djdv committed Feb 11, 2018
1 parent eca0486 commit a0f65fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/dist_get
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ unarchive() {
ua_infile="$2"
ua_outfile="$3"
ua_distname="$4"
ua_binpostfix=""

if [ "$(uname -o)" = "Msys" ]; then
ua_binpostfix=".exe"
fi
ua_outfile="$ua_outfile$ua_binpostfix"

if ! check_writeable "$ua_outfile"; then
die "unarchive error: cannot write to $ua_outfile"
Expand All @@ -66,7 +72,7 @@ unarchive() {
tar.gz)
if have_binary tar; then
echo "==> using 'tar' to extract binary from archive"
< "$ua_infile" tar -Ozxf - "$ua_distname/$ua_distname" > "$ua_outfile" \
< "$ua_infile" tar -Ozxf - "$ua_distname/$ua_distname$ua_binpostfix" > "$ua_outfile" \
|| die "tar has failed"
else
die "no binary on system for extracting tar files"
Expand All @@ -75,7 +81,7 @@ unarchive() {
zip)
if have_binary unzip; then
echo "==> using 'unzip' to extract binary from archive"
unzip -p "$ua_infile" "$ua_distname/$ua_distname" > "$ua_outfile" \
unzip -p "$ua_infile" "$ua_distname/$ua_distname$ua_binpostfix" > "$ua_outfile" \
|| die "unzip has failed"
else
die "no installed method for extracting .zip archives"
Expand Down

0 comments on commit a0f65fd

Please sign in to comment.