mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Bundle offical node binary with Atom.
This is required for using child_process.fork.
This commit is contained in:
43
script/update-node
Executable file
43
script/update-node
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname $0)/.."
|
||||
|
||||
# Test whether we need update.
|
||||
if [ -d "node/node" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! DOWNLOAD_PAGE=$(curl -fsSkL http://nodejs.org/download/); then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
NODE_VERSION=$(echo "$DOWNLOAD_PAGE" \
|
||||
| awk '/Current version:/ { print }' \
|
||||
| awk -F"[<>]" '{ print $5 }')
|
||||
|
||||
case $OSTYPE in
|
||||
darwin*) NODE_PLATFORM=darwin ;;
|
||||
linux*) NODE_PLATFORM=linux ;;
|
||||
*) echo "Unsupported platform $OSTYPE" && exit 1 ;;
|
||||
esac
|
||||
|
||||
if uname -a | grep 'x86_64' > /dev/null ; then
|
||||
NODE_ARCH=x64
|
||||
else
|
||||
NODE_ARCH=x86
|
||||
fi
|
||||
|
||||
NODE_DIST_NAME="node-$NODE_VERSION-$NODE_PLATFORM-$NODE_ARCH"
|
||||
|
||||
# Download node and untar
|
||||
NODE_TARBALL_URL="http://nodejs.org/dist/$NODE_VERSION/$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"
|
||||
|
||||
Reference in New Issue
Block a user