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>2011-01-05 00:06:03 +0300
committerisaacs <i@izs.me>2011-01-05 00:06:03 +0300
commit87d2343a77487331c8348e727fd9a9716874df31 (patch)
treec3499511e60055e3f23df9d985fc02f902884e04 /scripts
parent79ee8c70bbaff5a1003b26323afff4c1d16f6ec6 (diff)
Don't depend on make, but DO depend on node
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/install.sh b/scripts/install.sh
index 0b0737f57..19d209a35 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1,5 +1,13 @@
#!/bin/sh
+node=`which node 2>&1`
+ret=$?
+if [ $ret -ne 0 ] || ! [ -x $node ]; then
+ echo "npm cannot be installed without nodejs." >&2
+ echo "Install node first, and then try again." >&2
+ exit $ret
+fi
+
TMP="${TMPDIR}"
if [ "x$TMP" = "x" ]; then
TMP="/tmp"
@@ -28,6 +36,15 @@ if [ $? -ne 0 ] || ! [ -x $egrep ]; then
egrep=egrep
fi
+make=`which gmake 2>&1`
+if [ $? -ne 0 ] || ! [ -x $make ]; then
+ make=`which make 2>&1`
+ if [ $? -ne 0 ] || ! [ -x $make ]; then
+ make=NOMAKE
+ echo "Installing without make. This may fail." >&2
+ fi
+fi
+
url=`curl http://registry.npmjs.org/npm/latest \
| $egrep -o 'tarball":"[^"]+' \
| $egrep -o 'http://.*'`
@@ -40,7 +57,11 @@ fi
cd "$TMP" \
&& curl -L "$url" | $tar -xzf - \
&& cd * \
- && make uninstall install \
+ && (if ! [ "$make" = "NOMAKE" ]; then
+ $make uninstall dev
+ else
+ $node cli.js install .
+ fi) \
&& cd "$BACK" \
&& rm -rf "$TMP" \
&& echo "It worked"