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>2010-12-02 06:02:57 +0300
committerisaacs <i@izs.me>2010-12-02 06:02:57 +0300
commite0a24d531417f6b276c5a834997ac9c999d90c39 (patch)
treec84e5112de8ae02f4be2dd7e5c3a9ffc63194c6b /scripts
parent68f339eaeb74fab975a56be551f10bba6a01f495 (diff)
Updates to work properly on solaris. Grr.
I caved. It's /bin/bash now, not /bin/sh. Oh well.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/install.sh34
1 files changed, 26 insertions, 8 deletions
diff --git a/scripts/install.sh b/scripts/install.sh
index a8425fa7d..43f8f5157 100644
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1,19 +1,37 @@
-#!/bin/sh
-r=${RANDOM-$(date +%s)}
+#!/bin/bash
TMP=$(mktemp -dt npm.XXXXXX)
-if [ "x$TMP" == "x" ]; then
- TMP=$PWD/npm-$r
- mkdir -- "$TMP" || (echo "failed to mkdir $TMP" >&2 ; exit 1)
+if [ -n "$TMP" ]; then
+ TMP=$PWD/npm-install-please-remove-this
+ rm -rf -- $TMP || true
+ mkdir -- "$TMP"
+ if [ $? -ne 0 ]; then
+ echo "failed to mkdir $TMP" >&2
+ exit 1
+ fi
fi
BACK="$PWD"
-tar=${TAR-$(if which gtar 1>/dev/null 2>/dev/null; then echo "gtar" ; else echo "tar" ; fi)}
-egrep=$(if which gegrep 1>/dev/null 2>/dev/null; then echo "gegrep" ; else echo "egrep" ; fi)
+tar=${TAR}
+if [ -n "$tar" ]; then
+ if which gtar 1>/dev/null 2>/dev/null; then
+ tar=gtar
+ else
+ tar=tar
+ fi
+fi
+
+if which gegrep 1>/dev/null 2>/dev/null; then
+ egrep="gegrep"
+else
+ egrep="egrep"
+fi
+
cd -- "$TMP" \
&& curl -L $(
curl http://registry.npmjs.org/npm/latest \
| $egrep -o 'tarball":"[^"]+' \
| $egrep -o 'http://.*'
- ) | $tar -xzf - --strip-components=1 \
+ ) | $tar -xzf - \
+ && cd * \
&& make uninstall install \
&& cd -- "$BACK" \
&& rm -rf -- "$TMP" \