102 lines
3.6 KiB
Bash
102 lines
3.6 KiB
Bash
#!/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"
|
|
SCRIPTS["Enable automatic Updates on all LXCs"]="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/cron-update-lxcs.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"
|
|
"Enable automatic Updates on all LXCs"
|
|
)
|
|
|
|
# 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 OPTIONS=()
|
|
local i=1
|
|
for key in "${ORDER[@]}"; do
|
|
OPTIONS+=("$i" "$key")
|
|
((i++))
|
|
done
|
|
OPTIONS+=("0" "Beenden")
|
|
|
|
CHOICE=$(whiptail --title "POST-INSTALL TOOLBOX" \
|
|
--menu "Wähle ein Script zum Ausführen:" 20 70 12 \
|
|
"${OPTIONS[@]}" 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
|