2014-12-22 00:16:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
|
|
|
|
|
|
|
|
NODE_VER=${1}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# node
|
2015-01-08 18:57:50 +00:00
|
|
|
if [ -n "$(which node | grep node 2>/dev/null)" ]; then
|
2015-01-08 19:00:38 +00:00
|
|
|
NODE_VER=""
|
|
|
|
|
2015-01-08 18:57:50 +00:00
|
|
|
if [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then
|
|
|
|
echo node ${NODE_VER} already installed
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
echo "HEY, LISTEN:"
|
|
|
|
echo "node is already installed as $(node -v | grep v)"
|
|
|
|
echo ""
|
|
|
|
echo "to reinstall please first run: rm $(which node)"
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${NODE_VER}" ]; then
|
|
|
|
if [ -n "$(arch | grep 64)" ]; then
|
|
|
|
ARCH="x64"
|
|
|
|
else
|
|
|
|
ARCH="x86"
|
|
|
|
fi
|
2014-12-22 00:16:06 +00:00
|
|
|
echo "installing node ${NODE_VER}..."
|
2015-01-08 18:57:50 +00:00
|
|
|
curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}-linux-${ARCH}.tar.gz" \
|
|
|
|
-o "/tmp/node-${NODE_VER}-linux-${ARCH}.tar.gz"
|
2014-12-22 00:16:06 +00:00
|
|
|
pushd /tmp
|
2015-01-08 18:57:50 +00:00
|
|
|
tar xf /tmp/node-${NODE_VER}-linux-${ARCH}.tar.gz
|
2014-12-22 00:16:06 +00:00
|
|
|
rm node-${NODE_VER}-linux-x64/{LICENSE,ChangeLog,README.md}
|
2015-01-08 18:57:50 +00:00
|
|
|
sudo rsync -a "/tmp/node-${NODE_VER}-linux-${ARCH}/" /usr/local/
|
2014-12-22 00:16:06 +00:00
|
|
|
sudo chown -R $(whoami) /usr/local
|
|
|
|
fi
|