Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wget fallback support for minimal OS's #262

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
**With Shell:**

```sh
curl -fsSL https://deno.land/install.sh | sh
s=https://deno.land/install.sh;sh <<<"$(curl -fsSL $s || wget -qO- $s)"
```

**With PowerShell:**
Expand All @@ -23,7 +23,7 @@ irm https://deno.land/install.ps1 | iex
**With Shell:**

```sh
curl -fsSL https://deno.land/install.sh | sh -s v1.0.0
s=https://deno.land/install.sh;sh -s v1.0.0 <<<"$(curl -fsSL $s || wget -qO- $s)"
```

**With PowerShell:**
Expand Down
13 changes: 10 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

set -e

if ! command -v unzip >/dev/null; then
has() {
command -v "$1" >/dev/null
}

if ! has unzip; then
echo "Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required )." 1>&2
exit 1
fi
Expand Down Expand Up @@ -37,13 +41,16 @@ if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi

curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri"
curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri" || \
wget --output-document="$exe.zip" "$deno_uri" || \
echo "When installing deno, I looked for the 'curl' and for 'wget' commands but I didn't see either of them. Please install one of them, otherwise I have no way to install Deno"

unzip -d "$bin_dir" -o "$exe.zip"
chmod +x "$exe"
rm "$exe.zip"

echo "Deno was installed successfully to $exe"
if command -v deno >/dev/null; then
if has deno; then
echo "Run 'deno --help' to get started"
else
case $SHELL in
Expand Down