diff --git a/post_install_v2.sh b/post_install_v2.sh new file mode 100644 index 0000000..1f4829a --- /dev/null +++ b/post_install_v2.sh @@ -0,0 +1,99 @@ +#!/bin/bash +# ===================================================== +# POST-INSTALL TOOLBOX (whiptail GUI-Version) +# ===================================================== + +# Prüfen, ob Root +if [ "$EUID" -ne 0 ]; then + echo "Bitte als Root ausführen (sudo)" + exit 1 +fi + +# Skripte (Name -> URL) +declare -A SCRIPTS +SCRIPTS["Get Host & SSD Serialnumbers"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/get_sn.sh" +SCRIPTS["Setup Mail Notification"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/setup-email.sh" +SCRIPTS["Set CPU Scaling Governor"]="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/scaling-governor.sh" +SCRIPTS["Intel e1000e Offload Fix"]="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/nic-offloading-fix.sh" +SCRIPTS["Set PVE Update Repos"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/set_pve_repos.sh" +SCRIPTS["Set PBS Update Repos"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/set_pbs_repos.sh" +SCRIPTS["Create PVE MGNT Bridge"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/create_pve-mgnt-vmbr.sh" +SCRIPTS["Create PVE MGNT LXC"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/create_pve-mgnt-lxc.sh" +SCRIPTS["Install pcvisit RemoteHost on Windows VMs"]="https://me-gitea.maieredv.cloud/manuel.maier/pve-pbs-setup/raw/branch/main/install-pcvisit-remotehost.sh" + +# Reihenfolge festlegen +ORDER=( + "Get Host & SSD Serialnumbers" + "Setup Mail Notification" + "Set CPU Scaling Governor" + "Intel e1000e Offload Fix" + "Set PVE Update Repos" + "Set PBS Update Repos" + "Create PVE MGNT Bridge" + "Create PVE MGNT LXC" + "Install pcvisit RemoteHost on Windows VMs" +) + +# Prüfen, ob whiptail installiert ist +if ! command -v whiptail &>/dev/null; then + echo "Whiptail nicht gefunden. Installiere..." + apt update && apt install -y whiptail +fi + +# Funktion für Menü +run_menu() { + local MENU="" + local i=1 + for key in "${ORDER[@]}"; do + MENU+="$i \"$key\" " + ((i++)) + done + MENU+="0 \"Beenden\"" + + CHOICE=$(whiptail --title "POST-INSTALL TOOLBOX" \ + --menu "Wähle ein Script zum Ausführen:" 20 70 12 \ + $MENU 3>&1 1>&2 2>&3) + + echo "$CHOICE" +} + +# Hauptloop +while true; do + CHOICE=$(run_menu) + + # Prüfen ob Abbrechen / Exit + if [ -z "$CHOICE" ] || [ "$CHOICE" == "0" ]; then + clear + echo "Bye! 👋" + exit 0 + fi + + # Auswahl validieren + if [[ "$CHOICE" =~ ^[0-9]+$ ]] && [ "$CHOICE" -ge 1 ] && [ "$CHOICE" -le ${#ORDER[@]} ]; then + key="${ORDER[$CHOICE-1]}" + url="${SCRIPTS[$key]}" + + whiptail --title "Download Script" --infobox "Lade Script:\n$key\nVon: $url" 8 70 + tmpfile=$(mktemp) + curl -sSL "$url" -o "$tmpfile" + + if [ ! -s "$tmpfile" ]; then + whiptail --title "Fehler" --msgbox "Fehler beim Download!" 8 50 + rm -f "$tmpfile" + continue + fi + + # Unter-Script in Subshell ausführen + clear + echo "========================================" + echo "Starte Script: $key" + echo "========================================" + bash "$tmpfile" + rm -f "$tmpfile" + + echo + read -rp "Fertig! Enter drücken für Menü..." _ + else + whiptail --title "Fehler" --msgbox "Ungültige Auswahl! Bitte erneut versuchen." 8 50 + fi +done