From 09c2308b353bb77408c82d7042bd602dbf5d625e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 24 Sep 2025 08:56:59 +0200 Subject: [PATCH] Update build.func --- misc/build.func | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/misc/build.func b/misc/build.func index 6a674cf3..a1e51531 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1522,27 +1522,47 @@ maybe_offer_save_app_defaults() { } ensure_storage_selection_for_vars_file() { - vf="$1" + local vf="$1" # Read stored values (if any) + local tpl ct tpl=$(grep -E '^var_template_storage=' "$vf" | cut -d= -f2-) ct=$(grep -E '^var_container_storage=' "$vf" | cut -d= -f2-) - # Template storage - if [ -n "$tpl" ]; then + # Wenn beide Werte schon existieren → übernehmen + if [[ -n "$tpl" && -n "$ct" ]]; then TEMPLATE_STORAGE="$tpl" - else - choose_and_set_storage_for_file "$vf" template - fi - - # Container storage - if [ -n "$ct" ]; then CONTAINER_STORAGE="$ct" - else - choose_and_set_storage_for_file "$vf" container + echo_storage_summary_from_file "$vf" + return 0 fi - echo_storage_summary_from_file "$vf" + # --- Erstmalige Auswahl: beide Abfragen --- + select_storage template + local tpl_sel="$STORAGE_RESULT" + + select_storage container + local ct_sel="$STORAGE_RESULT" + + # --- Zusammenfassung + Nachfrage --- + if whiptail --backtitle "Community Scripts" --title "Default Storage" \ + --yesno "Template-Storage --> $tpl_sel\nContainer-Storage --> $ct_sel\n\nSave as global defaults?" \ + 12 70; then + sed -i '/^[#[:space:]]*var_template_storage=/d' "$vf" + sed -i '/^[#[:space:]]*var_container_storage=/d' "$vf" + echo "var_template_storage=$tpl_sel" >>"$vf" + echo "var_container_storage=$ct_sel" >>"$vf" + else + sed -i '/^[#[:space:]]*var_template_storage=/d' "$vf" + sed -i '/^[#[:space:]]*var_container_storage=/d' "$vf" + echo "# var_template_storage=$tpl_sel" >>"$vf" + echo "# var_container_storage=$ct_sel" >>"$vf" + fi + + TEMPLATE_STORAGE="$tpl_sel" + CONTAINER_STORAGE="$ct_sel" + msg_ok "Using Template-Storage → $tpl_sel" + msg_ok "Using Container-Storage → $ct_sel" } diagnostics_menu() {