aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-08-30 13:19:00 +0200
committerGitHub <noreply@github.com>2021-08-30 13:19:00 +0200
commit0b6bff5455aa5a3371c3a5678dbc8cf867fce515 (patch)
tree9649cd85f665dcb219b6564c7d04d38353a3f7a1
parent9f9b0d267f7d6c4bb98c97bc52fb32c999d4e494 (diff)
parent67035ee23d98c5632b351827a545c7fe64fdcf85 (diff)
Merge pull request #5096 from AnatoleLucet/patch-1
Remove curl deps in install script
-rwxr-xr-xscripts/install.in11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/install.in b/scripts/install.in
index ffc1f2785..5be4f9dda 100755
--- a/scripts/install.in
+++ b/scripts/install.in
@@ -76,14 +76,21 @@ fi
tarball=$tmpDir/nix-@nixVersion@-$system.tar.xz
-require_util curl "download the binary tarball"
require_util tar "unpack the binary tarball"
if [ "$(uname -s)" != "Darwin" ]; then
require_util xz "unpack the binary tarball"
fi
+if command -v wget > /dev/null 2>&1; then
+ fetch() { wget "$1" -O "$2"; }
+elif command -v curl > /dev/null 2>&1; then
+ fetch() { curl -L "$1" -o "$2"; }
+else
+ oops "you don't have wget or curl installed, which I need to download the binary tarball"
+fi
+
echo "downloading Nix @nixVersion@ binary tarball for $system from '$url' to '$tmpDir'..."
-curl -L "$url" -o "$tarball" || oops "failed to download '$url'"
+fetch "$url" "$tarball" || oops "failed to download '$url'"
if command -v sha256sum > /dev/null 2>&1; then
hash2="$(sha256sum -b "$tarball" | cut -c1-64)"