From 9f083c53e9765668bb0ba88407788ba9f432c94e Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Sun, 29 Sep 2019 14:43:05 +0200
Subject: [PATCH] Bsdtar has no explicit flag for xz decompression

At least as of Mac OS 10.13.6 the included bsdtar has no flag for xz
decompression while `z` means gzip decompression which is obviously
problematic for xz compressed archives.

I believe that any tar version on Mac OS that can decompress xz archives
also automatically detects compression formats. So `tar xf` should be
fine.

Fixes #119
---
 ghcup | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ghcup b/ghcup
index e812fb6..d5c90a1 100755
--- a/ghcup
+++ b/ghcup
@@ -1038,8 +1038,8 @@ unpack() {
     case "${file_ext}" in
         xz)
             if test "${mydistro}" = "darwin"; then
-              debug_message "tar -xzf \"${filename}\""
-              ( tar -xzf "${filename}" ) || die "unpacking failed!"
+              debug_message "tar xf \"${filename}\""
+              ( tar xf "${filename}" ) || die "unpacking failed!"
             else
               debug_message "xz -cd \"${filename}\" | tar -xf -"
               ( xz -cd "${filename}" | tar -xf - ; ) || die "unpacking failed!"
-- 
GitLab