Cleaned script up to be a little more readable
This commit is contained in:
parent
e515bd67fa
commit
581cf78167
|
@ -8,26 +8,25 @@
|
||||||
# systemctl status ysfreflector
|
# systemctl status ysfreflector
|
||||||
#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."
|
||||||
#echo "This script is only tested in Debian 8,9 and Raspian Stretch for now."
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
#Gather variables.
|
|
||||||
DIRDIR=$(pwd)
|
DIRDIR=$(pwd)
|
||||||
#Asking for user input and validating....
|
YSFREPO=https://github.com/g4klx/YSFClients.git
|
||||||
echo "------------------------------------------------------------------------------"
|
DEP="wget git build-essential"
|
||||||
|
YSFINSTDIR=/root/reflector-install-files/ysfreflector
|
||||||
|
YSFAPPDIR=/ysfreflector
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
read -p "What will the name of your reflector be? 16 Characters MAX, this includes spaces. " YSFNAME
|
read -p "What will the name of your reflector be? 16 Characters MAX, this includes spaces. " YSFNAME
|
||||||
YSFNAMEC=$(expr length "$YSFNAME")
|
YSFNAMEC=$(expr length "$YSFNAME")
|
||||||
until [ $YSFNAMEC -le 16 ]
|
until [ $YSFNAMEC -le 16 ]
|
||||||
|
@ -44,39 +43,38 @@ do
|
||||||
read -p "What is the description? 14 Characters MAX, this includes spaces. " YSFDESC
|
read -p "What is the description? 14 Characters MAX, this includes spaces. " YSFDESC
|
||||||
YSFDESCC=$(expr length "$YSFDESC")
|
YSFDESCC=$(expr length "$YSFDESC")
|
||||||
done
|
done
|
||||||
|
|
||||||
#Install dependicies
|
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
echo "Installing required software... "
|
echo "Installing required software... "
|
||||||
apt-get -y install wget
|
apt-get -y install $DEP
|
||||||
apt-get -y install git
|
|
||||||
apt-get -y install build-essential
|
|
||||||
|
|
||||||
#Make Directories
|
#Make Directories
|
||||||
echo ""
|
echo ""
|
||||||
echo "Creating YSF directories... "
|
echo "Creating YSF directories... "
|
||||||
mkdir -p /root/reflector-install-files
|
mkdir -p $YSFINSTDIR
|
||||||
mkdir -p /root/reflector-install-files/ysfreflector
|
mkdir -p $YSFAPPDIR
|
||||||
mkdir -p /ysfreflector
|
|
||||||
#If the file is here already, then we dont need to compile on top of it. Remove the git clone directory and start over.
|
#If the file is here already, then we dont need to compile on top of it. Remove the git clone directory and start over.
|
||||||
if [ -e /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector/YSFReflector ]
|
if [ -e $YSFINSTDIR/YSFClients/YSFReflector/YSFReflector ]
|
||||||
then
|
then
|
||||||
echo ""
|
echo ""
|
||||||
echo "It looks like you have already compiled YSFReflector. If you want to install it again, delete the directory '/root/YSFReflector-install-files' and run this script again. "
|
echo "It looks like you have already compiled YSFReflector. If you want to install it again, delete the directory '/root/YSFReflector-install-files' and run this script again. "
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
echo "Downloading and compiling YSFReflector... "
|
echo "Downloading and compiling YSFReflector... "
|
||||||
cd /root/reflector-install-files/ysfreflector
|
echo "------------------------------------------------------------------------------"
|
||||||
git clone https://github.com/g4klx/YSFClients.git
|
cd $YSFINSTDIR
|
||||||
cd /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector
|
git clone $YSFREPO
|
||||||
|
cd $YSFINSTDIR/YSFClients/YSFReflector
|
||||||
make clean all
|
make clean all
|
||||||
fi
|
fi
|
||||||
#Now the file should be there, if it compiled correctly.
|
#Now the file should be there, if it compiled correctly.
|
||||||
if [ -e /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector/YSFReflector ]
|
if [ -e $YSFINSTDIR/YSFClients/YSFReflector/YSFReflector ]
|
||||||
then
|
then
|
||||||
echo "------------------------------------------------------------------------------"
|
echo ""
|
||||||
echo "It looks like everything compiled successfully. There is a 'YSFReflector' application file. "
|
echo "It looks like everything compiled successfully. There is a 'YSFReflector' application file. "
|
||||||
|
echo "------------------------------------------------------------------------------"
|
||||||
else
|
else
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
echo "UH OH!! I dont see the YSFReflector application file after attempting to compile. The output above is the only indication as to why it might have failed. To Try again Remove '/root/reflector-install-files'. "
|
echo "UH OH!! I dont see the YSFReflector application file after attempting to compile. The output above is the only indication as to why it might have failed. To Try again Remove '/root/reflector-install-files'. "
|
||||||
|
@ -85,35 +83,33 @@ fi
|
||||||
|
|
||||||
#Copying over files.
|
#Copying over files.
|
||||||
echo ""
|
echo ""
|
||||||
echo "Copying files over to the executable directory.... "
|
echo "Copying files over to the executable directory...... "
|
||||||
cp /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector/YSFReflector /ysfreflector
|
cp $YSFINSTDIR/YSFClients/YSFReflector/YSFReflector $YSFAPPDIR
|
||||||
cp /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector/YSFReflector.ini /ysfreflector
|
cp $YSFINSTDIR/YSFClients/YSFReflector/YSFReflector.ini $YSFAPPDIR
|
||||||
|
echo "Updating ini file in /YSFReflector...... "
|
||||||
#Updating the ini file
|
sed -i "s/16[ ]*characters[ ]*max/$YSFNAME/g" $YSFAPPDIR/YSFReflector.ini
|
||||||
echo ""
|
sed -i "s/14[ ]*characters[ ]*max/$YSFDESC/g" $YSFAPPDIR/YSFReflector.ini
|
||||||
echo "Updating ini file in /YSFReflector. "
|
sed -i "s/FilePath=./FilePath=\/var\/log\/YSFReflector\//g" $YSFAPPDIR/YSFReflector.ini
|
||||||
sed -i "s/16[ ]*characters[ ]*max/$YSFNAME/g" /ysfreflector/YSFReflector.ini
|
|
||||||
sed -i "s/14[ ]*characters[ ]*max/$YSFDESC/g" /ysfreflector/YSFReflector.ini
|
|
||||||
sed -i "s/FilePath=./FilePath=\/var\/log\/YSFReflector\//g" /ysfreflector/YSFReflector.ini
|
|
||||||
|
|
||||||
#Creating mmdvm user that is apparently required for this to run. I assume this can be changed if someone knows C before compiling it.
|
|
||||||
groupadd mmdvm
|
groupadd mmdvm
|
||||||
useradd mmdvm -g mmdvm -s /sbin/nologin
|
useradd mmdvm -g mmdvm -s /sbin/nologin
|
||||||
mkdir -p /var/log/YSFReflector
|
mkdir -p /var/log/YSFReflector
|
||||||
chown mmdvm: /var/log/YSFReflector
|
chown mmdvm: /var/log/YSFReflector
|
||||||
#Copying over systemd unit file
|
echo "Copying ysfrelfector to systemd...... "
|
||||||
echo "------------------------------------------------------------------------------"
|
|
||||||
echo "Copying ysfrelfector to systemd... "
|
|
||||||
cp $DIRDIR/templates/ysfreflector.service /etc/systemd/system
|
cp $DIRDIR/templates/ysfreflector.service /etc/systemd/system
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
echo "------------------------------------------------------------------------------"
|
echo ""
|
||||||
echo "This concludes the install of YSFReflector..... "
|
echo ""
|
||||||
|
echo "******************************************************************************"
|
||||||
|
echo ""
|
||||||
|
echo " This concludes the install of YSFReflector..... "
|
||||||
|
echo ""
|
||||||
|
echo "******************************************************************************"
|
||||||
|
echo ""
|
||||||
echo "Remember to register your YSF Reflector at https://register.ysfreflector.de/register. "
|
echo "Remember to register your YSF Reflector at https://register.ysfreflector.de/register. "
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
echo "YSFReflector is installed and ready to use: "
|
echo " To start YSFReflector: 'systemctl start ysfreflector' "
|
||||||
echo "To start YSFReflector, run: 'systemctl start ysfreflector' "
|
echo ""
|
||||||
|
echo " To stop YSFReflector: 'systemctl stop ysfreflector' "
|
||||||
echo ""
|
echo ""
|
||||||
echo "To stop YSFReflector: 'systemctl stop ysfreflector' "
|
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue