1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

install script cleanup

This commit is contained in:
checktheroads
2020-02-24 07:59:15 -07:00
parent 78abce66b9
commit baebf66eb4

View File

@@ -16,7 +16,6 @@ BREW_UPDATE="brew update"
INSTALL_MAP=(["apt"]="$APT_INSTALL" ["yum"]="$YUM_INSTALL" ["brew"]="$BREW_INSTALL") INSTALL_MAP=(["apt"]="$APT_INSTALL" ["yum"]="$YUM_INSTALL" ["brew"]="$BREW_INSTALL")
UPDATE_MAP=(["apt"]="$APT_UPDATE" ["yum"]="$YUM_UPDATE" ["brew"]="$BREW_UPDATE") UPDATE_MAP=(["apt"]="$APT_UPDATE" ["yum"]="$YUM_UPDATE" ["brew"]="$BREW_UPDATE")
APP_TARGET="git+https://github.com/checktheroads/hyperglass.git@v1.0.0"
INSTALLER="" INSTALLER=""
NEEDS_UPDATE="0" NEEDS_UPDATE="0"
NEEDS_PYTHON="1" NEEDS_PYTHON="1"
@@ -41,8 +40,8 @@ clean_temp () {
} }
catch_interrupt () { catch_interrupt () {
kill $PID echo "Stopping..."
exit exit 1
} }
semver () { semver () {
@@ -174,7 +173,7 @@ python_post () {
echo "[ERROR] Tried to install Python 3, but post-install check failed." echo "[ERROR] Tried to install Python 3, but post-install check failed."
fi fi
else else
echo "[ERROR] Tried to install Python 3, but encountered an error. Consult the Python 3 installation instructions for your system." echo '[ERROR] Tried to install Python 3, but encountered an error. Consult the Python 3 installation instructions for your system.'
fi fi
} }
@@ -187,7 +186,7 @@ node_post () {
echo "[ERROR] Tried to install NodeJS, but post-install check failed." echo "[ERROR] Tried to install NodeJS, but post-install check failed."
fi fi
else else
echo "[ERROR] Tried to install NodeJS, but encountered an error. Try running `${INSTALL_MAP[$INSTALLER]} nodejs` to investigate." echo '[ERROR] Tried to install NodeJS, but encountered an error.'
fi fi
} }
@@ -200,7 +199,7 @@ yarn_post () {
echo "[ERROR] Tried to install Yarn, but post-install check failed." echo "[ERROR] Tried to install Yarn, but post-install check failed."
fi fi
else else
echo "[ERROR] Tried to install Yarn, but encountered an error. Try running `${INSTALL_MAP[$INSTALLER]} yarn` to investigate." echo '[ERROR] Tried to install Yarn, but encountered an error.'
fi fi
} }
@@ -213,7 +212,7 @@ redis_post () {
echo "[ERROR] Tried to install Redis, but post-install check failed." echo "[ERROR] Tried to install Redis, but post-install check failed."
fi fi
else else
echo "[ERROR] Tried to install Redis, but encountered an error. Try running `${INSTALL_MAP[$INSTALLER]} $redis_name` to investigate." echo '[ERROR] Tried to install Redis, but encountered an error.'
fi fi
} }
@@ -247,62 +246,79 @@ yarn_yum_prepare () {
node_apt () { node_apt () {
apt-get install -y nodejs apt-get install -y nodejs
sleep 1
node_post $? node_post $?
} }
node_yum () { node_yum () {
yum -y install gcc-c++ make nodejs yum -y install gcc-c++ make nodejs
sleep 1
node_post $? node_post $?
} }
node_brew () { node_brew () {
brew install node brew install node
sleep 1
node_post $? node_post $?
} }
yarn_apt () { yarn_apt () {
apt-get install -y yarn apt-get install -y yarn
sleep 1
yarn_post $? yarn_post $?
} }
yarn_yum () { yarn_yum () {
yum -y install gcc-c++ make yarn yum -y install gcc-c++ make yarn
sleep 1
yarn_post $? yarn_post $?
} }
yarn_brew () { yarn_brew () {
brew install yarn brew install yarn
sleep 1
yarn_post $? yarn_post $?
} }
python_apt () { python_apt () {
apt-get install -y python3.6-dev python3-pip apt-get install -y python3.6-dev python3-pip > /dev/null
sleep 1
# curl -sSL http://mirrors.kernel.org/ubuntu/pool/main/p/python3.6/python3.6_3.6.9-1~18.04_amd64.deb -o /tmp/python3.deb
# curl -sSL http://mirrors.kernel.org/ubuntu/pool/universe/p/python-pip/python3-pip_9.0.1-2_all.deb -o /tmp/pip3.deb
# apt-get install -y /tmp/python3.deb
# apt-get install -y /tmp/pip3.deb
# source $HOME/.profile
python_post $? python_post $?
} }
python_yum () { python_yum () {
yum install centos-release-scl yum install centos-release-scl
yum install rh-python36 yum install rh-python36
sleep 1
python_post $? python_post $?
} }
python_brew () { python_brew () {
brew install python3 brew install python3
sleep 1
python_post $? python_post $?
} }
redis_apt () { redis_apt () {
apt-get install -y redis-server apt-get install -y redis-server
sleep 1
redis_post $? redis_post $?
} }
redis_yum () { redis_yum () {
yum -y install redis yum -y install redis
sleep 1
redis_post $? redis_post $?
} }
redis_brew () { redis_brew () {
brew install redis brew install redis
sleep 1
redis_post $? redis_post $?
} }
@@ -402,7 +418,19 @@ install_redis () {
install_app () { install_app () {
echo "[INFO] Installing hyperglass..." echo "[INFO] Installing hyperglass..."
pip3 install $APP_TARGET
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -o /tmp/get-poetry.py
python3 /tmp/get-poetry.py -f -y
sleep 1
source $HOME/.profile
git clone --branch v1.0.0 --depth 1 https://github.com/checktheroads/hyperglass.git /tmp/hyperglass
cd /tmp/hyperglass
poetry build
mkdir /tmp/build
tar -xvf /tmp/hyperglass/dist/hyperglass-1.0.0.tar.gz -C /tmp/build
cd /tmp/build/hyperglass-1.0.0
pip3 install .
if [[ ! $? == 0 ]]; then if [[ ! $? == 0 ]]; then
echo "[ERROR] An error occurred while trying to install hyperglass." echo "[ERROR] An error occurred while trying to install hyperglass."
@@ -416,6 +444,7 @@ install_app () {
exit 1 exit 1
fi fi
fi fi
rm -rf /tmp/build
} }
trap catch_interrupt SIGINT trap catch_interrupt SIGINT