From 8d7e6faa745ff7af172b6af0422f38605e8b92b7 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Thu, 30 Mar 2023 23:36:34 +0900 Subject: [PATCH] Support 7z(1) besides unzip(1) --- README.md | 8 ++++---- install.sh | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5420708..8a76479 100644 --- a/README.md +++ b/README.md @@ -151,18 +151,18 @@ scoop reset deno ## Known Issues -### unzip is required +### either unzip or 7z is required -The program [`unzip`](https://linux.die.net/man/1/unzip) is a requirement for the Shell installer. +The program [`unzip`](https://linux.die.net/man/1/unzip) or [`7z`](https://linux.die.net/man/1/7z) is a requirement for the Shell installer. ```sh $ curl -fsSL https://deno.land/install.sh | sh -Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required). +Error: either unzip or 7z is required to install Deno (see: https://github.com/denoland/deno_install#either-unzip-or-7z-is-required ). ``` **When does this issue occur?** -During the `install.sh` process, `unzip` is used to extract the zip archive. +During the `install.sh` process, `unzip` or `7z` is used to extract the zip archive. **How can this issue be fixed?** diff --git a/install.sh b/install.sh index dd320d4..1f05cb4 100755 --- a/install.sh +++ b/install.sh @@ -4,8 +4,8 @@ set -e -if ! command -v unzip >/dev/null; then - echo "Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required )." 1>&2 +if ! command -v unzip >/dev/null && ! command -v 7z >/dev/null; then + echo "Error: either unzip or 7z is required to install Deno (see: https://github.com/denoland/deno_install#either-unzip-or-7z-is-required )." 1>&2 exit 1 fi @@ -38,7 +38,11 @@ if [ ! -d "$bin_dir" ]; then fi curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri" -unzip -d "$bin_dir" -o "$exe.zip" +if command -v 7z >/dev/null; then + 7z x -o"$bin_dir" -y "$exe.zip" +else + unzip -d "$bin_dir" -o "$exe.zip" +fi chmod +x "$exe" rm "$exe.zip"