Skip to content

Instantly share code, notes, and snippets.

@clakech
Last active December 17, 2015 08:08
Show Gist options
  • Save clakech/5577649 to your computer and use it in GitHub Desktop.
Save clakech/5577649 to your computer and use it in GitHub Desktop.
#!/bin/sh
################################################################################
# Copyright 2010-2011 CloudBees Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
# To call this script:
# wget -q https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
# NODE_VERSION=0.7.8 . ./use-node
if [[ -z $NODE_VERSION ]]; then
echo "You must set the NODE_VERSION environment variable. See http://wiki.cloudbees.com/bin/view/DEV/Node+Builds" 1>&2
fi
set -e
mkdir -p node
ARCH=`uname -m`
node_name=node-${NODE_VERSION}-${ARCH}
test -f ./node/${node_name}.tar.bz2 || wget -q -P ./node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/${node_name}.tar.bz2
test -f ./node/${node_name}/bin/node || tar xjf ./node/${node_name}.tar.bz2 -C ./node
export PATH=$HOME/node/${node_name}/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment