#!/bin/bash # Mundo Telecom - Pre-install (Debian 12) # Uso: wget -O - https://git.homelabds.com.br/install.sh | sh # # Este script prepara o ambiente antes da instalação principal. # Baseado no modelo FusionPBX. set -euo pipefail # Cores para output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' print_status() { echo -e "${GREEN}[MUNDO TELECOM]${NC} $1" } print_warn() { echo -e "${YELLOW}[AVISO]${NC} $1" } print_error() { echo -e "${RED}[ERRO]${NC} $1" } # Verificar se é root if [ "$(id -u)" -ne 0 ]; then print_error "Este script deve ser executado como root" exit 1 fi # Verificar sistema OS=$(cat /etc/os-release | grep "^ID=" | cut -d= -f2 | tr -d '"') VERSION=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -d= -f2 | tr -d '"') print_status "Sistema detectado: $OS $VERSION" if [ "$OS" != "debian" ] || [ "$VERSION" != "12" ]; then print_warn "Este script foi testado apenas no Debian 12" print_warn "Prosseguindo mesmo assim..." fi # Instalar dependências básicas print_status "Atualizando sistema..." apt-get update && apt-get upgrade -y print_status "Instalando dependências..." apt-get install -y \ systemd \ systemd-sysv \ ca-certificates \ curl \ wget \ git \ gnupg \ lsb-release \ apt-transport-https \ sudo # Clonar repositório de instalação print_status "Clonando repositório de instalação..." if [ -d /usr/src/install-scripts ]; then cd /usr/src/install-scripts && git pull else git clone https://git.homelabds.com.br/diegods/install-scripts.git /usr/src/install-scripts fi print_status "" print_status "============================================" print_status " Pré-instalação concluída!" print_status "" print_status " Execute o instalador desejado:" print_status " cd /usr/src/install-scripts/debian" print_status " ./install.sh" print_status "" print_status " Scripts disponíveis:" ls -1 /usr/src/install-scripts/debian/*.sh 2>/dev/null | grep -v pre-install | while read script; do echo " - $(basename $script)" done print_status "============================================"