mirror of
https://github.com/ShaYmez/ambed-debian-installer.git
synced 2024-11-21 15:41:48 -05:00
added systemc unit file and cleaned script up
This commit is contained in:
parent
f154492fc2
commit
b739e984ee
@ -1,128 +1,115 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#A tool to install AMBE server.
|
#A tool to install AMBE server.
|
||||||
#This is essentially a scripted version of:
|
#This is essentially a scripted version of:
|
||||||
#https://github.com/LX3JL/xlxd/blob/master/ambed/readme
|
#https://github.com/LX3JL/xlxd/blob/master/ambed/readme
|
||||||
#Step 1: Install Debian 8 or 9 and make sure it has internet and is up to date.
|
#Step 1: Install Debian 9.x and make sure it has internet and is up to date.
|
||||||
#Step 2: Plug AMBE Chip(s) into computer.
|
#Step 2: Plug AMBE Chip(s) into computer.
|
||||||
#Step 3: Run this script on the computer with the ambe chips.
|
#Step 3: Run this script on the computer with the ambe chips.
|
||||||
#Step 4: Reboot
|
#Step 4: Reboot after installation.
|
||||||
#Step 5: Execute /ambed/run
|
# systemctl status ambed #to show the status
|
||||||
#"To start your AMBE server manually, start a screen session. Just type 'screen' "
|
# systemctl stop ambed #to stop ambed
|
||||||
#"cd /ambe "
|
# systemctl start ambed #to start ambed
|
||||||
#"./run "
|
# ambed logs are part of /var/log/messages
|
||||||
#"Leave screen session running"
|
#Lets begin-------------------------------------------------------------------------------------------------
|
||||||
#
|
WHO=$(whoami)
|
||||||
#"To stop AMBE...."
|
#Have to be ROOT to run this script
|
||||||
#"ps aux | grep ambe"
|
if [ "$WHO" != "root" ];
|
||||||
#"kill <THE PID #>,Thats the official step for now"
|
then
|
||||||
|
echo ""
|
||||||
#Lets begin-------------------------------------------------------------------------------------------------
|
echo "You Must be root to run this script!!"
|
||||||
WHO=$(whoami)
|
exit 0
|
||||||
#Have to be ROOT to run this script
|
fi
|
||||||
if [ "$WHO" != "root" ];
|
|
||||||
then
|
#Has to be a Debian variant.
|
||||||
echo ""
|
if [ ! -e "/etc/debian_version" ]
|
||||||
echo "You Must be root to run this script!!"
|
then
|
||||||
exit 0
|
echo ""
|
||||||
fi
|
echo "This script is only tested in Debian 8,9 and x64 cpu Arch. for now."
|
||||||
|
exit 0
|
||||||
#Has to be a Debian variant.
|
fi
|
||||||
if [ ! -e "/etc/debian_version" ]
|
|
||||||
then
|
#Gather variables
|
||||||
echo ""
|
DIRDIR=$(pwd)
|
||||||
echo "This script is only tested in Debian 8,9 and x64 cpu Arch. for now."
|
LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
|
||||||
#echo "This script is only tested in Debian 8,9 and Raspian Stretch for now."
|
ARC=$(lscpu | grep Arch | awk '{print $2}')
|
||||||
exit 0
|
X64=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-x86_64-1.4.6.tgz
|
||||||
fi
|
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
|
||||||
#Gather variables
|
|
||||||
LOCAL_IP=$(ip a | grep inet | grep "eth0\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
|
#Install dependicies
|
||||||
ARC=$(lscpu | grep Arch | awk '{print $2}')
|
echo "------------------------------------------------------------------------------"
|
||||||
X64=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-x86_64-1.4.6.tgz
|
echo "Installing required software..."
|
||||||
X32=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-i386-1.4.6.tgz
|
apt-get -y install wget
|
||||||
#ARM=http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-arm-v7-hf-1.4.8.gz
|
apt-get -y install git
|
||||||
|
apt-get -y install screen
|
||||||
#Install dependicies
|
|
||||||
echo ""
|
#XLX Specific
|
||||||
echo "Installing required software..."
|
apt-get -y install build-essential
|
||||||
apt-get -y install wget
|
|
||||||
apt-get -y install git
|
#Make Directories and get the FTDI driver.
|
||||||
apt-get -y install screen
|
mkdir -p /ambed
|
||||||
|
mkdir -p /root/reflector-install-files/ambed
|
||||||
#XLX Specific
|
if [ ! -e /usr/local/lib/libftd2xx.so ]
|
||||||
apt-get -y install build-essential
|
then
|
||||||
|
echo ""
|
||||||
#Make Directories and get the FTDI driver.
|
echo "------------------------------------------------------------------------------"
|
||||||
mkdir -p /ambed
|
echo "Downloading driver and installing it....."
|
||||||
mkdir -p /root/ambed-install-files
|
cd /root/reflector-install-files/ambed
|
||||||
if [ ! -e /usr/local/lib/libftd2xx.so ]
|
if [ "$ARC" = "x86_64" ]
|
||||||
then
|
then
|
||||||
echo ""
|
wget $X64
|
||||||
echo "Downloading driver and installing it....."
|
tar xfvz libftd2xx-x86_64-1.4.6.tgz
|
||||||
cd /root/ambed-install-files
|
cd release/build
|
||||||
if [ "$ARC" = "x86_64" ]
|
cp libftd2xx.* /usr/local/lib
|
||||||
then
|
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.6
|
||||||
wget $X64
|
ln -sf /usr/local/lib/libftd2xx.so.1.4.6 /usr/local/lib/libftd2xx.so
|
||||||
tar xfvz libftd2xx-x86_64-1.4.6.tgz
|
else
|
||||||
cd release/build
|
wget $X32
|
||||||
cp libftd2xx.* /usr/local/lib
|
tar xfvz libftd2xx-i386-1.4.6.tgz
|
||||||
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.6
|
cd release/build
|
||||||
ln -sf /usr/local/lib/libftd2xx.so.1.4.6 /usr/local/lib/libftd2xx.so
|
cp libftd2xx.* /usr/local/lib
|
||||||
else
|
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.6
|
||||||
wget $X32
|
ln -sf /usr/local/lib/libftd2xx.so.1.4.6 /usr/local/lib/libftd2xx.so
|
||||||
tar xfvz libftd2xx-i386-1.4.6.tgz
|
fi
|
||||||
cd release/build
|
else
|
||||||
cp libftd2xx.* /usr/local/lib
|
echo "------------------------------------------------------------------------------"
|
||||||
chmod 0755 /usr/local/lib/libftd2xx.so.1.4.6
|
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. "
|
||||||
ln -sf /usr/local/lib/libftd2xx.so.1.4.6 /usr/local/lib/libftd2xx.so
|
fi
|
||||||
fi
|
|
||||||
else
|
#Time to get the xlx/ambe software from git
|
||||||
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 "Getting xlx/ambed from github..."
|
||||||
fi
|
cd /root/reflector-install-files/ambed
|
||||||
|
git clone https://github.com/LX3JL/xlxd.git
|
||||||
#Time to get the xlx/ambe software from git
|
echo "------------------------------------------------------------------------------"
|
||||||
echo ""
|
echo "Installing ambed....."
|
||||||
echo "Getting xlx/ambed from github..."
|
cd /root/reflector-install-files/ambed/xlxd/ambed/
|
||||||
cd /root/ambed-install-files
|
make clean
|
||||||
git clone https://github.com/LX3JL/xlxd.git
|
make
|
||||||
echo ""
|
make install
|
||||||
echo "Installing ambed....."
|
if [ -e ambed ]
|
||||||
cd xlxd/ambed/
|
then
|
||||||
make clean
|
echo "It looks like everything compiled successfully. There is an 'ambed' application file. "
|
||||||
make
|
else
|
||||||
make install
|
echo "/ambe directory exists already, I dont need to add it."
|
||||||
if [ -e ambed ]
|
exit 0
|
||||||
then
|
fi
|
||||||
echo "It looks like everything compiled successfully. There is an 'ambed' application file. "
|
echo "------------------------------------------------------------------------------"
|
||||||
else
|
echo "Copying ambed files and systemd files... "
|
||||||
echo "/ambe directory exists already, I dont need to add it."
|
cp ambed /ambed
|
||||||
exit 0
|
cp $DIRDIR/templates/ambed.service /etc/systemd/system/
|
||||||
fi
|
sed -i "s/LOCAL-IP/$LOCAL_IP/g" /etc/systemd/system/ambed.service
|
||||||
cp ambed /ambed
|
systemctl daemon-reload
|
||||||
cp run /ambed
|
#That should be it for the install.
|
||||||
chmod 755 /ambed/run
|
echo ""
|
||||||
sed -i "s/127.0.0.1/$LOCAL_IP/g" /ambed/run
|
echo ""
|
||||||
sed -i "s/sudo//g" /ambed/run
|
echo "************************************************************************"
|
||||||
|
echo ""
|
||||||
#That should be it for the install.
|
echo ""
|
||||||
echo "************************************************************************"
|
echo " The install is complete. "
|
||||||
echo ""
|
echo " Now reboot the server. "
|
||||||
echo ""
|
echo " Use 'systemctl status ambed' to check the status. "
|
||||||
echo "To start your AMBE Server, start a screen session. Just type 'screen' "
|
echo " ambed logs are part of /var/log/messages. "
|
||||||
echo "cd /ambe "
|
echo ""
|
||||||
echo "./run "
|
echo ""
|
||||||
echo "Leave screen session running"
|
echo "************************************************************************"
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "To stop AMBE...."
|
|
||||||
echo "ps aux | grep ambe"
|
|
||||||
echo "kill <THE PID #>"
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "************************************************************************"
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "After reading the above, reboot the server and you should be ready to start ambeD :) "
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
|
12
templates/ambed.service
Normal file
12
templates/ambed.service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=AMBED
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStartPre=-/sbin/rmmod ftdi_sio
|
||||||
|
ExecStartPre=-/sbin/rmmod usbserial
|
||||||
|
ExecStart=/ambed/ambed LOCAL-IP
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Alias=xlxd.service
|
Loading…
Reference in New Issue
Block a user