Skip to content

Commit e2e2c8d

Browse files
committed
Support 7z(1) besides unzip(1)
1 parent 82dcc3f commit e2e2c8d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,18 @@ scoop reset deno
151151

152152
## Known Issues
153153

154-
### unzip is required
154+
### either unzip or 7z is required
155155

156-
The program [`unzip`](https://linux.die.net/man/1/unzip) is a requirement for the Shell installer.
156+
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.
157157

158158
```sh
159159
$ curl -fsSL https://deno.land/install.sh | sh
160-
Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required).
160+
Error: either unzip or 7z is required to install Deno (see: https://github.com/denoland/deno_install#either-unzip-or-7z-is-required ).
161161
```
162162

163163
**When does this issue occur?**
164164

165-
During the `install.sh` process, `unzip` is used to extract the zip archive.
165+
During the `install.sh` process, `unzip` or `7z` is used to extract the zip archive.
166166

167167
**How can this issue be fixed?**
168168

install.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
set -e
66

7-
if ! command -v unzip >/dev/null; then
8-
echo "Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required )." 1>&2
7+
if ! command -v unzip >/dev/null && ! command -v 7z >/dev/null; then
8+
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
99
exit 1
1010
fi
1111

@@ -38,7 +38,11 @@ if [ ! -d "$bin_dir" ]; then
3838
fi
3939

4040
curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri"
41-
unzip -d "$bin_dir" -o "$exe.zip"
41+
if command -v 7z >/dev/null; then
42+
7z x -o"$bin_dir" -y "$exe.zip"
43+
else
44+
unzip -d "$bin_dir" -o "$exe.zip"
45+
fi
4246
chmod +x "$exe"
4347
rm "$exe.zip"
4448

0 commit comments

Comments
 (0)