updated readability

This commit is contained in:
Ben Fogt 2018-12-17 19:08:01 -06:00
parent 81d6fd15f6
commit 611c016dd1

View File

@ -12,49 +12,39 @@
# ambed logs are part of /var/log/messages # ambed logs are part of /var/log/messages
#Lets begin------------------------------------------------------------------------------------------------- #Lets begin-------------------------------------------------------------------------------------------------
WHO=$(whoami) WHO=$(whoami)
#Have to be ROOT to run this script
if [ "$WHO" != "root" ]; if [ "$WHO" != "root" ];
then then
echo "" echo ""
echo "You Must be root to run this script!!" echo "You Must be root to run this script!!"
exit 0 exit 0
fi fi
#Has to be a Debian variant.
if [ ! -e "/etc/debian_version" ] if [ ! -e "/etc/debian_version" ]
then then
echo "" echo ""
echo "This script is only tested in Debian 8,9 and x64 cpu Arch. for now." echo "This script is only tested in Debian 8,9 and x64 cpu Arch. for now."
exit 0 exit 0
fi fi
#Gather variables
DIRDIR=$(pwd) DIRDIR=$(pwd)
LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}') LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
ARC=$(lscpu | grep Arch | awk '{print $2}') ARC=$(lscpu | grep Arch | awk '{print $2}')
X64=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-x86_64-1.4.6.tgz X64=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-x86_64-1.4.6.tgz
X32=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-i386-1.4.6.tgz X32=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-i386-1.4.6.tgz
#ARM=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-arm-v7-hf-1.4.8.gz AMBINSTDIR=/root/reflector-install-files/ambed
DEP="wget git build-essential"
#Install dependencies GITREPO=https://github.com/LX3JL/xlxd.git
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "Installing required software..." echo " Installing required software..."
apt-get -y install wget echo "------------------------------------------------------------------------------"
apt-get -y install git apt-get -y install $DEP
apt-get -y install screen
#XLX Specific
apt-get -y install build-essential
#Make Directories and get the FTDI driver.
mkdir -p /ambed mkdir -p /ambed
mkdir -p /root/reflector-install-files/ambed mkdir -p $AMBINSTDIR
if [ ! -e /usr/local/lib/libftd2xx.so ] if [ ! -e /usr/local/lib/libftd2xx.so ]
then then
echo "" echo ""
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "Downloading driver and installing it....." echo "Downloading and installing FTDI driver...."
cd /root/reflector-install-files/ambed echo "------------------------------------------------------------------------------"
cd $AMBINSTDIR
if [ "$ARC" = "x86_64" ] if [ "$ARC" = "x86_64" ]
then then
wget $X64 wget $X64
@ -75,41 +65,45 @@ else
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "It looks like the driver is already installed. If this is wrong, see what '/usr/local/lib/libftd2xx.so' is up to. Skipping FTDI Driver install. " echo "It looks like the driver is already installed. If this is wrong, see what '/usr/local/lib/libftd2xx.so' is up to. Skipping FTDI Driver install. "
fi fi
#Time to get the xlx/ambe software from git
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "Getting xlx/ambed from github..." echo "Downloading and installing AMBED..."
cd /root/reflector-install-files/ambed
git clone https://github.com/LX3JL/xlxd.git
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "Installing ambed....." cd $AMBINSTDIR
cd /root/reflector-install-files/ambed/xlxd/ambed/ git clone $GITREPO
cd $AMBINSTDIR/xlxd/ambed/
make clean make clean
make make
make install make install
if [ -e ambed ] if [ -e ambed ]
then then
echo "------------------------------------------------------------------------------"
echo "It looks like everything compiled successfully. There is an 'ambed' application file. " echo "It looks like everything compiled successfully. There is an 'ambed' application file. "
echo "------------------------------------------------------------------------------"
else else
echo "/ambe directory exists already, I dont need to add it." echo "------------------------------------------------------------------------------"
echo "I dont see an AMBED file after compiling. Look at the errors above and try again. Exiting....."
echo "------------------------------------------------------------------------------"
exit 0 exit 0
fi fi
echo ""
echo ""
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
echo "Copying ambed files and systemd files... " echo "Copying ambed files and systemd files... "
echo "------------------------------------------------------------------------------"
cp ambed /ambed cp ambed /ambed
cp $DIRDIR/templates/ambed.service /etc/systemd/system/ cp $DIRDIR/templates/ambed.service /etc/systemd/system/
sed -i "s/LOCAL-IP/$LOCAL_IP/g" /etc/systemd/system/ambed.service sed -i "s/LOCAL-IP/$LOCAL_IP/g" /etc/systemd/system/ambed.service
systemctl daemon-reload systemctl daemon-reload
#That should be it for the install.
echo "" echo ""
echo "" echo ""
echo "************************************************************************" echo "************************************************************************"
echo "" echo ""
echo "" echo ""
echo " The install is complete. " echo " The install is complete. "
echo " Now reboot the server. " echo " ******* Now reboot the server. ******* "
echo " Use 'systemctl status ambed' to check the status. " echo " Use 'systemctl status ambed' to check the status. "
echo " ambed logs are part of /var/log/messages. " echo " ambed logs are part of /var/log/messages. "
echo " Just make sure this computer can be accessed over UDP 10100 "
echo "" echo ""
echo "" echo ""
echo "************************************************************************" echo "************************************************************************"