diff options
author | isaacs <i@izs.me> | 2011-09-17 06:56:29 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-09-17 06:56:29 +0400 |
commit | bfd2d59b16d873ad8e088f49b10fc44d8362c159 (patch) | |
tree | 8f7adc15383394edcceb42c85db9b17dd53d8fdc /scripts | |
parent | 754732869cd83c79f934fb54a972b9c0979e38c3 (diff) |
Use sed instead of egrep
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/install.sh | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/scripts/install.sh b/scripts/install.sh index 46aec9fe7..0b935c0b1 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -67,7 +67,7 @@ fi BACK="$PWD" -# sniff for gtar/gegrep/gmake +# sniff for gtar/gmake # use which, but don't trust it very much. tar="${TAR}" @@ -75,13 +75,6 @@ if [ -z "$tar" ]; then tar=tar fi -egrep=`which gegrep 2>&1` -if [ $? -eq 0 ] && [ -x $egrep ]; then - (exit 0) -else - egrep=egrep -fi - # Try to find a suitable make # If the MAKE environment var is set, use that. @@ -122,11 +115,10 @@ if [ -z "$t" ]; then t="latest" fi -url=`curl -s -L http://registry.npmjs.org/npm/$t \ - | $egrep -o 'tarball":"[^"]+' \ - | head -n 1 \ - | $egrep -o 'http://.*'` -echo "fetching: $url" >&2 +# need to echo "" after, because Posix sed doesn't treat EOF +# as an implied end of line. +url=`(curl -SsL http://registry.npmjs.org/npm/$t; echo "") \ + | sed -e 's/^.*tarball":"//' -e 's/".*$//'` ret=$? if [ $ret -ne 0 ]; then @@ -134,6 +126,8 @@ if [ $ret -ne 0 ]; then exit $ret fi +echo "fetching: $url" >&2 + cd "$TMP" \ && curl -s -L "$url" | gzip --decompress --stdout | $tar -xf - \ && cd * \ |