Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-02-16 00:01:09 +0400
committerisaacs <i@izs.me>2014-02-16 00:01:09 +0400
commit02d4322cd4f67a078a29019d2c4ef591b281132c (patch)
treed24c8e481ce0d3edc79452edf5e9787d738dc82b /scripts
parent86028e9fd8524d5e520ce01ba2ebab5a030103fc (diff)
Follow redirects on curl|sh installer script
Closes #4673
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/install.sh b/scripts/install.sh
index 7a0a45f5d..74840459e 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -17,7 +17,16 @@ if [ "x$0" = "xsh" ]; then
# on some systems, you can just do cat>npm-install.sh
# which is a bit cuter. But on others, &1 is already closed,
# so catting to another script file won't do anything.
- curl -s https://npmjs.org/install.sh > npm-install-$$.sh
+ # Follow Location: headers, and fail on errors
+ curl -f -L -s https://www.npmjs.org/install.sh > npm-install-$$.sh
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ (exit 0)
+ else
+ rm npm-install-$$.sh
+ echo "Failed to download script" >&2
+ exit $ret
+ fi
sh npm-install-$$.sh
ret=$?
rm npm-install-$$.sh