node-installer.sh/setup-iojs-ubuntu.bash

37 lines
1.0 KiB
Bash
Raw Normal View History

2015-01-15 22:41:04 +00:00
IOJS_VER=${1}
if [ -n "$(arch | grep 64)" ]; then
ARCH="x64"
2015-03-20 04:01:17 +00:00
elif [ -n "$(arch | grep armv7l)" ]; then
ARCH="armv7l"
elif [ -n "$(arch | grep armv6l)" ]; then
ARCH="armv6l"
2015-01-15 22:41:04 +00:00
else
ARCH="x86"
fi
2015-01-21 06:18:12 +00:00
IOJS_REMOTE="http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz"
IOJS_LOCAL="/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz"
IOJS_UNTAR="/tmp/iojs-${IOJS_VER}-linux-${ARCH}"
2015-01-15 22:41:04 +00:00
if [ -n "${IOJS_VER}" ]; then
echo "installing io.js as iojs ${IOJS_VER}..."
2015-01-15 22:43:34 +00:00
2015-01-21 06:18:12 +00:00
if [ -n "$(which curl 2>/dev/null)" ]; then
curl -fsSL ${IOJS_REMOTE} -o ${IOJS_LOCAL} || echo 'error downloading io.js'
elif [ -n "$(which wget 2>/dev/null)" ]; then
wget --quiet ${IOJS_REMOTE} -O ${IOJS_LOCAL} || echo 'error downloading io.js'
else
echo "'wget' and 'curl' are missing. Please run the following command and try again"
echo "\tsudo apt-get install --yes curl wget"
exit 1
fi
tar xf ${IOJS_LOCAL} -C /tmp/
2015-01-21 06:18:12 +00:00
rm ${IOJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md}
sudo rsync -a "${IOJS_UNTAR}/" /usr/local/
2015-01-15 22:41:04 +00:00
sudo chown -R $(whoami) /usr/local
fi