mirror of
https://github.com/ShaYmez/YSFReflector-debian-installer.git
synced 2024-05-25 07:55:03 -04:00
Added systemd unit file
This commit is contained in:
parent
9689d15cd6
commit
13a7ddb1f9
@ -2,10 +2,10 @@
|
|||||||
#A tool to install YSFReflector.
|
#A tool to install YSFReflector.
|
||||||
#This is essentially a scripted version of:
|
#This is essentially a scripted version of:
|
||||||
#https://register.ysfreflector.de/installation
|
#https://register.ysfreflector.de/installation
|
||||||
#Step 1: Install Debian 8 or 9 and make sure it has internet and is up to date.
|
#Step 1: Install Debian 9 and make sure it is up to date.
|
||||||
#Step 2: Run this script
|
#Step 2: Run this script
|
||||||
#Step 3: To start YSFReflector: '/YSFRflector/YSFRflector YSFRflector.ini'
|
#Step 3: Use systemd to control the service
|
||||||
#Step 4: To stop YSFReflector: ps aux | grep YSFreflector, then kill the pid. ##It's Ugly, for now...
|
# systemctl status ysfreflector
|
||||||
#Lets begin-------------------------------------------------------------------------------------------------
|
#Lets begin-------------------------------------------------------------------------------------------------
|
||||||
WHO=$(whoami)
|
WHO=$(whoami)
|
||||||
#Have to be ROOT to run this script
|
#Have to be ROOT to run this script
|
||||||
@ -23,6 +23,8 @@ then
|
|||||||
#echo "This script is only tested in Debian 8,9 and Raspian Stretch 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)
|
||||||
#Asking for user input and validating....
|
#Asking for user input and validating....
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
@ -53,10 +55,11 @@ apt-get -y install build-essential
|
|||||||
#Make Directories
|
#Make Directories
|
||||||
echo ""
|
echo ""
|
||||||
echo "Creating YSF directories... "
|
echo "Creating YSF directories... "
|
||||||
mkdir -p /YSFReflector
|
mkdir -p /root/reflector-install-files
|
||||||
mkdir -p /root/YSFReflector-install-files
|
mkdir -p /root/reflector-install-files/ysfreflector
|
||||||
|
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/YSFReflector-install-files/YSFClients/YSFReflector/YSFReflector ]
|
if [ -e /root/reflector-install-files/ysfreflector/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. "
|
||||||
@ -64,49 +67,53 @@ then
|
|||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Downloading and compiling YSFReflector... "
|
echo "Downloading and compiling YSFReflector... "
|
||||||
cd /root/YSFReflector-install-files
|
cd /root/reflector-install-files
|
||||||
git clone https://github.com/g4klx/YSFClients.git
|
git clone https://github.com/g4klx/YSFClients.git
|
||||||
cd /root/YSFReflector-install-files/YSFClients/YSFReflector
|
cd /root/reflector-install-files/ysfreflector/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/YSFReflector-install-files/YSFClients/YSFReflector/YSFReflector ]
|
if [ -e /root/reflector-install-files/ysfreflector/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. "
|
||||||
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. Removing install files and directories. "
|
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'. "
|
||||||
# Removing install files and Directories
|
|
||||||
rm -rf /YSFReflector /root/YSFReflector-install-files
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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/YSFReflector-install-files/YSFClients/YSFReflector/YSFReflector /YSFReflector
|
cp /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector/YSFReflector/YSFReflector /ysfreflector
|
||||||
cp /root/YSFReflector-install-files/YSFClients/YSFReflector/YSFReflector.ini /YSFReflector
|
cp /root/reflector-install-files/ysfreflector/YSFClients/YSFReflector/YSFReflector/YSFReflector.ini /ysfreflector
|
||||||
|
|
||||||
#Updating the ini file
|
#Updating the ini file
|
||||||
echo ""
|
echo ""
|
||||||
echo "Updating ini file in /YSFReflector. "
|
echo "Updating ini file in /YSFReflector. "
|
||||||
sed -i "s/16[ ]*characters[ ]*max/$YSFNAME/g" /YSFReflector/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/14[ ]*characters[ ]*max/$YSFDESC/g" /ysfreflector/YSFReflector.ini
|
||||||
sed -i "s/FilePath=./FilePath=\/var\/log\/YSFReflector\//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.
|
#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 "------------------------------------------------------------------------------"
|
||||||
|
echo "Copying ysfrelfector to systemd... "
|
||||||
|
cp $DIRDIR/templates/ysfreflector.service /etc/systemd/system
|
||||||
|
systemctl daemon-reload
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
echo "This concludes the install of YSFReflector..... "
|
echo "This concludes the install of YSFReflector..... "
|
||||||
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 "YSFReflector is installed and ready to use: "
|
||||||
echo "To start YSFReflector, run: '/YSFRflector/YSFRflector YSFRflector.ini' "
|
echo "To start YSFReflector, run: 'systemctl start ysfreflector' "
|
||||||
echo ""
|
echo ""
|
||||||
echo "To stop YSFReflector: 'ps aux | grep YSFreflector', then kill the pid." #see github.com/n5amd
|
echo "To stop YSFReflector: 'systemctl stop ysfreflector' "
|
||||||
echo "------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
10
templates/ysfreflector.service
Normal file
10
templates/ysfreflector.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=YSFReflector
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/ysfreflector/YSFReflector /ysfreflector/YSFReflector.ini
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Alias=ysfreflector.service
|
Loading…
Reference in New Issue
Block a user