@@ -459,7 +459,11 @@ check_installation_status_and_determine_action() {
459459 cd ..
460460
461461 if [ " $INSTALL_MODE " = " uptodate" ]; then
462- if [ -n " $SPECIFIED_VERSION_TAG " ] && [ " $SPECIFIED_VERSION_TAG " != " $current_tag " ]; then
462+ if [ -n " $MODE_UPDATE " ]; then
463+ # In non-interactive mode, skip if up to date
464+ print_info " Pulse is already up-to-date. Skipping update."
465+ INSTALL_MODE=" cancel"
466+ elif [ -n " $SPECIFIED_VERSION_TAG " ] && [ " $SPECIFIED_VERSION_TAG " != " $current_tag " ]; then
463467 print_info " You requested version $SPECIFIED_VERSION_TAG , but $current_tag is installed."
464468 echo -e " Choose an action:"
465469 echo -e " 1) Manage automatic updates"
@@ -475,44 +479,57 @@ check_installation_status_and_determine_action() {
475479 * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
476480 esac
477481 elif [ -n " $SPECIFIED_BRANCH " ]; then
478- echo -e " Choose an action:"
479- echo -e " 1) Install branch $SPECIFIED_BRANCH (for testing)"
480- echo -e " 2) Remove Pulse"
481- echo -e " 3) Cancel"
482- echo -e " 4) Manage automatic updates"
483- read -p " Enter your choice [1-4]: " user_choice
484- case $user_choice in
485- 1) INSTALL_MODE=" update" ;;
486- 2) INSTALL_MODE=" remove" ;;
487- 3) INSTALL_MODE=" cancel" ;;
488- 4) prompt_for_cron_setup; INSTALL_MODE=" cancel" ;;
489- * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
490- esac
482+ if [ -n " $MODE_UPDATE " ]; then
483+ # In non-interactive mode, proceed with branch update
484+ INSTALL_MODE=" update"
485+ else
486+ echo -e " Choose an action:"
487+ echo -e " 1) Install branch $SPECIFIED_BRANCH (for testing)"
488+ echo -e " 2) Remove Pulse"
489+ echo -e " 3) Cancel"
490+ echo -e " 4) Manage automatic updates"
491+ read -p " Enter your choice [1-4]: " user_choice
492+ case $user_choice in
493+ 1) INSTALL_MODE=" update" ;;
494+ 2) INSTALL_MODE=" remove" ;;
495+ 3) INSTALL_MODE=" cancel" ;;
496+ 4) prompt_for_cron_setup; INSTALL_MODE=" cancel" ;;
497+ * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
498+ esac
499+ fi
491500 else
492- echo -e " Choose an action:"
493- echo -e " 1) Manage automatic updates"
494- echo -e " 2) Re-install current version $current_tag "
495- echo -e " 3) Test a feature branch"
496- echo -e " 4) Remove Pulse"
497- echo -e " 5) Cancel"
498- read -p " Enter your choice [1-5]: " user_choice
499- case $user_choice in
500- 1) prompt_for_cron_setup; INSTALL_MODE=" cancel" ;;
501- 2) INSTALL_MODE=" update" ;;
502- 3)
503- if prompt_for_branch_selection; then
504- INSTALL_MODE=" update"
505- else
506- INSTALL_MODE=" cancel"
507- fi
508- ;;
509- 4) INSTALL_MODE=" remove" ;;
510- 5) INSTALL_MODE=" cancel" ;;
511- * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
512- esac
501+ if [ -n " $MODE_UPDATE " ]; then
502+ # In non-interactive mode, re-install if explicitly requested
503+ INSTALL_MODE=" update"
504+ else
505+ echo -e " Choose an action:"
506+ echo -e " 1) Manage automatic updates"
507+ echo -e " 2) Re-install current version $current_tag "
508+ echo -e " 3) Test a feature branch"
509+ echo -e " 4) Remove Pulse"
510+ echo -e " 5) Cancel"
511+ read -p " Enter your choice [1-5]: " user_choice
512+ case $user_choice in
513+ 1) prompt_for_cron_setup; INSTALL_MODE=" cancel" ;;
514+ 2) INSTALL_MODE=" update" ;;
515+ 3)
516+ if prompt_for_branch_selection; then
517+ INSTALL_MODE=" update"
518+ else
519+ INSTALL_MODE=" cancel"
520+ fi
521+ ;;
522+ 4) INSTALL_MODE=" remove" ;;
523+ 5) INSTALL_MODE=" cancel" ;;
524+ * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
525+ esac
526+ fi
513527 fi
514528 elif [ " $INSTALL_MODE " = " update" ]; then
515- if [ -n " $SPECIFIED_VERSION_TAG " ]; then
529+ if [ -n " $MODE_UPDATE " ]; then
530+ # In non-interactive mode, proceed with update
531+ : # Do nothing, keep INSTALL_MODE as "update"
532+ elif [ -n " $SPECIFIED_VERSION_TAG " ]; then
516533 echo " Choose an action:"
517534 echo " 1) Install specified version $SPECIFIED_VERSION_TAG "
518535 echo " 2) Remove Pulse"
@@ -581,23 +598,28 @@ check_installation_status_and_determine_action() {
581598 print_info " Will attempt to install from branch: $TARGET_BRANCH "
582599 INSTALL_MODE=" install"
583600 else
584- echo " Choose an action:"
585- echo " 1) Install Pulse [latest version]"
586- echo " 2) Test a feature branch"
587- echo " 3) Cancel"
588- read -p " Enter your choice [1-3]: " user_choice
589- case $user_choice in
590- 1) INSTALL_MODE=" install" ;;
591- 2)
592- if prompt_for_branch_selection; then
593- INSTALL_MODE=" install"
594- else
595- INSTALL_MODE=" cancel"
596- fi
597- ;;
598- 3) INSTALL_MODE=" cancel" ;;
599- * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
600- esac
601+ if [ -n " $MODE_UPDATE " ]; then
602+ # In non-interactive mode, install latest version
603+ INSTALL_MODE=" install"
604+ else
605+ echo " Choose an action:"
606+ echo " 1) Install Pulse [latest version]"
607+ echo " 2) Test a feature branch"
608+ echo " 3) Cancel"
609+ read -p " Enter your choice [1-3]: " user_choice
610+ case $user_choice in
611+ 1) INSTALL_MODE=" install" ;;
612+ 2)
613+ if prompt_for_branch_selection; then
614+ INSTALL_MODE=" install"
615+ else
616+ INSTALL_MODE=" cancel"
617+ fi
618+ ;;
619+ 3) INSTALL_MODE=" cancel" ;;
620+ * ) print_error " Invalid choice." ; INSTALL_MODE=" error" ;;
621+ esac
622+ fi
601623 fi
602624 fi
603625}
0 commit comments