electron/script/update-node

32 lines
727 B
Text
Raw Normal View History

#!/bin/bash
set -e
cd "$(dirname $0)/.."
NODE_VERSION=v0.10.5
[ -z $1 ] || NODE_VERSION=$1
# Test whether we need update.
if [ -f "node/node" ] && [[ `node/node --version` == $NODE_VERSION ]] ; then
exit 0
fi
case $OSTYPE in
darwin*) NODE_PLATFORM=darwin ;;
linux*) NODE_PLATFORM=linux ;;
*) echo "Unsupported platform $OSTYPE" && exit 1 ;;
esac
NODE_DIST_NAME="node-$NODE_VERSION-$NODE_PLATFORM-x86"
# Download node and untar
NODE_TARBALL_URL="https://gh-contractor-zcbenz.s3.amazonaws.com/node/dist/$NODE_DIST_NAME.tar.gz"
TARGET_DIR='node'
[ -d "$TARGET_DIR" ] || mkdir "$TARGET_DIR"
cd "$TARGET_DIR"
curl -fsSkL $NODE_TARBALL_URL | tar -zx || exit 1
cp "$NODE_DIST_NAME/bin/node" .
rm -rf "$NODE_DIST_NAME"