diff --git a/manage.sh.new b/manage.sh.new index 6daec72c..5169b88b 100755 --- a/manage.sh.new +++ b/manage.sh.new @@ -399,24 +399,49 @@ do_upgrade() { branch=$(cd "$CLONE_DIR" && git rev-parse --abbrev-ref HEAD 2>/dev/null) || branch="$DEFAULT_BRANCH" fi - # Confirm - if ! ask_yes_no "Confirm Upgrade" "\nThis will upgrade:\n• pyMC_Repeater ($branch branch)\n• pyMC Console dashboard\n\nYour configuration will be preserved.\n\nContinue?"; then + # Component selection checklist + local choices + choices=$($DIALOG --backtitle "pyMC Console" --title "Select Components" \ + --checklist "\nSelect what to upgrade:\n\nYour configuration will be preserved." 14 55 2 \ + "console" "pyMC Console dashboard" ON \ + "repeater" "pyMC_Repeater ($branch)" ON \ + 3>&1 1>&2 2>&3) || return 0 + + local upgrade_console=false + local upgrade_repeater=false + [[ "$choices" == *"console"* ]] && upgrade_console=true + [[ "$choices" == *"repeater"* ]] && upgrade_repeater=true + + # Nothing selected + if [[ "$upgrade_console" == false && "$upgrade_repeater" == false ]]; then + show_info "Nothing Selected" "No components selected for upgrade." return 0 fi print_banner - # Step 1: Update clone - print_step 1 3 "Updating pyMC_Repeater" - clone_upstream "$branch" + # Calculate steps + local step=1 + local total=0 + [[ "$upgrade_repeater" == true ]] && ((total+=2)) # clone + upgrade + [[ "$upgrade_console" == true ]] && ((total++)) - # Step 2: Run upstream upgrade - print_step 2 3 "Upgrading pyMC_Repeater" - run_upstream "upgrade" || return 1 + # Upgrade Repeater if selected + if [[ "$upgrade_repeater" == true ]]; then + print_step $step $total "Updating pyMC_Repeater source" + clone_upstream "$branch" + ((step++)) + + print_step $step $total "Upgrading pyMC_Repeater" + run_upstream "upgrade" || return 1 + ((step++)) + fi - # Step 3: Update dashboard (files only, web_path preserved) - print_step 3 3 "Updating dashboard" - install_dashboard + # Upgrade Console if selected + if [[ "$upgrade_console" == true ]]; then + print_step $step $total "Updating dashboard" + install_dashboard + fi # Done local ip=$(hostname -I 2>/dev/null | awk '{print $1}')