forked from coolaj86/node-installer.sh
refactor
This commit is contained in:
parent
b44332e44d
commit
e013693961
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c
|
||||
NO_FAIL2BAN=${1}
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# XCode
|
||||
# testing for which git, gcc, etc will not work because the tools are aliased to the install script
|
||||
if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2>/dev/null)" ]; then
|
||||
echo "Hey You!!!"
|
||||
echo ""
|
||||
echo "A thingy is going to pop up and ask you to install 'command line developer tools' for 'xcode-select'"
|
||||
echo ""
|
||||
echo "You need to click Install. This installation should begin when that finishes."
|
||||
echo "(if that box doesn't pop up in a second or two, something went wrong)"
|
||||
echo "(note that it may pop up underneath this window, so check for it in the dock too)"
|
||||
echo ""
|
||||
|
||||
xcode-select --install 2>/dev/null
|
||||
|
||||
while true; do
|
||||
sleep 5
|
||||
|
||||
if [ -n "$(git --version 2>/dev/null)" ] && [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "It looks like the other install is finishing up."
|
||||
echo "This installation will begin in one minute."
|
||||
sleep 60
|
||||
else
|
||||
echo "XCode Command Line Tools already installed"
|
||||
fi
|
||||
|
||||
# homebrew
|
||||
if [ -z "$(which brew | grep brew)" ]; then
|
||||
echo "installing brew (homebrew)..."
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew doctor
|
||||
else
|
||||
echo "updating brew..."
|
||||
brew update >/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -z "$(which wget | grep wget)" ]; then
|
||||
echo "installing wget..."
|
||||
brew install wget
|
||||
else
|
||||
echo "wget already installed"
|
||||
fi
|
||||
|
||||
# http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5)
|
||||
if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
|
||||
if [ -z "${NO_FAIL2BAN}" ]; then
|
||||
brew install fail2ban
|
||||
sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons
|
||||
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(which pkg-config | grep pkg-config)" ]; then
|
||||
echo "installing pkg-config..."
|
||||
brew install pkg-config
|
||||
else
|
||||
echo "pkg-config already installed"
|
||||
fi
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
|
||||
|
||||
NO_FAIL2BAN=${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
|
||||
if [ -z "${NO_FAIL2BAN}" ]; then
|
||||
echo "installing fail2ban..."
|
||||
sudo bash -c "apt-get install -qq -y fail2ban < /dev/null" > /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
# git, wget, curl, build-essential
|
||||
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)" ]
|
||||
then
|
||||
echo "installing git, wget, curl, build-essential, rsync, pkg-config..."
|
||||
sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
IOJS_VER=${1}
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
echo "installing io.js as iojs ${IOJS_VER}..."
|
||||
curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -o "/tmp/iojs-${IOJS_VER}.pkg"
|
||||
sudo /usr/sbin/installer -pkg "/tmp/iojs-${IOJS_VER}.pkg" -target /
|
||||
|
||||
|
||||
sudo chown -R $(whoami) /usr/local 2>/dev/null
|
||||
fi
|
|
@ -0,0 +1,20 @@
|
|||
IOJS_VER=${1}
|
||||
|
||||
if [ -n "$(arch | grep 64)" ]; then
|
||||
ARCH="x64"
|
||||
else
|
||||
ARCH="x86"
|
||||
fi
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
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"
|
||||
pushd /tmp
|
||||
tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz
|
||||
rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md}
|
||||
sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/
|
||||
|
||||
|
||||
sudo chown -R $(whoami) /usr/local
|
||||
fi
|
|
@ -1,134 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c
|
||||
IOJS_VER=${1}
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# XCode
|
||||
# testing for which git, gcc, etc will not work because the tools are aliased to the install script
|
||||
if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2>/dev/null)" ]; then
|
||||
echo "Hey You!!!"
|
||||
echo ""
|
||||
echo "A thingy is going to pop up and ask you to install 'command line developer tools' for 'xcode-select'"
|
||||
echo ""
|
||||
echo "You need to click Install. This installation should begin when that finishes."
|
||||
echo "(if that box doesn't pop up in a second or two, something went wrong)"
|
||||
echo "(note that it may pop up underneath this window, so check for it in the dock too)"
|
||||
echo ""
|
||||
|
||||
xcode-select --install 2>/dev/null
|
||||
|
||||
while true; do
|
||||
sleep 5
|
||||
|
||||
if [ -n "$(git --version 2>/dev/null)" ] && [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "It looks like the other install is finishing up."
|
||||
echo "This installation will begin in one minute."
|
||||
sleep 60
|
||||
else
|
||||
echo "XCode Command Line Tools already installed"
|
||||
fi
|
||||
|
||||
# homebrew
|
||||
if [ -z "$(which brew | grep brew)" ]; then
|
||||
echo "installing brew (homebrew)..."
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew doctor
|
||||
else
|
||||
echo "updating brew..."
|
||||
brew update >/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -z "$(which wget | grep wget)" ]; then
|
||||
echo "installing wget..."
|
||||
brew install wget
|
||||
else
|
||||
echo "wget already installed"
|
||||
fi
|
||||
|
||||
# http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5)
|
||||
if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
|
||||
clear
|
||||
echo ""
|
||||
echo "Your server didn't come with fail2ban preinstalled!!!"
|
||||
echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets."
|
||||
echo ""
|
||||
echo "Since you're obviosly connecting this computer to a network, you should install fail2ban before continuing"
|
||||
echo ""
|
||||
echo "Install fail2ban? [Y/n]"
|
||||
echo "(if unsure, just hit [enter])"
|
||||
read INSTALL_FAIL2BAN
|
||||
if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then
|
||||
clear
|
||||
echo ""
|
||||
echo "I don't think you understand. This is important."
|
||||
echo ""
|
||||
echo "Your server will be under constant attack by botnets via ssh."
|
||||
echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you."
|
||||
echo ""
|
||||
echo "Change your mind?"
|
||||
echo "Ready to install fail2ban? [Y/n]"
|
||||
read INSTALL_FAIL2BAN
|
||||
if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then
|
||||
clear
|
||||
echo "you make me sad :-("
|
||||
sleep 0.5
|
||||
echo "but whatever, it's your funeral..."
|
||||
sleep 1
|
||||
else
|
||||
echo "Phew, dodged the bullet on that one... Installing fail2ban.. :-)"
|
||||
brew install fail2ban
|
||||
sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons
|
||||
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist
|
||||
fi
|
||||
else
|
||||
brew install fail2ban
|
||||
sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons
|
||||
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(which pkg-config | grep pkg-config)" ]; then
|
||||
echo "installing pkg-config..."
|
||||
brew install pkg-config
|
||||
else
|
||||
echo "pkg-config already installed"
|
||||
fi
|
||||
|
||||
# iojs
|
||||
if [ -n "$(which node | grep node 2>/dev/null)" ]; then
|
||||
IOJS_VER=""
|
||||
|
||||
if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then
|
||||
echo "You have node.js installed. Backing up $(which node) as $(which node).joyent"
|
||||
echo "(you can move it back after the install if you want separate node.js and io.js installations)"
|
||||
echo ""
|
||||
echo sudo mv "$(which node)" "$(which node).joyent"
|
||||
sudo mv "$(which node)" "$(which node).joyent"
|
||||
fi
|
||||
|
||||
if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then
|
||||
echo iojs ${IOJS_VER} already installed
|
||||
else
|
||||
clear
|
||||
echo ""
|
||||
echo "HEY, LISTEN:"
|
||||
echo "io.js is already installed as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
echo "installing io.js as iojs ${IOJS_VER}..."
|
||||
curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -o "/tmp/iojs-${IOJS_VER}.pkg"
|
||||
sudo /usr/sbin/installer -pkg "/tmp/iojs-${IOJS_VER}.pkg" -target /
|
||||
sudo chown -R $(whoami) /usr/local 2>/dev/null
|
||||
fi
|
|
@ -1,74 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
|
||||
|
||||
IOJS_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
|
||||
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)" ]
|
||||
then
|
||||
echo "installing git, wget, curl, build-essential, rsync, pkg-config..."
|
||||
sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
#
|
||||
# iojs
|
||||
#
|
||||
if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then
|
||||
# iojs of some version is already installed
|
||||
if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then
|
||||
echo iojs ${IOJS_VER} already installed
|
||||
IOJS_VER=""
|
||||
else
|
||||
echo "HEY, LISTEN:"
|
||||
echo ""
|
||||
echo "io.js is already installed as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
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)"
|
||||
sleep 3
|
||||
sudo mv "$(which node)" "$(which node).$(node -v)"
|
||||
echo "################################################################################"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
if [ -n "$(arch | grep 64)" ]; then
|
||||
ARCH="x64"
|
||||
else
|
||||
ARCH="x86"
|
||||
fi
|
||||
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"
|
||||
pushd /tmp
|
||||
tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz
|
||||
rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md}
|
||||
sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/
|
||||
sudo chown -R $(whoami) /usr/local
|
||||
fi
|
178
setup.bash
178
setup.bash
|
@ -10,24 +10,19 @@
|
|||
# wget -nv https://example.com/setup.bash -O - | bash
|
||||
|
||||
BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master"
|
||||
|
||||
if [ -n "$(which iojs 2>/dev/null || false)" ]; then
|
||||
echo ""
|
||||
echo "HEY, LISTEN:"
|
||||
echo "io.js is already install as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -f "/tmp/IOJS_VER" ]; then
|
||||
IOJS_VER=$(cat /tmp/IOJS_VER | grep v)
|
||||
fi
|
||||
if [ -z "$IOJS_VER" ]; then
|
||||
IOJS_VER="v1.0.1"
|
||||
fi
|
||||
NO_FAIL2BAN=""
|
||||
OS="unsupported"
|
||||
ARCH=""
|
||||
IOJS_VER=""
|
||||
SETUP_FILE=""
|
||||
|
||||
clear
|
||||
|
||||
|
||||
|
||||
#########################
|
||||
# Which OS and version? #
|
||||
#########################
|
||||
|
||||
if [ "$(uname | grep -i 'Darwin')" ]; then
|
||||
OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)"
|
||||
|
@ -81,9 +76,7 @@ if [ "$(uname | grep -i 'Darwin')" ]; then
|
|||
else
|
||||
ARCH="32"
|
||||
fi
|
||||
|
||||
elif [ "$(uname | grep -i 'Linux')" ]; then
|
||||
|
||||
if [ ! -f "/etc/issue" ]; then
|
||||
echo "unsupported linux os"
|
||||
exit 1
|
||||
|
@ -100,40 +93,37 @@ elif [ "$(uname | grep -i 'Linux')" ]; then
|
|||
elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then
|
||||
OS='fedora'
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "unsupported unknown os (non-mac, non-linux)"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
case "${OS}" in
|
||||
fedora)
|
||||
echo "sudo yum"
|
||||
echo "wget --quiet ${BASE_URL}/setup-fedora.bash -O /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
echo "FEDORA not yet supported (feel free to pull request)"
|
||||
exit 1
|
||||
;;
|
||||
ubuntu)
|
||||
wget --quiet "${BASE_URL}/setup-ubuntu.bash" -O /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
SETUP_FILE="ubuntu"
|
||||
;;
|
||||
yosemite)
|
||||
# mavericks
|
||||
curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
SETUP_FILE="mavericks"
|
||||
;;
|
||||
mavericks)
|
||||
curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
SETUP_FILE="mavericks"
|
||||
;;
|
||||
mountain)
|
||||
echo "wget cltools"
|
||||
echo "curl --silent ${BASE_URL}/setup-mountain.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
echo "Mountain Lion not yet supported (feel free to pull request)"
|
||||
exit 1
|
||||
;;
|
||||
lion)
|
||||
echo "wget cltools"
|
||||
echo "curl --silent ${BASE_URL}/setup-lion.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
echo "Lion not yet supported (feel free to pull request)"
|
||||
exit 1
|
||||
;;
|
||||
snow)
|
||||
echo "wget gcc-0.6.pkg"
|
||||
echo "curl --silent ${BASE_URL}/setup-snow.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
echo "Snow Leopard not yet supported (feel free to pull request)"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "unsupported unknown os ${OS}"
|
||||
|
@ -141,8 +131,132 @@ case "${OS}" in
|
|||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
|
||||
#######################
|
||||
# Download installers #
|
||||
#######################
|
||||
|
||||
echo "${OS}" "${ARCH}"
|
||||
|
||||
if [ -n "$(which curl)" ]; then
|
||||
curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \
|
||||
-o /tmp/install-iojs-deps.bash || echo 'error downloading os setup script'
|
||||
curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \
|
||||
-o /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
elif [ -n "$(which wget)" ]; then
|
||||
wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \
|
||||
-O /tmp/install-iojs-deps.bash || echo 'error downloading os setup script'
|
||||
wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \
|
||||
-O /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
else
|
||||
echo "Found neither 'curl' nor 'wget'. Can't Continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
################
|
||||
# DEPENDENCIES #
|
||||
################
|
||||
|
||||
if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
|
||||
echo ""
|
||||
echo "Your server didn't come with fail2ban preinstalled!!!"
|
||||
echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets."
|
||||
echo ""
|
||||
echo "Since you're obviosly connecting this computer to a network, you should install fail2ban before continuing"
|
||||
echo ""
|
||||
echo "Install fail2ban? [Y/n]"
|
||||
echo "(if unsure, just hit [enter])"
|
||||
read INSTALL_FAIL2BAN
|
||||
|
||||
if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then
|
||||
echo ""
|
||||
echo "I don't think you understand: This is important."
|
||||
echo ""
|
||||
echo "Your server will be under constant attack by botnets via ssh."
|
||||
echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you."
|
||||
echo ""
|
||||
echo "Change your mind?"
|
||||
echo "Ready to install fail2ban? [Y/n]"
|
||||
read INSTALL_FAIL2BAN
|
||||
if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then
|
||||
clear
|
||||
echo "you make me sad :-("
|
||||
sleep 0.5
|
||||
echo "but whatever, it's your funeral..."
|
||||
sleep 1
|
||||
NO_FAIL2BAN="nope"
|
||||
else
|
||||
echo "Phew, dodged the bullet on that one... Will install fail2ban.. :-)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
bash /tmp/install-iojs-deps.bash "${NO_FAIL2BAN}"
|
||||
|
||||
#########################
|
||||
# Which io.js VERSION ? #
|
||||
#########################
|
||||
|
||||
if [ -f "/tmp/IOJS_VER" ]; then
|
||||
IOJS_VER=$(cat /tmp/IOJS_VER | grep v)
|
||||
fi
|
||||
|
||||
if [ -z "$IOJS_VER" ]; then
|
||||
IOJS_VER="v1.0.1"
|
||||
fi
|
||||
|
||||
if [ -n "$(which iojs 2>/dev/null || false)" ]; then
|
||||
echo ""
|
||||
echo "HEY, LISTEN:"
|
||||
echo "io.js is already install as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run:"
|
||||
echo "sudo mv '$(which iojs)' '$(which iojs).$(iojs -v)'"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
#
|
||||
# iojs
|
||||
#
|
||||
if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then
|
||||
# iojs of some version is already installed
|
||||
if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then
|
||||
echo iojs ${IOJS_VER} already installed
|
||||
else
|
||||
echo "HEY, LISTEN:"
|
||||
echo ""
|
||||
echo "io.js is already installed as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
IOJS_VER=""
|
||||
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)"
|
||||
sleep 3
|
||||
sudo mv "$(which node)" "$(which node).$(node -v)"
|
||||
echo "################################################################################"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
bash /tmp/install-iojs.bash "${IOJS_VER}"
|
||||
fi
|
||||
|
||||
# jshint
|
||||
if [ -z "$(which jshint | grep jshint)" ]; then
|
||||
|
|
Loading…
Reference in New Issue