Created
July 9, 2013 15:39
-
-
Save SebastienElet/5958393 to your computer and use it in GitHub Desktop.
Node installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
apt-get install -y curl | |
CURRENT=$(node -v) | |
VERSION=$(curl -L -s http://nodejs.org/dist/latest/ \ | |
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \ | |
| tail -n1) | |
PLATFORM=linux | |
ARCH=x64 | |
PREFIX="/usr/local/" | |
if test "v$VERSION" != "$CURRENT"; then | |
echo "Installing node v$VERSION ..." | |
mkdir -p "$PREFIX" && \ | |
curl -# -L http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \ | |
| tar xzvf - --strip-components=1 -C "$PREFIX" | |
else | |
echo "Latest stable version of node already installed." | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment