2018-11-25 21:03:46 -05:00
#!/bin/bash
2022-01-10 10:04:13 -05:00
# Version 2.1.1 Edited by M0VUB
# A tool to install AMBE server with Debian / Ubuntu support.
# This is essentially a scripted version of:
# https://github.com/LX3JL/xlxd/blob/master/ambed/readme
# Step 1: Install Debian 9 10 or 11 or Ubuntu 20.04 onwards.. and make sure it has internet and is up to date.
# Step 2: Plug AMBE Chip(s) into computer or Raspi-pi.
# Step 3: Run this script on the computer with the ambe chips pluged in.
# Step 4: Reboot after installation.
2018-11-25 21:03:46 -05:00
# systemctl status ambed #to show the status
# systemctl stop ambed #to stop ambed
# systemctl start ambed #to start ambed
# ambed logs are part of /var/log/messages
#Lets begin-------------------------------------------------------------------------------------------------
2022-01-05 15:26:42 -05:00
if [ "$EUID" -ne 0 ];
2018-11-25 21:03:46 -05:00
then
echo ""
echo "You Must be root to run this script!!"
2022-01-05 15:25:07 -05:00
exit 1
2018-11-25 21:03:46 -05:00
fi
if [ ! -e "/etc/debian_version" ]
then
echo ""
2022-01-05 17:19:52 -05:00
echo "This script is only tested in Debian 9,10 & 11 repo only."
2018-11-25 21:03:46 -05:00
exit 0
fi
DIRDIR=$(pwd)
LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
ARC=$(lscpu | grep Arch | awk '{print $2}')
2022-10-06 20:55:57 -04:00
X64=https://ftdichip.com/wp-content/uploads/2022/07/libftd2xx-x86_64-1.4.27.tgz
X32=https://ftdichip.com/wp-content/uploads/2022/07/libftd2xx-x86_32-1.4.27.tgz
ARMv7=https://ftdichip.com/wp-content/uploads/2022/07/libftd2xx-arm-v7-hf-1.4.27.tgz
ARMv8=https://ftdichip.com/wp-content/uploads/2022/07/libftd2xx-arm-v8-1.4.27.tgz
2018-12-17 20:08:01 -05:00
AMBINSTDIR=/root/reflector-install-files/ambed
2022-01-05 17:19:52 -05:00
DEP="wget git build-essential g++ figlet nano"
2018-12-17 20:08:01 -05:00
GITREPO=https://github.com/LX3JL/xlxd.git
2018-11-25 21:03:46 -05:00
echo "------------------------------------------------------------------------------"
2018-12-17 20:08:01 -05:00
echo " Installing required software..."
echo "------------------------------------------------------------------------------"
2022-01-05 17:19:52 -05:00
apt-get install -y $DEP
2018-11-25 21:03:46 -05:00
mkdir -p /ambed
2018-12-17 20:08:01 -05:00
mkdir -p $AMBINSTDIR
2018-11-25 21:03:46 -05:00
if [ ! -e /usr/local/lib/libftd2xx.so ]
then
echo ""
echo "------------------------------------------------------------------------------"
2022-01-05 15:25:07 -05:00
echo "Downloading and installing latest FTDI drivers...."
2018-12-17 20:08:01 -05:00
echo "------------------------------------------------------------------------------"
cd $AMBINSTDIR
2021-01-16 23:02:00 -05:00
if [ "$ARC" = "x86_64" ];
2018-11-25 21:03:46 -05:00
then
wget $X64
2022-10-06 20:55:57 -04:00
tar -xvf lib*
2018-11-25 21:03:46 -05:00
cd release/build
2022-10-06 20:55:57 -04:00
cp lib* /usr/local/lib
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.27
ln -sf /usr/local/lib/libftd2xx.so.1.4.27 /usr/local/lib/libftd2xx.so
2022-01-11 13:53:25 -05:00
elif [ "$ARC" = "armv7l" ];
2021-01-16 22:11:02 -05:00
then
2022-01-05 15:25:07 -05:00
wget $ARMv7
2022-10-06 20:55:57 -04:00
tar zxf libftd2xx-arm-v7-hf-1.4.27.tgz
2021-01-16 22:11:02 -05:00
cd release/build
cp libftd2xx.* /usr/local/lib
2022-10-06 20:55:57 -04:00
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.27
ln -sf /usr/local/lib/libftd2xx.so.1.4.27 /usr/local/lib/libftd2xx.so
2022-01-05 15:25:07 -05:00
elif [ "$ARC" = "aarch64" ];
then
wget $ARMv8
2022-10-06 20:55:57 -04:00
tar zxf libftd2xx-arm-v8-1.4.27.tgz
2022-01-05 15:25:07 -05:00
cd release/build
cp libftd2xx.* /usr/local/lib
2022-10-06 20:55:57 -04:00
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.27
2022-01-05 15:25:07 -05:00
ln -sf /usr/local/lib/libftd2xx.so.1.4.24 /usr/local/lib/libftd2xx.so
2021-01-16 23:02:00 -05:00
elif [ "$ARC" = "i686" ];
2021-01-16 22:11:02 -05:00
then
2018-11-25 21:03:46 -05:00
wget $X32
2022-10-06 20:55:57 -04:00
tar xfvz libftd2xx-i386-1.4.27.tgz
2018-11-25 21:03:46 -05:00
cd release/build
cp libftd2xx.* /usr/local/lib
2022-10-06 20:55:57 -04:00
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.27
ln -sf /usr/local/lib/libftd2xx.so.1.4.27 /usr/local/lib/libftd2xx.so
2018-11-25 21:03:46 -05:00
fi
else
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. "
fi
echo "------------------------------------------------------------------------------"
2022-01-05 17:19:52 -05:00
echo "Downloading and installing AMBEd..."
2018-11-25 21:03:46 -05:00
echo "------------------------------------------------------------------------------"
2018-12-17 20:08:01 -05:00
cd $AMBINSTDIR
git clone $GITREPO
cd $AMBINSTDIR/xlxd/ambed/
2022-01-04 11:16:29 -05:00
sleep 5
echo "------------------------------------------------------------------------------"
echo "Edit your configuration..."
echo "------------------------------------------------------------------------------"
sleep 5
echo "If unsure about this feature then just hit 'CTRL-X'."
sleep 3
nano main.h
2018-11-25 21:03:46 -05:00
make clean
make
make install
if [ -e ambed ]
then
2018-12-17 20:08:01 -05:00
echo "------------------------------------------------------------------------------"
2022-01-05 17:19:52 -05:00
echo "It looks like everything compiled successfully. There is an 'AMBEd' application file. "
2018-12-17 20:08:01 -05:00
echo "------------------------------------------------------------------------------"
2018-11-25 21:03:46 -05:00
else
2018-12-17 20:08:01 -05:00
echo "------------------------------------------------------------------------------"
2022-01-04 10:45:38 -05:00
echo "I dont see an AMBEd file after compiling. Look at the errors above and try again. Exiting....."
2018-12-17 20:08:01 -05:00
echo "------------------------------------------------------------------------------"
2018-11-25 21:03:46 -05:00
exit 0
fi
2018-12-17 20:08:01 -05:00
echo ""
echo ""
2018-11-25 21:03:46 -05:00
echo "------------------------------------------------------------------------------"
2022-01-05 17:19:52 -05:00
echo "Copying AMBEd files and systemd files... "
2018-12-17 20:08:01 -05:00
echo "------------------------------------------------------------------------------"
2018-11-25 21:03:46 -05:00
cp ambed /ambed
cp $DIRDIR/templates/ambed.service /etc/systemd/system/
sed -i "s/LOCAL-IP/$LOCAL_IP/g" /etc/systemd/system/ambed.service
systemctl daemon-reload
2022-01-04 10:55:57 -05:00
sleep 2
clear
sleep 2
2022-01-04 17:19:28 -05:00
echo "Enabling AMBEd Server....."
2021-04-07 20:11:32 -04:00
systemctl enable ambed
2022-01-04 10:55:57 -05:00
figlet "AMBEd"
sleep 3
2018-11-25 21:03:46 -05:00
echo ""
echo ""
echo "************************************************************************"
echo ""
2022-01-04 17:19:28 -05:00
echo " The AMBEd Installation Is Complete! "
2018-11-25 21:03:46 -05:00
echo ""
2018-12-17 20:08:01 -05:00
echo " ******* Now reboot the server. ******* "
2018-11-25 21:03:46 -05:00
echo " Use 'systemctl status ambed' to check the status. "
echo " ambed logs are part of /var/log/messages. "
2022-01-04 17:19:28 -05:00
echo " Just make sure this computer can be accessed over UDP 10100 "
2018-11-25 21:03:46 -05:00
echo ""
echo ""
echo "************************************************************************"