From d7d7c955d94546d33b9531ad2a8ec40c7905a366 Mon Sep 17 00:00:00 2001 From: Gershom Date: Thu, 18 Jul 2019 01:59:04 -0400 Subject: [PATCH 1/3] avoid requiring xz on os x, improve reqs msg --- ghcup | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ghcup b/ghcup index cd5f7e3..4317ccc 100755 --- a/ghcup +++ b/ghcup @@ -1020,6 +1020,7 @@ download_to_stdout() { unpack() { [ -z "$1" ] && die "Internal error: no argument given to unpack" + mydistro=$(get_distro_alias "$(get_distro_name)") filename=$1 file_ext=${filename##*.} @@ -1028,8 +1029,14 @@ unpack() { # capability case "${file_ext}" in xz) - debug_message "xz -cd \"${filename}\" | tar -xf -" - ( xz -cd "${filename}" | tar -xf - ; ) || die "unpacking failed!" + if test "$mydistro" = "darwin"; + then + debug_message "tar -xzf \"${filename}\"" + ( tar -xzf "${filename}" ) || die "unpacking failed!" + else + debug_message "xz -cd \"${filename}\" | tar -xf -" + ( xz -cd "${filename}" | tar -xf - ; ) || die "unpacking failed!" + fi ;; gz) debug_message "gzip -cd \"${filename}\" | tar -xf -" @@ -1042,7 +1049,7 @@ unpack() { die "Unknown file extension: \"${file_ext}\"" esac - unset filename file_ext + unset mydistro filename file_ext } # @FUNCTION: ask_for_confirmation @@ -1998,8 +2005,13 @@ print_system_reqs() { mydistro=$(get_distro_alias "$(get_distro_name)") reqs_url=$(system_reqs_url "${mydistro}") + download_to_stdout "${reqs_url}" + if test "$mydistro" = "darwin"; then + printf "%s\n" "(Note: on OS X, in the course of running ghcup you will be given a dialog box to install the command line tools. Accept and the requirements will be installed for you. You will then need to run the command again.)" + fi + unset mydistro reqs_url } From be1300b08a6d875e108859bd21f64ffa82301763 Mon Sep 17 00:00:00 2001 From: Gershom Date: Mon, 22 Jul 2019 02:23:02 -0400 Subject: [PATCH 2/3] code review --- ghcup | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ghcup b/ghcup index 4317ccc..9086105 100755 --- a/ghcup +++ b/ghcup @@ -1029,8 +1029,7 @@ unpack() { # capability case "${file_ext}" in xz) - if test "$mydistro" = "darwin"; - then + if test "${mydistro}" = "darwin"; then debug_message "tar -xzf \"${filename}\"" ( tar -xzf "${filename}" ) || die "unpacking failed!" else @@ -1991,6 +1990,9 @@ system_reqs_url() { "debian"|"ubuntu") printf "%s/.requirements/ghc/ubuntu" "${BASE_DOWNLOAD_URL}" ;; + "darwin") + printf "%s/.requirements/ghc/darwin" "${BASE_DOWNLOAD_URL}" + ;; *) printf "%s/.requirements/ghc/default" "${BASE_DOWNLOAD_URL}" ;; @@ -2005,13 +2007,8 @@ print_system_reqs() { mydistro=$(get_distro_alias "$(get_distro_name)") reqs_url=$(system_reqs_url "${mydistro}") - download_to_stdout "${reqs_url}" - if test "$mydistro" = "darwin"; then - printf "%s\n" "(Note: on OS X, in the course of running ghcup you will be given a dialog box to install the command line tools. Accept and the requirements will be installed for you. You will then need to run the command again.)" - fi - unset mydistro reqs_url } From c356b5c5a475662d058e3fd8d14bb1b1f4622400 Mon Sep 17 00:00:00 2001 From: Gershom Date: Mon, 22 Jul 2019 02:23:38 -0400 Subject: [PATCH 3/3] code review --- .requirements/ghc/darwin | 1 + 1 file changed, 1 insertion(+) create mode 100644 .requirements/ghc/darwin diff --git a/.requirements/ghc/darwin b/.requirements/ghc/darwin new file mode 100644 index 0000000..4c3dd9b --- /dev/null +++ b/.requirements/ghc/darwin @@ -0,0 +1 @@ +(Note: on OS X, in the course of running ghcup you will be given a dialog box to install the command line tools. Accept and the requirements will be installed for you. You will then need to run the command again.) \ No newline at end of file