402 lines
12 KiB
Bash
402 lines
12 KiB
Bash
#!/bin/bash
|
|
function redMessage {
|
|
echo -e "\\033[36;1m${@}\033[0m"
|
|
}
|
|
|
|
function greenMessage {
|
|
echo -e "\\033[32;1m${@}\033[0m"
|
|
}
|
|
|
|
function kekMessage {
|
|
echo -e "\\033[36;1m${@}\033[0m"
|
|
}
|
|
|
|
function yellowMessage {
|
|
echo -e "\\033[33;1m${@}\033[0m"
|
|
}
|
|
|
|
clear
|
|
clear
|
|
clear
|
|
clear
|
|
|
|
|
|
echo "Your language is English" | lolcat
|
|
echo "Starting Script..." | lolcat
|
|
sleep 1.5
|
|
|
|
clear
|
|
clear
|
|
clear
|
|
|
|
|
|
function OPT {
|
|
figlet Options | lolcat
|
|
}
|
|
|
|
|
|
|
|
greenMessage "#################################################################"
|
|
figlet Welcome | lolcat
|
|
echo ""
|
|
echo ""
|
|
echo " RAW Networks" | lolcat
|
|
echo " SinusBot MultiScript" | lolcat
|
|
echo ""
|
|
echo ""
|
|
greenMessage "#################################################################"
|
|
|
|
OPT
|
|
echo "1. SinusBot/Install" | lolcat
|
|
echo "2. SinusBot/Start/All" | lolcat
|
|
echo "3. SinusBot Stop All" | lolcat
|
|
echo "4. Register Instance" | lolcat
|
|
echo "5. Remove Instance" | lolcat
|
|
echo "6. SinusBot/Start" | lolcat
|
|
echo "8. SinusBot/Stop" | lolcat
|
|
echo "9. Changelog" | lolcat
|
|
echo "10. SinusBot Autostart ( BETA )" | lolcat
|
|
echo "11. Change language to German" | lolcat
|
|
echo "12. EXIT" | lolcat
|
|
|
|
read -p "Please enter a number: " numbersde
|
|
|
|
|
|
if [ "$numbersde" = "10" ]; then
|
|
rm /etc/SinusAutostart/AutostartEN_0.1
|
|
sleep 0.5
|
|
greenMessage "Connecting to RawUpdate Server..."
|
|
sleep 1
|
|
wget http://update.rawnetworks.eu/FILES/MultiScript/AutostartEN_0.1
|
|
clear
|
|
clear
|
|
clear
|
|
mkdir -p /etc/SinusAutostart/
|
|
mv AutostartEN_0.1 /etc/SinusAutostart/
|
|
chmod 777 /etc/SinusAutostart/AutostartEN_0.1
|
|
sleep 1
|
|
greenMessage "Starting Script..."
|
|
sleep 1
|
|
/etc/SinusAutostart/AutostartEN_0.1
|
|
|
|
fi
|
|
|
|
if [ "$numbersde" = "11" ]; then
|
|
echo "DE" > MultiData/languages.RAW
|
|
greenMessage "Switch to German language..."
|
|
sleep 1
|
|
su -c "cd .. && ./MultiScript-SinusBot_4.5" root
|
|
fi
|
|
|
|
if [ "$numbersde" = "7" ]; then
|
|
clear
|
|
clear
|
|
clear
|
|
greenMessage "${COLOR1}#######################################################${NC}\n"
|
|
greenMessage "${COLOR1}# SinusBot MultiScript Version 4.5 #${NC}\n"
|
|
greenMessage "${COLOR1}#######################################################${NC}\n"
|
|
greenMessage "${COLOR1}# - Additions: Autostart Function #${NC}\n"
|
|
greenMessage "${COLOR1}# - Removed: Old SinusBot Installer #${NC}\n"
|
|
greenMessage "${COLOR1}# - Changed: Reworked Design #${NC}\n"
|
|
greenMessage "${COLOR1}#######################################################${NC}\n"
|
|
fi
|
|
|
|
|
|
|
|
if [ "$numbersde" = "1" ]; then
|
|
sudo dpkg --force-all -r atftpd 2>/dev/null
|
|
sudo apt-get -y purge 2>/dev/null
|
|
sudo dpkg --add-architecture i3860 2>/dev/null
|
|
sudo apt-get -y update 2>/dev/null
|
|
sudo apt-get -y dist-upgrade 2>/dev/null
|
|
apt-get -y -qq install screen x11vnc xvfb libxcursor1 libpulse0 libpulse0:i386 pulseaudio ca-certificates bzip2 psmisc libglib2.0-0 less cron-apt ntp python iproute2 dbus libnss3 libegl1-mesa x11-xkb-utils libasound2 libxcomposite-dev libxi6 2>/dev/null
|
|
update-ca-certificates 2>/dev/null
|
|
sleep 1
|
|
clear
|
|
apt-get -qq -y install ca-certificates bzip2 python wget -y 2>/dev/null
|
|
update-ca-certificates 2>/dev/null
|
|
sleep 1
|
|
clear
|
|
|
|
|
|
clear
|
|
clear
|
|
clear
|
|
|
|
|
|
kekMessage " Creating User"
|
|
|
|
greenMessage "How many SinusBot instances should be created?"
|
|
greenMessage "Enter a port for each instance! | Example: 8087 8088 8089 ..."
|
|
read sinusnum
|
|
greenMessage "Enter a password for the SinusBot web interface. \n The password is valid for all selected ports!"
|
|
read pwfile
|
|
|
|
if [ -f /etc/SinusAutostart/autostart -o -h /etc/SinusAutostart/autostart ]
|
|
then
|
|
greenMessage "Should be all selected instances added to the autostart?"
|
|
kekMessage "Yes/No"
|
|
|
|
read -p "Enter an answer: " autoquest
|
|
|
|
if [ "$autoquest" = "yes" ] || [ "$autoquest" = "Yes" ] || [ "$autoquest" = "j" ] || [ "$autoquest" = "y" ]; then
|
|
while IFS=' ' read -ra PORTS; do
|
|
for port in "${PORTS[@]}"; do
|
|
sleep 1
|
|
|
|
echo "sleep 3
|
|
clear
|
|
rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock
|
|
su SinusPort-$port -c 'cd; screen -AmdS SinusPort-$port ./sinusbot --override-password=$pwfile'
|
|
clear" >> /etc/SinusAutostart/autostart
|
|
|
|
|
|
done
|
|
done <<< "$sinusnum"
|
|
fi
|
|
|
|
if [ "$autoquest" = "no" ] || [ "$autoquest" = "No" ] || [ "$autoquest" = "n" ]; then
|
|
greenMessage "The autostart function is not used for the selected instances!"
|
|
sleep 1.5
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
clear
|
|
clear
|
|
clear
|
|
|
|
while IFS=' ' read -ra PORTS; do
|
|
for port in "${PORTS[@]}"; do
|
|
sleep 1
|
|
echo "
|
|
______________________________________________
|
|
**********************************************
|
|
|
|
BotUser: SinusPort-$port
|
|
Instance Port: $port
|
|
Default password: $pwfile
|
|
|
|
**********************************************
|
|
-----------------------------------------------------------------
|
|
RAW Networks // YouTube: https://youtube.com/c/RawNetworksYouTube
|
|
-----------------------------------------------------------------" >> RawNetworks.txt
|
|
echo "sleep 1
|
|
clear
|
|
rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock
|
|
su SinusPort-$port -c 'cd; screen -AmdS SinusPort-$port ./sinusbot --override-password=$pwfile'
|
|
clear" >> MultiData/BotAllBoot
|
|
echo "sleep 1
|
|
clear
|
|
su SinusPort-$port -c 'pkill screen'
|
|
clear" >> MultiData/BotAllStop
|
|
sleep 2
|
|
id -u SinusPort-$port &>/dev/null || adduser --disabled-login --home /opt/SinusPort-$port --gecos "" --force-badname SinusPort-$port
|
|
kekMessage " User login"
|
|
sleep 3
|
|
kekMessage " Update & Upgrade"
|
|
apt-get -qq update -y; apt-get -qq upgrade -y; update-ca-certificates;
|
|
clear
|
|
chmod 7777 /opt/
|
|
chown -R SinusPort-$port:SinusPort-$port /opt/SinusPort-$port
|
|
|
|
apt-get install libnss3-dev -y
|
|
kekMessage " Downloading required software..."
|
|
apt-get -qq install x11vnc xinit xvfb libxcursor1 ca-certificates bzip2 curl libglib2.0-0 nano screen -y
|
|
rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock
|
|
kekMessage " SinusBot downloading..."
|
|
su -c ' cd; curl -O https://www.sinusbot.com/dl/sinusbot.current.tar.bz2' SinusPort-$port
|
|
kekMessage " TeamSpeak Client downloadling..."
|
|
su -c ' cd; wget http://update.rawnetworks.eu/FILES/Ts3ClientDownload/TS_Client318.zip' SinusPort-$port
|
|
su -c ' cd; tar xfvx sinusbot.current.tar.bz2' SinusPort-$port
|
|
su -c ' cd; unzip TS_Client318.zip' SinusPort-$port
|
|
su -c ' cd; clear' SinusPort-$port
|
|
su -c ' cd; mkdir -p TeamSpeak3-Client-linux_amd64/plugins; cp plugin/libsoundbot_plugin.so TeamSpeak3-Client-linux_amd64/plugins/' SinusPort-$port
|
|
su -c ' cd; mv config.ini.dist config.ini' SinusPort-$port
|
|
clear
|
|
sleep 2
|
|
rm /opt/SinusPort-$port/config.ini
|
|
echo ""
|
|
echo "ListenPort = "$port"" >> /opt/SinusPort-$port/config.ini
|
|
echo 'ListenHost = "0.0.0.0"' >> /opt/SinusPort-$port/config.ini
|
|
echo 'TS3Path = "TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64"' >> /opt/SinusPort-$port/config.ini
|
|
sleep 2
|
|
chown -R SinusPort-$port:SinusPort-$port /opt/SinusPort-$port
|
|
su -c 'cd && screen -AmdS BOT ./sinusbot -override-password $pwfile >/dev/null' SinusPort-$port
|
|
greenMessage "LogLevel Patch..."
|
|
echo .
|
|
sleep 1
|
|
echo .
|
|
sleep 1
|
|
echo .
|
|
sleep 1
|
|
sed -i 's/LogLevel = 3/LogLevel =\ 10/g' /opt/SinusPort-$port/config.ini
|
|
sleep 1
|
|
kekMessage " Restarting SinusBot!"
|
|
su -c "pkill screen" SinusPort-$port
|
|
sleep 1
|
|
su -c "cd; rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock; screen -AmdS BOT ./sinusbot -override-password $pwfile >/dev/null" SinusPort-$port
|
|
sleep 1
|
|
kekMessage " The SinusBot Config has been updated!"
|
|
sleep 2
|
|
kekMessage " Installing YouTube-DL "
|
|
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
|
|
sleep 1
|
|
chmod a+rx /usr/local/bin/youtube-dl
|
|
echo '--force-ipv4' > /etc/youtube-dl.conf
|
|
sleep 1
|
|
sed -i 's/YoutubeDLPath = \"\"/YoutubeDLPath = \"\/usr\/local\/bin\/youtube-dl\"/g' /opt/SinusPort-$port/config.ini
|
|
chown SinusPort-$port:SinusPort-$port /opt/SinusPort-$port/config.ini
|
|
sleep 1
|
|
kekMessage " Restarting SinusBot!"
|
|
echo .
|
|
sleep 1
|
|
echo .
|
|
sleep 1
|
|
echo .
|
|
sleep 1
|
|
su -c "pkill screen" SinusPort-$port
|
|
sleep 1
|
|
su -c "cd; rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock; screen -AmdS BOT ./sinusbot -override-password $pwfile >/dev/null" SinusPort-$port
|
|
echo "Fertig!"
|
|
chown -R SinusPort-$port:SinusPort-$port /opt/SinusPort-$port/TeamSpeak3-Client-linux_amd64/
|
|
clear
|
|
clear
|
|
clear
|
|
|
|
COLOR1='\033[0;32m'
|
|
|
|
printf "${COLOR1}#######################################################${NC}\n"
|
|
printf "${COLOR1}# Instance Name: SinusPort-$port #${NC}\n"
|
|
printf "${COLOR1}# SinusBot Webinterface Port: $port #${NC}\n"
|
|
printf "${COLOR1}# SinusBot Webinterface Password: $pwfile #${NC}\n"
|
|
printf "${COLOR1}#######################################################${NC}\n"
|
|
printf ""
|
|
printf "${COLOR1}RAW Networks - https://youtube.com/c/RawNetworksYouTube${NC}\n"
|
|
|
|
|
|
|
|
printf "${COLOR1}#######################################################${NC}\n" >> SinusBot_LOG.log
|
|
printf "${COLOR1}# Instance Name: SinusPort-$port #${NC}\n" >> SinusBot_LOG.log
|
|
printf "${COLOR1}# SinusBot Webinterface Port: $port #${NC}\n" >> SinusBot_LOG.log
|
|
printf "${COLOR1}# SinusBot Webinterface Password: $pwfile #${NC}\n" >> SinusBot_LOG.log
|
|
printf "${COLOR1}#######################################################${NC}\n" >> SinusBot_LOG.log
|
|
printf "" >> SinusBot_LOG.log
|
|
printf "${COLOR1}RAW Networks - https://youtube.com/c/RawNetworksYouTube${NC}\n" >> SinusBot_LOG.log
|
|
sleep 4
|
|
done
|
|
done <<< "$sinusnum"
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$numbersde" = "6" ]; then
|
|
greenMessage "Enter the instance name to be started"
|
|
read startins
|
|
greenMessage "Enter a password for the SinusBot web interface"
|
|
read pwstart
|
|
kekMessage " SinusBot starting..."
|
|
sleep 1
|
|
clear
|
|
su -c 'cd; rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock; screen -AmdS BOT ./sinusbot -override-password $pwstart' $startins
|
|
clear
|
|
su -c "script /dev/null; screen -r BOT" $startins
|
|
sleep 1
|
|
yellowMessage "Your password is: $pwstart"
|
|
fi
|
|
if [ "$numbersde" = "4" ]; then
|
|
greenMessage "Enter an instance name to register."
|
|
read registerins
|
|
greenMessage "Enter a password for the instance"
|
|
read inspw
|
|
yellowMessage "IMPORTANT: The password is always used for the file: BotAllBoot"
|
|
kekMessage "BotAllBoot"
|
|
greenMessage "BotUser $registerins wird in die Datenbank eingetragen..."
|
|
sleep 2
|
|
echo "sleep 1
|
|
clear
|
|
rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock
|
|
su $registerins -c 'cd; screen -AmdS $registerins ./sinusbot --override-password=$inspw'
|
|
clear" >> BotAllBoot
|
|
echo "sleep 1
|
|
clear
|
|
su $registerins -c 'pkill screen'
|
|
clear" >> BotAllStop
|
|
sleep 2
|
|
yellowMessage "The instance has been entered in the database!"
|
|
sleep 1
|
|
fi
|
|
|
|
if [ "$numbersde" = "2" ]; then
|
|
sleep 1
|
|
echo "Starting all SinusBots..." | lolcat
|
|
screen -AmdS Read sh MultiData/BotAllBoot
|
|
fi
|
|
|
|
if [ "$numbersde" = "3" ]; then
|
|
sleep 1
|
|
yellowMessage "All instances are stopped!"
|
|
sleep 2
|
|
echo .
|
|
sleep 1
|
|
echo .
|
|
sleep 1
|
|
echo .
|
|
sleep 1
|
|
screen -AmdS Read sh MultiData/BotAllStop
|
|
sleep 1
|
|
clear
|
|
fi
|
|
if [ "$numbersde" = "8" ]; then
|
|
greenMessage "Enter your instance name!"
|
|
read insstop
|
|
sleep 1
|
|
kekMessage " Deleting /tmp/.X11-unix/X40 /tmp/.sinusbot.lock"
|
|
sleep 1
|
|
su -c 'pkill screen' $insstop
|
|
sleep 1
|
|
clear
|
|
fi
|
|
|
|
if [ "$numbersde" = "5" ]; then
|
|
greenMessage "Enter the instance name you want to delete."
|
|
read delins
|
|
yellowMessage "Should the BotUser $delins really be removed?"
|
|
OPTIONS=("Yes" "No" )
|
|
select OPTION in "${OPTIONS[@]}"; do
|
|
case "$REPLY" in
|
|
1|2 ) break;;
|
|
5 ) errorQuit;;
|
|
*) errorContinue;;
|
|
esac
|
|
done
|
|
|
|
if [ "$OPTION" == "Yes" ]; then
|
|
INSTALL1="Yes"
|
|
elif [ "$OPTION" == "No" ]; then
|
|
INSTALL1="No"
|
|
fi
|
|
if [[ $INSTALL1 == "Yes" ]]; then
|
|
su -c "pkill screen" $delins
|
|
sudo deluser $delins
|
|
sleep 2
|
|
rm -r /opt/$delins/
|
|
fi
|
|
if [[ $INSTALL1 == "No" ]]; then
|
|
exit 0
|
|
fi0
|
|
fi
|
|
|
|
|
|
|
|
if [ "$numbersde" = "12" ]; then
|
|
clear
|
|
exit 0
|
|
fi
|
|
|
|
fi
|