commit 349d8d8e2645f29ee7c2d0c4fde7b0280c022b9f Author: Jan_Hill Date: Thu Dec 19 05:00:15 2024 +0100 Music Scripts diff --git a/AutostartDE_0.1.sh b/AutostartDE_0.1.sh new file mode 100644 index 0000000..cd4e287 --- /dev/null +++ b/AutostartDE_0.1.sh @@ -0,0 +1,178 @@ +#!/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 +figlet Autostart | lolcat -a +echo "" +echo "" +echo "" +echo "" +echo "" +echo "1. Autostart aktivieren" | lolcat +echo "2. Autostart deaktivieren" | lolcat +echo "3. SinusBot Instanz zum Autostart hinzufuegen" | lolcat +echo "" +read -p "Gib eine Zahl ein: " autostart + +if [ "$autostart" = "3" ]; then + if [ -f /etc/SinusAutostart/autostart -o -h /etc/SinusAutostart/autostart ] + then +greenMessage "Geben Sie den SinusBot Webinterface Port ein" +read webport +greenMessage "Geben Sie ein Passwort ein für die gewählte Instanz" +echo "Das Passwort wird dann immer genutzt!" | lolcat +read pwfilee +echo "sleep 1 +clear +rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock +su SinusPort-$webport -c 'cd; screen -AmdS SinusPort-$webport ./sinusbot --override-password=$pwfilee' +clear" >> /etc/SinusAutostart/autostart +echo "Die SinusBot Instanz wurde im Autostart System eingetragen!" | lolcat +else +echo "Die Autostart Funktion ist nicht aktiviert!" | lolcat +sleep 1 +yellowMessage "Um diese Funktion nutzen zu können, muss die Autostart Funktion aktiviert sein!" +sleep 1 +fi + +fi + +if [ "$autostart" = "2" ]; then +echo "Autostart check..." | lolcat +autoactive=$(head -n1 MultiData/autostart.RAW|tail -n1) + + if ! [ "$autoactive" = "active" ]; then + echo "Die Autostart Funktion wurde bereits deaktiviert!" | lolcat + sleep 1 + echo "Beende Script..." | lolcat + sleep 1.5 + fi + + if [ "$autoactive" = "active" ]; then + greenMessage "Deaktiviere Autostart..." + sleep 1 + printf "NotActive" > MultiData/autostart.RAW + sleep 0.5 + mv /etc/SinusAutostart/autostart /etc/SinusAutostart/autostart-NotActive + sleep 1 + clear + clear + clear + echo "Autostart wurde deaktiviert!" | lolcat + sleep 1.5 + fi +fi + + + + if [ "$autostart" = "1" ]; then + + + if ! [ -f MultiData/autostart.RAW -o -h MultiData/autostart.RAW ] + then + printf "NotActive" > MultiData/autostart.RAW + + fi + + + autotesting=$(head -n1 MultiData/autostart.RAW|tail -n1) + + if [ "$autotesting" = "active" ]; then + echo "Die Autostart Funktion ist bereits aktiviert!" | lolcat + sleep 1.5 + echo "Beende Script..." | lolcat + sleep 1 + + fi + + if [ "$autotesting" = "NotActive" ]; then + greenMessage "############################################################" + echo " Autostart check" | lolcat + greenMessage "############################################################" + echo "" + echo "" + echo "Autostart ist nicht aktiv!" + echo "" + sleep 2.5 + clear + clear + clear + echo "Soll der Autostart aktiviert werden?" + greenMessage "ja/nein" + read -p "Gib eine Antwort ein: " quest + + if [ "$quest" = "ja" ]; then + clear + clear + clear + echo "Erstelle Daten..." + sleep 1 + autoactivee=$(head -n1 MultiData/autostart.RAW|tail -n1) + sudo mkdir -p /etc/SinusAutostart + printf " + echo "Created by RAW Networks" + " >> /etc/SinusAutostart/auto.dat + mv /etc/SinusAutostart/autostart-NotActive /etc/SinusAutostart/autostart + sleep 1 + clear + clear + clear + printf "NotActive" > MultiData/autostart.RAW + sleep 1 + + if [ "$autoactivee" = "NotActive" ]; then + printf "active" > MultiData/autostart.RAW + fi + + sleep 0.5 + clear + clear + clear + echo "Installiere Pakete..." | lolcat + sudo apt-get -qq install cron-apt screen -y >/dev/null + sleep 1 + crontab -l; echo '@reboot su -c "screen -AmdS consolsinusbot /etc/SinusAutostart/autostart" root'| crontab - + sleep 1 + printf 'echo "SinusBot Autostart created by RAW Networks <3" ' >> /etc/SinusAutostart/autostart + sleep 1 + chmod 777 /etc/SinusAutostart/autostart + clear + clear + clear + echo "Die Autostart Funktion wurde aktiviert!" | lolcat + fi + + if [ -f MultiData/autostart.RAW -o -h MultiData/autostart.RAW ] + then + clear + clear + clear + echo "Die Autostart Funktion wurde bereits aktiviert!" | lolcat + sleep 1.5 + echo "Beende Script..." | lolcat + fi + + if [ "$autostart" = "nein" ]; then + echo "Script wird beendet..." | lolcat + sleep 1.5 + fi + fi + + fi diff --git a/AutostartEN_0.1.sh b/AutostartEN_0.1.sh new file mode 100644 index 0000000..0538c77 --- /dev/null +++ b/AutostartEN_0.1.sh @@ -0,0 +1,176 @@ +#!/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 +figlet Autostart | lolcat -a +echo "" +echo "" +echo "" +echo "" +echo "" +echo "1. Activate autostart" | lolcat +echo "2. Disable autostart" | lolcat +echo "3. Add SinusBot instance to Autostart" | lolcat +echo "" +read -p "Please enter a number: " autostart + +if [ "$autostart" = "3" ]; then + if [ -f /etc/SinusAutostart/autostart -o -h /etc/SinusAutostart/autostart ] + then +greenMessage "Enter the SinusBot web interface port" +read webport +greenMessage "Enter a password for the selected instance" +echo "The password is then always used!" | lolcat +read pwfilee +echo "sleep 3 +clear +rm -rf /tmp/.X11-unix/X40 /tmp/.sinusbot.lock +su SinusPort-$webport -c 'cd; screen -AmdS SinusPort-$webport ./sinusbot --override-password=$pwfilee' +clear" >> /etc/SinusAutostart/autostart +echo "The SinusBot instance has been entered in the autostart system!" | lolcat +else +echo "The autostart function is not activated!" | lolcat +sleep 1 +yellowMessage "To use this function, the autostart function must be activated!" +sleep 1 +fi + +fi + +if [ "$autostart" = "2" ]; then +echo "Autostart check..." | lolcat +autoactive=$(head -n1 MultiData/autostart.RAW|tail -n1) + + if ! [ "$autoactive" = "active" ]; then + echo "The autostart function has already been deactivated!" | lolcat + sleep 1 + echo "Exit Script..." | lolcat + sleep 1.5 + fi + + if [ "$autoactive" = "active" ]; then + greenMessage "Deactivate autostart..." + sleep 1 + printf "NotActive" > MultiData/autostart.RAW + sleep 0.5 + mv /etc/SinusAutostart/autostart /etc/SinusAutostart/autostart-NotActive + sleep 1 + clear + clear + clear + echo "Autostart has been deactivated!" | lolcat + sleep 1.5 + fi +fi + + + + if [ "$autostart" = "1" ]; then + + if ! [ -f MultiData/autostart.RAW -o -h MultiData/autostart.RAW ] + then + printf "NotActive" > MultiData/autostart.RAW + + fi + + autotesting=$(head -n1 MultiData/autostart.RAW|tail -n1) + + if [ "$autotesting" = "active" ]; then + echo "The autostart function is already activated!" | lolcat + sleep 1.5 + echo "Exit Script..." | lolcat + sleep 1 + + fi + + if [ "$autotesting" = "NotActive" ]; then + greenMessage "############################################################" + echo " Autostart check" | lolcat + greenMessage "############################################################" + echo "" + echo "" + echo "Autostart is not active!" + echo "" + sleep 2.5 + clear + clear + clear + echo "Should the autostart be activated?" + greenMessage "yes/no" + read -p "Enter an answer: " quest + + if [ "$quest" = "yes" ]; then + clear + clear + clear + echo "Create data..." + sleep 1 + autoactivee=$(head -n1 MultiData/autostart.RAW|tail -n1) + sudo mkdir -p /etc/SinusAutostart + printf " + echo "Created by RAW Networks" + " >> /etc/SinusAutostart/auto.dat + mv /etc/SinusAutostart/autostart-NotActive /etc/SinusAutostart/autostart + sleep 1 + clear + clear + clear + printf "NotActive" > MultiData/autostart.RAW + sleep 1 + + if ! [ "$autoactivee" = "active" ]; then + printf "active" > MultiData/autostart.RAW + fi + + sleep 0.5 + clear + clear + clear + echo "Install packages..." | lolcat + sudo apt-get -qq install cron-apt screen -y >/dev/null + sleep 1 + crontab -l; echo '@reboot su -c "screen -AmdS consol /etc/SinusAutostart/autostart" root'| crontab - + sleep 1 + printf 'echo "SinusBot Autostart created by RAW Networks <3" ' >> /etc/SinusAutostart/autostart + sleep 1 + chmod 777 /etc/SinusAutostart/autostart + clear + clear + clear + echo "The autostart function has been activated!" | lolcat + + if [ -f MultiData/autostart.RAW -o -h MultiData/autostart.RAW ] + then + clear + clear + clear + echo "The autostart function has already been activated!" | lolcat + sleep 1.5 + echo "Exit Script..." | lolcat + fi + + if [ "$autostart" = "no" ]; then + echo "Script is terminated..." | lolcat + sleep 1.5 + fi + fi + + fi +fi diff --git a/MultiScript-SinusBotEN_4.5.sh b/MultiScript-SinusBotEN_4.5.sh new file mode 100644 index 0000000..97e5f9c --- /dev/null +++ b/MultiScript-SinusBotEN_4.5.sh @@ -0,0 +1,401 @@ +#!/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 diff --git a/MultiScript-SinusBot_4.5.sh b/MultiScript-SinusBot_4.5.sh new file mode 100644 index 0000000..a5a554d --- /dev/null +++ b/MultiScript-SinusBot_4.5.sh @@ -0,0 +1,603 @@ +#!/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�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� 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