2014-12-22 00:16:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
|
|
|
|
|
2015-01-14 09:43:38 +00:00
|
|
|
IOJS_VER=${1}
|
2014-12-22 00:16:06 +00:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo "updating apt-get..."
|
|
|
|
sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null
|
|
|
|
|
|
|
|
# fail2ban
|
|
|
|
if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
|
|
|
|
echo "installing fail2ban..."
|
|
|
|
sudo bash -c "apt-get install -qq -y fail2ban < /dev/null" > /dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
# git, wget, curl, build-essential
|
2015-01-02 19:30:47 +00:00
|
|
|
if [ -z "$(which pkg-config | grep pkg-config)" ] || [ -z "$(which git | grep git)" ] || [ -z "$(which wget | grep wget)" ] || [ -z "$(which curl | grep curl)" ] || [ -z "$(which gcc | grep gcc)" ] || [ -z "$(which rsync | grep rsync)" ]
|
2014-12-22 00:16:06 +00:00
|
|
|
then
|
2014-12-28 08:48:20 +00:00
|
|
|
echo "installing git, wget, curl, build-essential, rsync, pkg-config..."
|
2014-12-28 01:10:25 +00:00
|
|
|
sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null
|
2014-12-22 00:16:06 +00:00
|
|
|
fi
|
|
|
|
|
2015-01-15 22:01:58 +00:00
|
|
|
#
|
|
|
|
# iojs
|
|
|
|
#
|
|
|
|
if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then
|
|
|
|
# iojs of some version is already installed
|
2015-01-14 09:43:38 +00:00
|
|
|
if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then
|
|
|
|
echo iojs ${IOJS_VER} already installed
|
2015-01-15 21:43:34 +00:00
|
|
|
IOJS_VER=""
|
2015-01-08 18:57:50 +00:00
|
|
|
else
|
|
|
|
echo "HEY, LISTEN:"
|
2015-01-15 22:01:58 +00:00
|
|
|
echo ""
|
2015-01-14 09:43:38 +00:00
|
|
|
echo "io.js is already installed as iojs $(iojs -v | grep v)"
|
2015-01-08 18:57:50 +00:00
|
|
|
echo ""
|
2015-01-14 09:43:38 +00:00
|
|
|
echo "to reinstall please first run: rm $(which iojs)"
|
2015-01-08 18:57:50 +00:00
|
|
|
echo ""
|
|
|
|
fi
|
2015-01-15 22:01:58 +00:00
|
|
|
elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then
|
|
|
|
# node of some version is already installed
|
|
|
|
echo ""
|
|
|
|
echo "################################################################################"
|
|
|
|
echo ""
|
|
|
|
echo "HEY, LISTEN!"
|
|
|
|
echo ""
|
|
|
|
echo "You have node.js installed."
|
|
|
|
echo "Backing up $(which node) as $(which node).$(node -v)"
|
|
|
|
echo "(copy it back after the install if to maintain node.js and io.js separately)"
|
|
|
|
echo ""
|
|
|
|
echo sudo mv "$(which node)" "$(which node).$(node -v)"
|
|
|
|
sudo mv "$(which node)" "$(which node).$(node -v)"
|
|
|
|
sleep 3
|
|
|
|
echo "################################################################################"
|
|
|
|
echo ""
|
2015-01-08 18:57:50 +00:00
|
|
|
fi
|
|
|
|
|
2015-01-14 09:43:38 +00:00
|
|
|
if [ -n "${IOJS_VER}" ]; then
|
2015-01-08 18:57:50 +00:00
|
|
|
if [ -n "$(arch | grep 64)" ]; then
|
|
|
|
ARCH="x64"
|
|
|
|
else
|
|
|
|
ARCH="x86"
|
|
|
|
fi
|
2015-01-14 09:43:38 +00:00
|
|
|
echo "installing io.js as iojs ${IOJS_VER}..."
|
|
|
|
curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \
|
|
|
|
-o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz"
|
2014-12-22 00:16:06 +00:00
|
|
|
pushd /tmp
|
2015-01-14 09:43:38 +00:00
|
|
|
tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz
|
2015-01-14 09:54:25 +00:00
|
|
|
rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md}
|
2015-01-14 09:43:38 +00:00
|
|
|
sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/
|
2014-12-22 00:16:06 +00:00
|
|
|
sudo chown -R $(whoami) /usr/local
|
|
|
|
fi
|