This repository has been archived on 2024-12-19. You can view files and clone it, but cannot push or open issues or pull requests.
MusicBot_Installer_Tools/MultiScript-SinusBot_4.5.sh

604 lines
17 KiB
Bash
Raw Permalink Blame History

#!/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
kekMessage "Installiere Pakete..."
clear
clear
clear
apt-get install sudo -y >/dev/null
echo -ne '## (10 %)\r'
sudo apt-get install rubygems build-essential -y >/dev/null
clear
clear
clear
echo -ne '############ (60 %)\r'
sudo apt-get install figlet -y >/dev/null
clear
clear
clear
echo -ne '################## (90 %)\r'
sudo gem install lolcat >/dev/null
clear
clear
clear
echo -ne '####################(100 %)\r'
sleep 1
clear
clear
clear
redMessage "Installiere Pakete"
sleep 1
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF >/dev/null
sudo apt-get -qq install apt-transport-https
clear
sudo apt-get update -y >/dev/null
echo -ne '## (10 %)\r' | lolcat
sleep 1
apt-get install screen -y >/dev/null
clear
echo -ne '#### (20 %)\r' | lolcat
apt-get install nano -y >/dev/null
clear
echo -ne '###### (30 %)\r' | lolcat
apt-get install gcc -y >/dev/null
clear
echo -ne '############ (60 %)\r' | lolcat
apt-get install zip -y >/dev/null
clear
echo -ne '################## (90 %)\r' | lolcat
apt-get install unzip -y >/dev/null
apt-get install curl -y >/dev/null
clear
echo -ne '####################(100 %)\r' | lolcat
sleep 2
clear
clear
figlet SinusBot | lolcat
sleep 2
greenMessage ""
greenMessage " SinusBot MultiScript"
greenMessage " Version 4.5 "
greenMessage " Script by"
greenMessage " RAW NETWORKS"
greenMessage " _____________________"
greenMessage ""
greenMessage " YouTube: https://youtube.com/c/RawNetworksYouTube"
greenMessage""
sleep 2
clear
clear
clear
ver="4.5"
datamulti="MultiData"
if [ -d "$datamulti" ]; then
echo "$datamulti directory already exists!" | lolcat
sleep 1
fi
if [ ! -d "$datamulti" ]; then
echo "Creating $datamulti directory..." | lolcat
sudo mkdir -p "$datamulti"
sleep 3.5
fi
clear
clear
clear
if ! [ -f MultiData/languages.RAW -o -h MultiData/languages.RAW ]
then
greenMessage "############################################################"
echo " Choose your language" | lolcat
greenMessage "############################################################"
echo ""
echo ""
echo "1. German" | lolcat
echo "2. English" | lolcat
read -p "Enter a number: " lannumbers
if [ "$lannumbers" = "1" ]; then
echo "Willkommen!" | lolcat
echo "DE" > MultiData/languages.RAW
fi
if [ "$lannumbers" = "2" ]; then
echo "Welcome!" | lolcat
echo "EN" > MultiData/languages.RAW
fi
fi
speakRAW=$(head -n1 MultiData/languages.RAW|tail -n1)
if ! [ "$speakRAW" = "DE" ]; then
greenMessage "Connecting to RawUpdate Server..."
sleep 1
rm MultiData/MultiScript-SinusBotEN_4.5
wget http://update.rawnetworks.eu/FILES/MultiScript/MultiScript-SinusBotEN_4.5
mv MultiScript-SinusBotEN_4.5 MultiData/
clear
clear
clear
greenMessage "Starting Script..."
sleep 1.5
chmod 777 MultiData/MultiScript-SinusBotEN_4.5
MultiData/MultiScript-SinusBotEN_4.5
fi
if ! [ "$speakRAW" = "EN" ]; then
echo "Your language is German!" | lolcat
echo "Starting Script..." | lolcat
sleep 1.5
clear
clear
clear
function OPT {
figlet Optionen | lolcat
}
greenMessage "#################################################################"
figlet Welcome | lolcat
echo ""
echo ""
echo " RAW Networks" | lolcat
echo " SinusBot MultiScript" | lolcat
echo ""
echo ""
greenMessage "#################################################################"
OPT
echo ""
echo ""
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 "7. Changelog" | lolcat
echo "8. SinusBot/Stop" | lolcat
echo "10. Sprache wechseln" | lolcat
echo "11. SinusBot Autostart ( BETA )" | lolcat
echo "12. EXIT" | lolcat
read -p "Gib eine Zahl ein: " numbersde
if [ "$numbersde" = "11" ]; then
rm /etc/SinusAutostart/AutostartDE_0.1
sleep 0.5
greenMessage "Connecting to RawUpdate Server..."
sleep 1
wget http://update.rawnetworks.eu/FILES/MultiScript/AutostartDE_0.1
clear
clear
clear
mkdir -p /etc/SinusAutostart/
mv AutostartDE_0.1 /etc/SinusAutostart/
chmod 777 /etc/SinusAutostart/AutostartDE_0.1
sleep 1
greenMessage "Starting Script..."
sleep 1
/etc/SinusAutostart/AutostartDE_0.1
fi
if [ "$numbersde" = "10" ]; then
clear
clear
clear
echo "Reset language file..." | lolcat
sleep 1
rm MultiData/languages.RAW
sleep 1
if [ -f MultiData/languages.RAW -o -h MultiData/languages.RAW ]
then
greenMessage "############################################################"
echo " Choose your language" | lolcat
greenMessage "############################################################"
echo ""
echo ""
echo "1. German" | lolcat
echo "2. English" | lolcat
read -p "Enter a number: " lannumbers
if [ "$lannumbers" = "1" ]; then
echo "Willkommen!" | lolcat
echo "DE" > MultiData/languages.RAW
sleep 1
./MultiScript-SinusBot_$ver
if [ "$lannumbers" = "2" ]; then
echo "Welcome!" | lolcat
echo "EN" > MultiData/languages.RAW
./MultiScript-SinusBot_$ver
fi
fi
if ! [ -f MultiData/languages.RAW -o -h MultiData/languages.RAW ]
then
greenMessage "############################################################"
echo " Choose your language" | lolcat
greenMessage "############################################################"
echo ""
echo ""
echo "1. German" | lolcat
echo "2. English" | lolcat
read -p "Enter a number: " lannumbers
if [ "$lannumbers" = "1" ]; then
echo "Willkommen!" | lolcat
echo "DE" > MultiData/languages.RAW
sleep 1
./MultiScript-SinusBot_$ver
fi
if [ "$lannumbers" = "2" ]; then
echo "Welcome!" | lolcat
echo "EN" > MultiData/languages.RAW
./MultiScript-SinusBot_$ver
fi
fi
if [ "$lannumbers" = "2" ]; then
echo "Welcome!" | lolcat
echo "EN" > MultiData/languages.RAW
fi
fi
fi
if [ "$numbersde" = "2" ]; then
sleep 1
echo "Alle SinusBot Instanzen werden gestartet..."
sleep 1
screen -AmdS Read sh MultiData/BotAllBoot
fi
if [[ $INSTALL == "restore" ]]; then
sleep 1
kekMessage " L<>sche /tmp/.X11-unix/X40 /tmp/.sinusbot.lock"
sleep 1
rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock
clear
fi
if [ "$numbersde" = "3" ]; then
sleep 1
yellowMessage "Alle Instanzen werden gestoppt!"
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 "Gib deinen Instanz Namen ein!"
read insstop
sleep 1
kekMessage " L<>sche /tmp/.X11-unix/X40 /tmp/.sinusbot.lock"
sleep 1
su -c 'pkill screen' $insstop
sleep 1
clear
fi
if [ "$numbersde" = "5" ]; then
greenMessage "Gib den Instanz Namen ein, den du löschen m<>chtest."
read delins
yellowMessage "Soll der BotUser $delins wirklich entfernt werden?"
OPTIONS=("Ja" "Nein" )
select OPTION in "${OPTIONS[@]}"; do
case "$REPLY" in
1|2 ) break;;
5 ) errorQuit;;
*) errorContinue;;
esac
done
if [ "$OPTION" == "Ja" ]; then
INSTALL1="Ja"
elif [ "$OPTION" == "Nein" ]; then
INSTALL1="Nein"
fi
if [[ $INSTALL1 == "Ja" ]]; then
su -c "pkill screen" $delins
sudo deluser $delins
sleep 2
rm -r /opt/$delins/
fi
if [[ $INSTALL1 == "Nein" ]]; then
exit 0
fi
clear
fi
if [ "$numbersde" = "12" ]; then
clear
exit 0
fi
if [ "$numbersde" = "6" ]; then
greenMessage "Gin den Instanz Namen ein, der gestartet werden soll."
read startins
greenMessage "Gib ein Passwort für das SinusBot Webinterface ein!"
read pwstart
kekMessage " SinusBot starten"
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 "Dein Passwort lautet: $pwstart"
fi
if [ "$numbersde" = "4" ]; then
greenMessage "Gib einen Instanz Namen ein, der registriert werden soll."
read registerins
greenMessage "Gib ein Passwort für die Instanz ein"
read inspw
yellowMessage "WICHTIG: Das Passwort wird immer genutzt für die Datei: 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" >> MultiData/BotAllBoot
echo "sleep 1
clear
su $registerins -c 'pkill screen'
clear" >> MultiData/BotAllStop
sleep 2
yellowMessage "Die Instanz wurde in die Datenbank eingetragen!"
sleep 1
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 " User anlegen"
greenMessage "Wie viele SinusBot Instanzen sollen erstellt werden?"
greenMessage "Gib für jede Instanz, einen Port ein! | Beispiel: 8087 8088 8089 ..."
read sinusnum
greenMessage "Gib ein Passwort für das SinusBot Webinterface ein. \n Das Passwort ist gültig für alle augewählten Ports!"
read pwfile
if [ -f /etc/SinusAutostart/autostart -o -h /etc/SinusAutostart/autostart ]
then
greenMessage "Sollen alle gewählten Instanzen zum Autostart hinzugefügt werden?"
kekMessage "Ja/Nein"
read -p "Geben Sie eine Antwort ein: " autoquest
if [ "$autoquest" = "ja" ] || [ "$autoquest" = "Ja" ] || [ "$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" = "nein" ] || [ "$autoquest" = "Nein" ] || [ "$autoquest" = "n" ]; then
greenMessage "Die Autostart Funktion wird für die gewählten Instanzen \n nicht genutzt!"
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 einloggen"
sleep 3
kekMessage " Updaten & Upgraden"
apt-get -qq update -y; apt-get -qq upgrade -y; update-ca-certificates;
rm -rf /tmp/.X11-unix
rm -rf /tmp/.sinusbot.lock
apt-get install x11vnc xvfb libxcursor1 ca-certificates bzip2 libnss3 libegl1-mesa x11-xkb-utils libasound2 -y
update-ca-certificates
apt-get install libglib2.0-0 -y
clear
chmod 7777 /opt/
chown -R SinusPort-$port:SinusPort-$port /opt/SinusPort-$port
apt-get install libnss3-dev -y
kekMessage " Ben<65>tigte Software herunterladen"
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 downloaden"
su -c ' cd; curl -O https://www.sinusbot.com/dl/sinusbot.current.tar.bz2' SinusPort-$port
kekMessage " TeamSpeak<61> herunterladen"
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 " SinusBot wird neugestartet!"
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 " Die SinusBot Config wurde angepasst!"
sleep 2
kekMessage " Installiere 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 " SinusBot wird neugestartet!"
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
fi