add function gitpull_project & switch from whiptail to dialog because of mouse-support

This commit is contained in:
2025-11-30 23:08:46 +01:00
parent 0cdb564f97
commit 8091fb540b

View File

@@ -22,7 +22,7 @@ EOF
}
ensure_prereqs() {
local bins=("git" "jq" "whiptail")
local bins=("git" "jq" "dialog")
for b in "${bins[@]}"; do
if ! command -v "$b" >/dev/null 2>&1; then
echo "[WARN] Benoetigtes Programm fehlt: $b"
@@ -49,8 +49,8 @@ config_menu() {
local builder_icon
builder_icon=$(get_builder_status_icon)
choice=$(whiptail --title "Konfiguration" --menu "Bitte waehlen:" 20 70 10 \
1 "Abhaengigkeiten installieren (docker, git, jq, whiptail)" \
choice=$(dialog --title "Konfiguration" --menu "Bitte waehlen:" 20 70 10 \
1 "Abhaengigkeiten installieren (docker, git, jq, dialog)" \
2 "Buildx-Builder einrichten | Status: $builder_icon" \
3 "Globalen Editor setzen" \
4 "Standard-Registry setzen" \
@@ -95,22 +95,22 @@ get_builder_status() {
# Abhaengigkeiten installieren
install_dependencies() {
whiptail --msgbox "Installation von Abhaengigkeiten (Beispiel fuer Debian/Ubuntu). Bitte root-Rechte eingeben." 10 70
dialog --msgbox "Installation von Abhaengigkeiten (Beispiel fuer Debian/Ubuntu). Bitte root-Rechte eingeben." 10 70
sudo apt update
sudo apt install -y docker.io git jq whiptail micro
sudo apt install -y docker.io git jq dialog micro
}
# BuildX-Builder einrichten
install_docker_and_buildx() {
# Pruefen ob Docker installiert ist
if ! command -v docker >/dev/null 2>&1; then
whiptail --msgbox "Docker ist nicht installiert! Bitte zuerst ueber 'Abhaengigkeiten installieren' einrichten." 10 70
dialog --msgbox "Docker ist nicht installiert! Bitte zuerst ueber 'Abhaengigkeiten installieren' einrichten." 10 70
return
fi
# Pruefen ob Buildx verfuegbar ist
if ! docker buildx version >/dev/null 2>&1; then
whiptail --msgbox "Docker Buildx-Plugin fehlt! Installiere Buildx..." 10 70
dialog --msgbox "Docker Buildx-Plugin fehlt! Installiere Buildx..." 10 70
mkdir -p ~/.docker/cli-plugins
BUILDX_URL="https://github.com/docker/buildx/releases/latest/download/buildx-$(uname -s)-$(uname -m)"
curl -sSL "$BUILDX_URL" -o ~/.docker/cli-plugins/docker-buildx
@@ -119,7 +119,7 @@ install_docker_and_buildx() {
# Pruefen, ob multiarch-builder existiert
if ! docker buildx ls | grep -q "multiarch-builder"; then
whiptail --msgbox "Richte Buildx-Builder 'multiarch-builder' ein..." 10 70
dialog --msgbox "Richte Buildx-Builder 'multiarch-builder' ein..." 10 70
docker run --rm --privileged tonistiigi/binfmt --install all
docker buildx create --name multiarch-builder --use
docker buildx inspect --bootstrap >/dev/null 2>&1
@@ -127,9 +127,9 @@ install_docker_and_buildx() {
# Finalpruefung: existiert Builder jetzt wirklich?
if docker buildx ls | grep -q "multiarch-builder"; then
whiptail --msgbox "Buildx-Builder 'multiarch-builder' erfolgreich eingerichtet." 10 70
dialog --msgbox "Buildx-Builder 'multiarch-builder' erfolgreich eingerichtet." 10 70
else
whiptail --msgbox "Fehler: Buildx-Builder konnte nicht eingerichtet werden!" 10 70
dialog --msgbox "Fehler: Buildx-Builder konnte nicht eingerichtet werden!" 10 70
fi
}
@@ -153,17 +153,17 @@ set_editor() {
done
while true; do
choice=$(whiptail --title "Editor waehlen" --menu "Bitte Editor auswaehlen:" 20 70 10 "${options[@]}" 3>&1 1>&2 2>&3) || return
choice=$(dialog --title "Editor waehlen" --menu "Bitte Editor auswaehlen:" 20 70 10 "${options[@]}" 3>&1 1>&2 2>&3) || return
if command -v "$choice" >/dev/null 2>&1; then
jq --arg ed "$choice" '.editor = $ed' "$GLOBAL_CONFIG" >"$GLOBAL_CONFIG.tmp" && mv "$GLOBAL_CONFIG.tmp" "$GLOBAL_CONFIG"
whiptail --msgbox "Editor wurde auf '$choice' gesetzt." 10 60
dialog --msgbox "Editor wurde auf '$choice' gesetzt." 10 60
return
else
install_choice=$(whiptail --title "Editor nicht installiert" \
install_choice=$(dialog --title "Editor nicht installiert" \
--yesno "Der Editor '$choice' ist nicht installiert. Moechten Sie ihn jetzt installieren?" 10 60 3>&1 1>&2 2>&3)
if [[ $? -eq 0 ]]; then
whiptail --msgbox "Installation von ${editor_pkg[$choice]}..." 8 50
dialog --msgbox "Installation von ${editor_pkg[$choice]}..." 8 50
sudo apt update
sudo apt install -y "${editor_pkg[$choice]}"
@@ -185,11 +185,11 @@ set_editor() {
fi
fi
whiptail --msgbox "$choice erfolgreich installiert." 8 50
dialog --msgbox "$choice erfolgreich installiert." 8 50
jq --arg ed "$choice" '.editor = $ed' "$GLOBAL_CONFIG" >"$GLOBAL_CONFIG.tmp" && mv "$GLOBAL_CONFIG.tmp" "$GLOBAL_CONFIG"
return
else
whiptail --msgbox "Fehler: $choice konnte nicht installiert werden." 8 50
dialog --msgbox "Fehler: $choice konnte nicht installiert werden." 8 50
fi
fi
fi
@@ -201,7 +201,7 @@ set_default_registry() {
# Alle verfuegbaren Registries auslesen
local registries
registries=$(ls "$REGISTRY_CONFIG_DIR" 2>/dev/null)
[ -z "$registries" ] && { whiptail --msgbox "Keine Registries verfuegbar. Bitte zuerst eine Registry erstellen." 10 60; return; }
[ -z "$registries" ] && { dialog --msgbox "Keine Registries verfuegbar. Bitte zuerst eine Registry erstellen." 10 60; return; }
# Menue-Liste vorbereiten
local menu_list=()
@@ -213,16 +213,16 @@ set_default_registry() {
local current
current=$(jq -r '.default_registry // ""' "$GLOBAL_CONFIG")
# Auswahl per Whiptail
# Auswahl per dialog
local choice
choice=$(whiptail --title "Standard-Registry waehlen" \
choice=$(dialog --title "Standard-Registry waehlen" \
--menu "Bitte Standard-Registry auswaehlen:" 20 70 10 \
"${menu_list[@]}" 3>&1 1>&2 2>&3) || return
# Speichern in global/config.json
jq --arg reg "$choice" '.default_registry = $reg' "$GLOBAL_CONFIG" >"$GLOBAL_CONFIG.tmp" && mv "$GLOBAL_CONFIG.tmp" "$GLOBAL_CONFIG"
whiptail --msgbox "Standard-Registry auf '$choice' gesetzt." 10 60
dialog --msgbox "Standard-Registry auf '$choice' gesetzt." 10 60
}
# Standard-Registry auslesen
@@ -240,7 +240,7 @@ get_default_registry() {
# Hauptmenue Projektverwaltung
project_menu() {
while true; do
choice=$(whiptail --title "Projektverwaltung" --menu "Bitte waehlen:" 20 70 10 \
choice=$(dialog --title "Projektverwaltung" --menu "Bitte waehlen:" 20 70 10 \
1 "Projekt erstellen" \
2 "Projekt loeschen" \
3 "Projekt bearbeiten" \
@@ -258,7 +258,7 @@ project_menu() {
# Neues Projekt anlegen
create_project() {
project_name=$(whiptail --inputbox "Projektname eingeben:" 10 60 3>&1 1>&2 2>&3) || return
project_name=$(dialog --inputbox "Projektname eingeben:" 10 60 3>&1 1>&2 2>&3) || return
[ -z "$project_name" ] && return
mkdir -p "$PROJECT_CONFIG_DIR/$project_name" "$PROJECTS_DIR/$project_name"
@@ -280,42 +280,42 @@ git_repo=
EOF
# Dockerfile oder Git-Repo
if whiptail --yesno "Soll ein Git-Repo geklont werden?" 10 60; then
repo_url=$(whiptail --inputbox "Git-Repository-URL eingeben:" 10 60 3>&1 1>&2 2>&3) || return
if dialog --yesno "Soll ein Git-Repo geklont werden?" 10 60; then
repo_url=$(dialog --inputbox "Git-Repository-URL eingeben:" 10 60 3>&1 1>&2 2>&3) || return
if git clone "$repo_url" "$PROJECTS_DIR/$project_name"; then
sed -i "s|^git_repo=.*|git_repo=$repo_url|" "$PROJECT_CONFIG_DIR/$project_name/config-file"
else
whiptail --msgbox "Fehler beim Klonen des Git-Repos!" 10 60
dialog --msgbox "Fehler beim Klonen des Git-Repos!" 10 60
fi
else
echo -e "FROM debian:bookworm-slim\nCMD echo 'Hello from $project_name'" > "$PROJECTS_DIR/$project_name/Dockerfile"
fi
whiptail --msgbox "Projekt $project_name wurde erstellt." 10 60
dialog --msgbox "Projekt $project_name wurde erstellt." 10 60
}
# Projekt loeschen
delete_project() {
projects=$(ls "$PROJECT_CONFIG_DIR" 2>/dev/null)
[ -z "$projects" ] && { whiptail --msgbox "Keine Projekte vorhanden." 10 60; return; }
[ -z "$projects" ] && { dialog --msgbox "Keine Projekte vorhanden." 10 60; return; }
menu_list=()
for p in $projects; do
menu_list+=("$p" "")
done
project=$(whiptail --menu "Projekt zum Loeschen auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
project=$(dialog --menu "Projekt zum Loeschen auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
if whiptail --yesno "Projekt $project wirklich loeschen?" 10 60; then
if dialog --yesno "Projekt $project wirklich loeschen?" 10 60; then
rm -rf "$PROJECT_CONFIG_DIR/$project" "$PROJECTS_DIR/$project"
whiptail --msgbox "Projekt $project wurde geloescht." 10 60
dialog --msgbox "Projekt $project wurde geloescht." 10 60
fi
}
# Projekt bearbeiten
edit_project() {
projects=$(ls "$PROJECT_CONFIG_DIR" 2>/dev/null)
[ -z "$projects" ] && { whiptail --msgbox "Keine Projekte vorhanden." 10 60; return; }
[ -z "$projects" ] && { dialog --msgbox "Keine Projekte vorhanden." 10 60; return; }
# Projekte fuer Menue vorbereiten (1 Spalte)
menu_list=()
@@ -323,7 +323,7 @@ edit_project() {
menu_list+=("$p" "")
done
project=$(whiptail --menu "Projekt auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
project=$(dialog --menu "Projekt auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
local config_file="$PROJECT_CONFIG_DIR/$project/config-file"
local project_dir="$PROJECTS_DIR/$project"
@@ -341,11 +341,11 @@ edit_project() {
8 "Image bauen"
)
[ -n "$repo_url" ] && menu_items+=("8" "Git Pull")
[ -n "$repo_url" ] && menu_items+=("9" "Git Pull")
menu_items+=("0" "Zurueck")
choice=$(whiptail --title "Projekt bearbeiten: $project" \
choice=$(dialog --title "Projekt bearbeiten: $project" \
--menu "Bitte waehlen:" 20 70 12 \
"${menu_items[@]}" \
3>&1 1>&2 2>&3) || return
@@ -359,6 +359,7 @@ edit_project() {
6) edit_project_auto_subversion "$config_file" ;;
7) edit_project_files "$project" ;;
8) build_image "$project" ;;
9) gitpull_project "$project";;
0) return ;;
esac
done
@@ -375,13 +376,13 @@ edit_project_registries() {
# alle registries aus Registry-Verwaltung
local all_registries
all_registries=$(ls "$REGISTRY_CONFIG_DIR" 2>/dev/null)
[ -z "$all_registries" ] && { whiptail --msgbox "Keine Registries verfuegbar. Bitte zuerst eine Registry erstellen." 10 60; return; }
[ -z "$all_registries" ] && { dialog --msgbox "Keine Registries verfuegbar. Bitte zuerst eine Registry erstellen." 10 60; return; }
# Default-Registry aus globaler Config
local default_registry
default_registry=$(get_default_registry)
# menu_list fuer whiptail vorbereiten
# menu_list fuer dialog vorbereiten
local menu_list=()
for r in $all_registries; do
if [[ " $current " =~ " $r " ]]; then
@@ -394,12 +395,12 @@ edit_project_registries() {
fi
done
# whiptail checklist
# dialog checklist
local selected
selected=$(whiptail --title "Registries auswaehlen" --checklist "Mehrere auswaehlen (SPACE zum markieren)" 20 70 10 \
selected=$(dialog --title "Registries auswaehlen" --checklist "Mehrere auswaehlen (SPACE zum markieren)" 20 70 10 \
"${menu_list[@]}" 3>&1 1>&2 2>&3) || return
# Whiptail gibt die Auswahl in Anfuehrungszeichen zurueck, diese entfernen und Komma getrennt speichern
# dialog gibt die Auswahl in Anfuehrungszeichen zurueck, diese entfernen und Komma getrennt speichern
selected=$(echo $selected | tr -d '"' | tr ' ' ',')
# In Projekt-Config speichern
@@ -411,7 +412,7 @@ change_project_setting() {
local config_file=$1
local key=$2
local current=$(grep "^$key=" "$config_file" | cut -d= -f2)
new_value=$(whiptail --inputbox "$key aendern (aktuell: $current)" 10 60 "$current" 3>&1 1>&2 2>&3) || return
new_value=$(dialog --inputbox "$key aendern (aktuell: $current)" 10 60 "$current" 3>&1 1>&2 2>&3) || return
sed -i "s|^$key=.*|$key=$new_value|" "$config_file"
}
@@ -431,7 +432,7 @@ edit_project_files() {
# Pruefen ob Projektordner existiert
if [[ ! -d "$project_dir" ]]; then
whiptail --msgbox "Projektordner nicht gefunden." 10 60
dialog --msgbox "Projektordner nicht gefunden." 10 60
return
fi
@@ -460,7 +461,7 @@ edit_project_architectures() {
menu_list+=("$a" "$a" OFF)
fi
done
selected=$(whiptail --title "Architekturen auswaehlen" --checklist "Mehrere auswaehlen" 20 70 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
selected=$(dialog --title "Architekturen auswaehlen" --checklist "Mehrere auswaehlen" 20 70 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
selected=$(echo $selected | tr -d '"')
sed -i "s|^architectures=.*|architectures=$selected|" "$config_file"
}
@@ -470,7 +471,7 @@ edit_project_push() {
local current=$(grep "^push=" "$config_file" | cut -d= -f2)
local value="OFF"
[ "$current" == "yes" ] && value="ON"
selected=$(whiptail --title "Push aktivieren?" --checklist "Push auswaehlen" 10 50 1 push "Push aktivieren" $value 3>&1 1>&2 2>&3) || return
selected=$(dialog --title "Push aktivieren?" --checklist "Push auswaehlen" 10 50 1 push "Push aktivieren" $value 3>&1 1>&2 2>&3) || return
[[ $selected == *push* ]] && val="yes" || val="no"
sed -i "s|^push=.*|push=$val|" "$config_file"
}
@@ -480,7 +481,7 @@ edit_project_latest() {
local current=$(grep "^latest=" "$config_file" | cut -d= -f2)
local value="OFF"
[ "$current" == "yes" ] && value="ON"
selected=$(whiptail --title "Latest-Tag setzen?" --checklist "Latest auswaehlen" 10 50 1 latest "Latest setzen" $value 3>&1 1>&2 2>&3) || return
selected=$(dialog --title "Latest-Tag setzen?" --checklist "Latest auswaehlen" 10 50 1 latest "Latest setzen" $value 3>&1 1>&2 2>&3) || return
[[ $selected == *latest* ]] && val="yes" || val="no"
sed -i "s|^latest=.*|latest=$val|" "$config_file"
}
@@ -490,7 +491,7 @@ edit_project_auto_subversion() {
local current=$(grep "^auto_subversion=" "$config_file" | cut -d= -f2)
local value="OFF"
[ "$current" == "yes" ] && value="ON"
selected=$(whiptail --title "Subversion automatisch erhoehen?" --checklist "Auto Subversion auswaehlen" 10 50 1 auto "Automatisch erhoehen" $value 3>&1 1>&2 2>&3) || return
selected=$(dialog --title "Subversion automatisch erhoehen?" --checklist "Auto Subversion auswaehlen" 10 50 1 auto "Automatisch erhoehen" $value 3>&1 1>&2 2>&3) || return
[[ $selected == *auto* ]] && val="yes" || val="no"
# falls auto_subversion key nicht existiert, hinzufuegen
if grep -q "^auto_subversion=" "$config_file"; then
@@ -500,10 +501,43 @@ edit_project_auto_subversion() {
fi
}
gitpull_project() {
local project=$1
local project_dir="$PROJECTS_DIR/$project"
local config_file="$PROJECT_CONFIG_DIR/$project/config-file"
# Prüfen ob git_repo gesetzt ist
local repo_url
repo_url=$(grep "^git_repo=" "$config_file" | cut -d= -f2)
if [[ -z "$repo_url" ]]; then
dialog --msgbox "Dieses Projekt ist nicht mit einem Git-Repository verknüpft." 10 60
return
fi
# Prüfen ob Ordner existiert
if [[ ! -d "$project_dir/.git" ]]; then
dialog --msgbox "Der Projektordner enthaelt kein Git-Repository.\nVielleicht wurde er gelöscht oder bearbeitet?" 12 60
return
fi
# Git Pull durchführen
{
echo "Starte git pull..."
git -C "$project_dir" pull
} >"$LOGS_DIR/gitpull_${project}_$(date +"%Y%m%d_%H%M%S").log" 2>&1
if [[ $? -eq 0 ]]; then
dialog --msgbox "Git Pull erfolgreich abgeschlossen." 10 60
else
dialog --msgbox "FEHLER beim Git Pull!\nSiehe Log-Datei unter logs/." 12 60
fi
}
# Hauptmenue - Registryverwaltung
registry_menu() {
while true; do
choice=$(whiptail --title "Registry-Verwaltung" --menu "Bitte waehlen:" 20 70 10 \
choice=$(dialog --title "Registry-Verwaltung" --menu "Bitte waehlen:" 20 70 10 \
1 "Registry erstellen" \
2 "Registry loeschen" \
3 "Registry bearbeiten" \
@@ -523,12 +557,12 @@ registry_menu() {
create_registry() {
local name url username password
name=$(whiptail --inputbox "Name der Registry (z.B. docker.io):" 10 60 3>&1 1>&2 2>&3) || return
name=$(dialog --inputbox "Name der Registry (z.B. docker.io):" 10 60 3>&1 1>&2 2>&3) || return
[ -z "$name" ] && return
url=$(whiptail --inputbox "URL der Registry:" 10 60 3>&1 1>&2 2>&3) || return
username=$(whiptail --inputbox "Benutzername:" 10 60 3>&1 1>&2 2>&3) || return
password=$(whiptail --passwordbox "Passwort:" 10 60 3>&1 1>&2 2>&3) || return
url=$(dialog --inputbox "URL der Registry:" 10 60 3>&1 1>&2 2>&3) || return
username=$(dialog --inputbox "Benutzername:" 10 60 3>&1 1>&2 2>&3) || return
password=$(dialog --passwordbox "Passwort:" 10 60 3>&1 1>&2 2>&3) || return
mkdir -p "$REGISTRY_CONFIG_DIR/$name"
cat > "$REGISTRY_CONFIG_DIR/$name/config-file" <<EOF
@@ -537,14 +571,14 @@ username=$username
password=$password
EOF
whiptail --msgbox "Registry '$name' wurde erstellt." 10 60
dialog --msgbox "Registry '$name' wurde erstellt." 10 60
}
# Registry loeschen
delete_registry() {
local registries
registries=$(ls "$REGISTRY_CONFIG_DIR" 2>/dev/null)
[ -z "$registries" ] && { whiptail --msgbox "Keine Registries vorhanden." 10 60; return; }
[ -z "$registries" ] && { dialog --msgbox "Keine Registries vorhanden." 10 60; return; }
menu_list=()
for r in $registries; do
@@ -552,11 +586,11 @@ delete_registry() {
done
local reg
reg=$(whiptail --menu "Registry zum Loeschen auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
reg=$(dialog --menu "Registry zum Loeschen auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
if whiptail --yesno "Registry $reg wirklich loeschen?" 10 60; then
if dialog --yesno "Registry $reg wirklich loeschen?" 10 60; then
rm -rf "$REGISTRY_CONFIG_DIR/$reg"
whiptail --msgbox "Registry $reg wurde geloescht." 10 60
dialog --msgbox "Registry $reg wurde geloescht." 10 60
fi
}
@@ -564,7 +598,7 @@ delete_registry() {
edit_registry() {
local registries
registries=$(ls "$REGISTRY_CONFIG_DIR" 2>/dev/null)
[ -z "$registries" ] && { whiptail --msgbox "Keine Registries vorhanden." 10 60; return; }
[ -z "$registries" ] && { dialog --msgbox "Keine Registries vorhanden." 10 60; return; }
menu_list=()
for r in $registries; do
@@ -572,7 +606,7 @@ edit_registry() {
done
local reg
reg=$(whiptail --menu "Registry zum Bearbeiten auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
reg=$(dialog --menu "Registry zum Bearbeiten auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
local config_file="$REGISTRY_CONFIG_DIR/$reg/config-file"
local url username password
@@ -582,9 +616,9 @@ edit_registry() {
password=$(grep "^password=" "$config_file" | cut -d= -f2)
# Eingaben aendern
url=$(whiptail --inputbox "URL:" 10 60 "$url" 3>&1 1>&2 2>&3) || return
username=$(whiptail --inputbox "Benutzername:" 10 60 "$username" 3>&1 1>&2 2>&3) || return
password=$(whiptail --passwordbox "Passwort:" 10 60 "$password" 3>&1 1>&2 2>&3) || return
url=$(dialog --inputbox "URL:" 10 60 "$url" 3>&1 1>&2 2>&3) || return
username=$(dialog --inputbox "Benutzername:" 10 60 "$username" 3>&1 1>&2 2>&3) || return
password=$(dialog --passwordbox "Passwort:" 10 60 "$password" 3>&1 1>&2 2>&3) || return
cat > "$config_file" <<EOF
url=$url
@@ -592,7 +626,7 @@ username=$username
password=$password
EOF
whiptail --msgbox "Registry '$reg' wurde aktualisiert." 10 60
dialog --msgbox "Registry '$reg' wurde aktualisiert." 10 60
}
# Projektparameter laden
@@ -696,7 +730,7 @@ build_image() {
fi
# Abfrage: Log anzeigen?
if whiptail --yesno "Build $build_status. Log jetzt anzeigen?" 10 60; then
if dialog --yesno "Build $build_status. Log jetzt anzeigen?" 10 60; then
local editor_cmd
editor_cmd=$(get_editor_cmd)
$editor_cmd "$logfile"
@@ -715,14 +749,14 @@ view_logs() {
logs=$(ls -1t "$LOGS_DIR"/*.log 2>/dev/null | sed "s|$LOGS_DIR/||")
fi
[ -z "$logs" ] && { whiptail --msgbox "Keine Logs vorhanden." 10 60; return; }
[ -z "$logs" ] && { dialog --msgbox "Keine Logs vorhanden." 10 60; return; }
menu_list=()
for l in $logs; do
menu_list+=("$l" "")
done
log_file=$(whiptail --menu "Log auswaehlen:" 20 70 12 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
log_file=$(dialog --menu "Log auswaehlen:" 20 70 12 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
# Editor aus globaler Config lesen
local editor=$(jq -r '.editor' "$GLOBAL_CONFIG")
@@ -736,7 +770,7 @@ project_overview() {
load_project_config "$config_file"
while true; do
choice=$(whiptail --title "Projektuebersicht: $project" --menu "Parameter:" 20 70 10 \
choice=$(dialog --title "Projektuebersicht: $project" --menu "Parameter:" 20 70 10 \
"1" "Registry: $registry" \
"2" "Image-Name: $image_name" \
"3" "Architekturen: $architectures" \
@@ -764,14 +798,14 @@ project_overview() {
# Projektauswahl fuer Image-Bauen
select_project_for_build() {
local projects=($(ls "$PROJECT_CONFIG_DIR"))
[ ${#projects[@]} -eq 0 ] && { whiptail --msgbox "Keine Projekte vorhanden." 10 60; return; }
[ ${#projects[@]} -eq 0 ] && { dialog --msgbox "Keine Projekte vorhanden." 10 60; return; }
menu_list=()
for p in "${projects[@]}"; do
menu_list+=("$p" "Projekt")
done
project=$(whiptail --title "Projekt auswaehlen" --menu "Bitte Projekt auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
project=$(dialog --title "Projekt auswaehlen" --menu "Bitte Projekt auswaehlen:" 20 60 10 "${menu_list[@]}" 3>&1 1>&2 2>&3) || return
project_overview "$project"
}
@@ -785,7 +819,7 @@ image_build_menu() {
# -------------------------
main_menu() {
while true; do
choice=$(whiptail --title "Image Builder" --menu "Bitte waehlen:" 20 70 10 \
choice=$(dialog --title "Image Builder" --menu "Bitte waehlen:" 20 70 10 \
1 "Konfiguration" \
2 "Projektverwaltung" \
3 "Registryverwaltung" \