move paths to bash vars

This commit is contained in:
AJ ONeal 2015-01-20 23:18:12 -07:00
parent 05dd997bf6
commit 6d2d7e7c20
1 changed files with 17 additions and 6 deletions

View File

@ -6,15 +6,26 @@ else
ARCH="x86" ARCH="x86"
fi fi
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}"
if [ -n "${IOJS_VER}" ]; then if [ -n "${IOJS_VER}" ]; then
echo "installing io.js as iojs ${IOJS_VER}..." echo "installing io.js as iojs ${IOJS_VER}..."
curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \ if [ -n "$(which curl 2>/dev/null)" ]; then
-o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" curl -fsSL ${IOJS_REMOTE} -o ${IOJS_LOCAL} || echo 'error downloading io.js'
pushd /tmp >/dev/null elif [ -n "$(which wget 2>/dev/null)" ]; then
tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz wget --quiet ${IOJS_REMOTE} -O ${IOJS_LOCAL} || echo 'error downloading io.js'
rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md} else
sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/ 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}
rm ${IOJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md}
sudo rsync -a "${IOJS_UNTAR}/" /usr/local/
sudo chown -R $(whoami) /usr/local sudo chown -R $(whoami) /usr/local