Created
November 18, 2020 20:18
-
-
Save ericlancebrown/e13381be93390f2b137ed514326f76a4 to your computer and use it in GitHub Desktop.
Ubuntu 20.04 installation bash shell file for building and installing lscli, its dependencies and all other prerequisites.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script: lscli Installation Script | |
# OS: Ubuntu 20.04 | |
# Updated: 11.18.20 | |
# Author: Eric Brown | |
#################################################### | |
# Usage: | |
# chmod u+x lscli_ubuntu-2004.sh | |
# ./lscli_ubuntu-2004.sh | |
#################################################### | |
# Setup | |
cd ~ | |
echo -e '\e[1;33m> Checking if Lupin software directory exists.\e[0m' | |
if [ ! -d Lupin ]; then | |
echo -e '\e[1;33m> Creating Lupin software directory.\e[0m' | |
mkdir -p Lupin && cd Lupin | |
else | |
echo -e '\e[1;31m> Lupin software directory already exists.\e[0m' | |
echo -e '\e[1;31m> Would you like to remove and reinstall the Lupin software directory?\e[0m [y/n]' | |
read yn | |
if [[ $yn == y* ]]; then | |
echo -e '\e[1;33m> User selected to reinstall. Removing Lupin software directory and reinstalling.\e[0m' | |
sudo rm -rf Lupin | |
mkdir -p Lupin && cd Lupin | |
else | |
echo -e '\e[1;31m> User selected not to reinstall. Exiting.\e[0m' | |
exit 1 | |
fi | |
fi | |
# Update System -- Install Prerequisites | |
echo -e '\e[1;33m> Updating system.\e[0m' | |
sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y | |
echo -e '\e[1;33m> Installing Lupin prerequisites.\e[0m' | |
sudo apt install -y curl unzip tar cmake gcc g++ pkg-config libudev-dev scons build-essential libssl-dev binutils-dev libiberty-dev libmariadb-dev-compat libleveldb-dev libsnappy-dev git libboost-all-dev qt5-default libqt5websockets5-dev libqt5opengl5-dev libnode-dev | |
pkgs='curl unzip tar cmake gcc g++ pkg-config libudev-dev scons build-essential libssl-dev binutils-dev libiberty-dev libmariadb-dev-compat libleveldb-dev libsnappy-dev git libboost-all-dev qt5-default libqt5websockets5-dev libqt5opengl5-dev libnode-dev' | |
if ! dpkg -s $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of prerequisites failed. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of prerequisites successful.\e[0m' | |
fi | |
# GTest / GMock | |
echo -e '\e[1;33m> Building GTest and GMock.\e[0m' | |
git clone https://github.com/google/googletest.git | |
cd googletest | |
mkdir build && cd build | |
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DBUILD_GMOCK=ON -DINSTALL_GTEST=ON .. | |
make | |
echo -e '\e[1;33m> Installing GTest and GMock.\e[0m' | |
sudo make install | |
sudo ldconfig | |
cd .. | |
cd .. | |
echo -e '\e[1;33m> Checking for GTest.\e[0m' | |
pkgs='gtest' | |
if ! ldconfig -p | grep $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of GTest failed. Cannot find library directory. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of GTest successful.\e[0m' | |
fi | |
echo -e '\e[1;33m> Checking for GMock.\e[0m' | |
pkgs='gmock' | |
if ! ldconfig -p | grep $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of GMock failed. Cannot find library directory. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of GMock successful.\e[0m' | |
fi | |
# ZeroMQ | |
echo -e '\e[1;33m> Building ZeroMQ.\e[0m' | |
git clone https://github.com/zeromq/libzmq.git | |
cd libzmq | |
./autogen.sh | |
./configure | |
make | |
echo -e '\e[1;33m> Installing ZeroMQ.\e[0m' | |
sudo make install | |
sudo ldconfig | |
cd .. | |
echo -e '\e[1;33m> Checking for ZeroMQ.\e[0m' | |
pkgs='zmq' | |
if ! ldconfig -p | grep $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of ZeroMQ failed. Cannot find library directory. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of ZeroMQ successful.\e[0m' | |
fi | |
# libusbp | |
echo -e '\e[1;33m> Building libusbp.\e[0m' | |
git clone https://github.com/pololu/libusbp.git | |
cd libusbp | |
mkdir build && cd build | |
cmake .. | |
make | |
echo -e '\e[1;33m> Installing libusbp.\e[0m' | |
sudo make install | |
sudo ldconfig | |
cd .. | |
cd .. | |
echo -e '\e[1;33m> Checking for libusbp.\e[0m' | |
pkgs='libusbp' | |
if ! ldconfig -p | grep $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of libusbp failed. Cannot find library directory. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of libusbp successful.\e[0m' | |
fi | |
# libsubtractive | |
echo -e '\e[1;33m> Building libsubtractive.\e[0m' | |
git clone https://github.com/Lupin-CNC/libsubtractive.git | |
cd libsubtractive | |
mkdir build && cd build | |
cmake .. | |
make | |
echo -e '\e[1;33m> Installing libsubtractive.\e[0m' | |
sudo make install | |
sudo ldconfig | |
cd .. | |
cd .. | |
echo -e '\e[1;33m> Checking for libsubtractive.\e[0m' | |
pkgs='libsubtractive' | |
if ! ldconfig -p | grep $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of libsubtractive failed. Cannot find library directory. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of libsubtractive successful.\e[0m' | |
fi | |
# lscli | |
echo -e '\e[1;33m> Building lscli.\e[0m' | |
git clone https://github.com/Lupin-CNC/lscli.git | |
cd lscli | |
mkdir build && cd build | |
cmake .. | |
make | |
echo -e '\e[1;33m> Checking for lscli.\e[0m' | |
pkgs='lscli' | |
if ! ls $pkgs >/dev/null 2>&1; then | |
echo -e '\e[1;31m> [ERROR] Installation of lscli failed. Cannot find executable. Exiting.\e[0m' | |
exit 1 | |
else | |
echo -e '\e[1;32m> [SUCCESS] Installation of lscli successful.\e[0m' | |
fi | |
echo -e '\e[1;32m> [COMPLETE] Installation of lscli and dependencies complete.\e[0m' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment