#!/bin/bash # For Ubuntu! export NEEDRESTART_MODE=a export DEBIAN_FRONTEND=noninteractive # Hash #me hash1="68b329da9893e34099c7d8ad5cb9c940" #common hash2="c357311ed3a47a08b423e1b42ec5c130" #bits hash3="091ba2e12e1dde612c5091e0b6fd24c4" # Versão: version="v4" # ------------------------------------------------------------------------------ # PASSWORD function init { password=$(dialog --backtitle "Server Manager $version" --title " " --insecure --passwordbox "Digite a senha!" 0 0 2>&1 > /dev/tty) hash0=$(echo "$password" | md5sum | awk '{print $1}') [ $? -ne 0 ] && exit [ -z "$password" ] && { dialog --title "ERROR" --msgbox "É necessário digitar uma senha para continuar." 6 40 clear } || { [ "$hash0" = "$hash1" ] && { start } || { [ "$hash0" = "$hash2" ] && { startocult } || { [ "$hash0" = "$hash3" ] && { start } || { clear dialog --title "ERROR" --msgbox "Senha incorreta. \nTente novamente!" 6 30 timeout=$((timeout+1)); sleep $timeout init } } } } } hash1="fe5dfdd991450623c39efc7705e47ad5" function start { var0=$(dialog --title "SUPERVISOR" --backtitle "Bem-Vindo ao Server Manager $version!" --menu " " 0 0 0 \ 1 'Orchestration' \ 2 'Docker Maintenance' \ 3 'Support & Help Desk' \ 4 'Auto Relatorio' \ 5 'Atualizar o .bashrc' \ 6 'First Run' \ X 'Exit' 2>&1 > /dev/tty ) case "$var0" in 1) clear ; echo "Por favor, insira a senha do usuário $USER!" ; curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/orchestration | sudo bash ; start ;; 2) clear ; curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/docker-tools | bash ; start ;; 3) managers ; start ;; 4) clear ; echo "Por favor, insira a senha do usuário $USER!" ; curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/auto_relatorio | tee /home/administrador/.autorelat ; chmod +x /home/administrador/.autorelat ; sudo bash /home/administrador/.autorelat ; start ;; 5) curl -sSL https://raw.githubusercontent.com/urbancompasspony/bashrc/main/install.sh | bash ; start ;; 6) firstconfig ; start ;; X) exit ;; esac } function startocult { managers ; startocult } function managers { var0=$(dialog --title 'Suporte & Help Desk' --backtitle "Suporte & Help Desk" --ok-label "Acessar" --cancel-label "Voltar" --menu " " 0 0 0 \ 1 'Gerir Maquinas Virtuais' \ 2 'Gerir Containers' \ 3 'Gerir Active Directory' \ 4 'Ferramentas & Utilidades' \ 5 'Iniciar Area de Trabalho' \ 6 'Urgencias & Emergencias' \ 7 'Reiniciar Servidor' \ 8 'Desligar Servidor' \ X 'Sair' 2>&1 > /dev/tty ) case "$var0" in 1) curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/vm_machine | bash ; managers ;; 2) curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/docker | bash ; managers ;; 3) domain00 ; managers ;; 4) curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/tools | tee /home/administrador/.t00lz ; chmod +x /home/administrador/.t00lz ; clear ; sudo bash /home/administrador/.t00lz ; managers ;; 5) desktop00 ; managers ;; 6) urgencies0 ; managers ;; 7) reb00t ; managers ;; 8) shutd0 ; managers ;; X) exit ;; esac } function urgencies0 { var0=$(dialog --title ' ' --backtitle "Urgencias & Emergencias" --ok-label "Acessar" --cancel-label "Voltar" --menu " " 0 0 0 \ 1 'Diagnostico do Sistema' \ 2 'Local A: Restauracao de Containers' \ 3 'Local B: Limpar Backup Provisorio' \ 4 'Nuvem A: Baixar Backups de Containers' \ 5 'Nuvem B: Restauracao de Containers' \ 6 'Nuvem C: Limpar Backup Provisorio' \ X '<' 2>&1 > /dev/tty ) case "$var0" in 1) curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/solucao_de_problemas | tee /home/administrador/.sp ; chmod +x /home/administrador/.sp ; clear ; bash /home/administrador/.sp ; urgencies0 ;; 2) clear ; curl -sSL https://raw.githubusercontent.com/urbancompasspony/docker/main/Backup/03-AutoRestoreBKP | bash ; urgencies0 ;; 3) clear ; sudo rm -R /srv/backup4restore ; clear echo ""; echo "A pasta backup4restore foi limpa!"; sleep 3 ; urgencies0 ;; 4) curl -sSL https://raw.githubusercontent.com/urbancompasspony/docker/main/Backup/04-AutoRestoreCloud | tee /home/administrador/.rc ; chmod +x /home/administrador/.rc ; clear ; bash /home/administrador/.rc ; urgencies0 ;;4) clear ; curl -sSL https://raw.githubusercontent.com/urbancompasspony/docker/main/Backup/05-AutoRestoreBKPCloud | bash ; urgencies0 ;; 5) clear ; sudo rm -R /srv/restoredcloud ; clear echo ""; echo "A pasta restoredcloud/ foi limpa!"; sleep 3 ; urgencies0 ;; X) echo "." >/dev/null ;; esac } function desktop00 { pstree -s $$ | grep sshd 1>&2 >/dev/null && { clear; echo ""; echo "Voce esta tentando acessar o desktop remotamente. Use esse menu la na tela local do servidor!" } ||{ desktop01 } sleep 3 } function desktop01 { [ -f /usr/bin/labwc ] && { labwc return } || { startx return } clear; echo ""; echo "Nenhum servidor grafico foi localizado! Verifique seu sistema." sleep 2 } hash1="e4439267203fb5277d347e6cd6e440b5" function reb00t { dialog --title 'Reiniciar' --backtitle "Reinicio" --yesno 'Deseja reiniciar este sistema?' 0 0 [ $? = 0 ] && { sudo reboot } || { echo "." >/dev/null } } hash1="7c6126d9cc35fccb0c8a3a42147ea85f" function shutd0 { dialog --title 'Desligar' --backtitle "Desligamento" --yesno 'Deseja desligar este sistema?' 0 0 [ $? = 0 ] && { sudo shutdown -h now } || { echo "." >/dev/null } } function firstconfig { var0=$(dialog --title ' ' --backtitle "Fiest Configuration!" --menu " " 0 0 0 \ 1 'Linite' \ 2 'AutoConfig pfSense (VM)' \ 3 'DWAgent (ARM)' \ 4 'Set MOTD' \ 5 'Set Wayland (labwc 24.04+)' \ 6 'Set OpenBox ObaMenu' \ 7 'Waydroid (EndeavourOS)' \ X '<' 2>&1 > /dev/tty ) case "$var0" in 1) curl -sSL https://raw.githubusercontent.com/urbancompasspony/linite/main/linite.menu | bash ; firstconfig ;; 2) curl -sSL https://raw.githubusercontent.com/urbancompasspony/server/main/auto_pfsense | sudo bash ; firstconfig ;; 3) dwgeneric0 ; firstconfig ;; 4) motd0 ; firstconfig ;; 5) wayland00 ; firstconfig ;; 6) clear ; mkdir -p /home/administrador/.config/openbox ; wget https://raw.githubusercontent.com/urbancompasspony/linux.cheat.sheet/main/Wayland/LabWC/menu.xml -O /home/administrador/.config/openbox ; firstconfig ;; 7) waydroid0 ; firstconfig ;; X) echo "." >/dev/null ;; esac } function waydroid0 { clear yay -Syyu clear sudo pacman -S lzip radeontop nvtop clear yay -S binder_linux-dkms clear sudo systemctl stop waydroid-container.service clear sudo rm -rf /var/lib/waydroid clear sudo modprobe -r binder-linux clear sudo modprobe binder-linux devices=binder,hwbinder,vndbinder clear yay -S waydroid clear sudo firewall-cmd --zone=trusted --add-port=67/udp; sudo firewall-cmd --zone=trusted --add-port=53/udp; sudo firewall-cmd --zone=trusted --add-forward; sudo firewall-cmd --zone=trusted --add-interface=waydroid0; sudo firewall-cmd --runtime-to-permanent clear sudo waydroid init -s GAPPS clear echo "Tudo pronto!"; sleep 5 } function wayland00 { clear sudo apt update sudo apt install openbox wayland-utils labwc obconf -y mkdir -p /home/administrador/.config/labwc rsync -va /etc/xdg/openbox/ .config/labwc/ wget https://raw.githubusercontent.com/urbancompasspony/linux.cheat.sheet/main/Wayland/LabWC/menu.xml -O .config/labwc/menu.xml } function domain00 { docker ps -a | grep dominio 1>&2 >/dev/null && { docker exec -it dominio /root/.init return } || { clear; echo ""; echo "Nenhum Controlador de Dominio encontrado neste sistema!"; echo ""; sleep 3 } } function dwgeneric0 { wget https://www.dwservice.net/download/dwagent_generic.sh -O /home/administrador/dwagent_generic.sh chmod +x dwagent_generic.sh sudo bash dwagent_generic.sh } function motd0 { sudo apt update; sudo apt install figlet -y; sudo rm -R /etc/update-motd.d/* sudo wget https://raw.githubusercontent.com/urbancompasspony/server/main/MOTD/00-header -O /etc/update-motd.d/00-header sudo wget https://raw.githubusercontent.com/urbancompasspony/server/main/MOTD/20-sysinfo -O /etc/update-motd.d/20-sysinfo sudo wget https://raw.githubusercontent.com/urbancompasspony/server/main/MOTD/90-dynamic-motd -O /etc/update-motd.d/90-dynamic-motd sudo chmod +x /etc/update-motd.d/* } [ "$EUID" -ne 0 ] || { echo "Não execute esse script com sudo! Saindo..." exit } init exit 1