Skip to content

Commit

Permalink
Fix wget support
Browse files Browse the repository at this point in the history
  • Loading branch information
SamiHostikka committed Jun 28, 2013
1 parent 4185193 commit 6367d39
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions bin/n
Expand Up @@ -31,16 +31,17 @@ abort() {
# curl / wget support

GET=

# wget support (Added --no-check-certificate for Github downloads)
command -v wget > /dev/null && GET="wget --no-check-certificate -q -O-"

# curl support
command -v curl > /dev/null && GET="curl -# -L"

# Ensure we have curl or wget

test -z "$GET" && abort "curl or wget required"
GET_OK=

if command -v curl > /dev/null; then
GET="curl -L#"
GET_OK="curl -Is"
elif command -v wget > /dev/null; then
GET="wget -O-"
GET_OK="wget --spider -SqO-"
else
abort "curl or wget required"
fi

#
# Output usage information.
Expand Down Expand Up @@ -206,7 +207,7 @@ erase_line() {
#

is_ok() {
curl -Is $1 | head -n 1 | grep 200 > /dev/null
$GET_OK $1 2>&1 | egrep "HTTP.*?200" > /dev/null
}

#
Expand Down Expand Up @@ -284,7 +285,7 @@ install_node() {
cd $dir

log fetch $url
curl -L# $url | tar -zx --strip 1
$GET $url | tar -zx --strip 1
erase_line

activate $version
Expand Down

0 comments on commit 6367d39

Please sign in to comment.