Skip to content

Commit

Permalink
Support 7z(1) besides unzip(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 30, 2023
1 parent 82dcc3f commit e2e2c8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?**

Expand Down
10 changes: 7 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down

0 comments on commit e2e2c8d

Please sign in to comment.