fix: auto-install when profile specified via command line
Problem: - Running 'curl ... | bash -s core' showed preview and waited for input - User had to press Y to proceed even though profile was specified - Defeats the purpose of one-command installation Solution: - Add NON_INTERACTIVE flag to track command-line profile usage - Set NON_INTERACTIVE=true when profile argument provided - Skip confirmation prompt when NON_INTERACTIVE=true - Show 'Installing automatically (profile specified)...' message Behavior: Before: curl ... | bash -s core → Shows preview, waits for Y/n input After: curl ... | bash -s core → Shows preview, installs automatically Interactive mode still works: bash install.sh → Shows menu, asks for confirmation (as expected) This makes profile-based installation truly one-command with no interaction needed.
This commit is contained in:
parent
a9f119e83e
commit
532e17ce01
1 changed files with 18 additions and 6 deletions
24
install.sh
24
install.sh
|
|
@ -55,6 +55,7 @@ TEMP_DIR="/tmp/opencode-installer-$$"
|
||||||
SELECTED_COMPONENTS=()
|
SELECTED_COMPONENTS=()
|
||||||
INSTALL_MODE=""
|
INSTALL_MODE=""
|
||||||
PROFILE=""
|
PROFILE=""
|
||||||
|
NON_INTERACTIVE=false
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Utility Functions
|
# Utility Functions
|
||||||
|
|
@ -498,14 +499,21 @@ show_installation_preview() {
|
||||||
[ ${#configs[@]} -gt 0 ] && echo -e "${CYAN}Config (${#configs[@]}):${NC} ${configs[*]##*:}"
|
[ ${#configs[@]} -gt 0 ] && echo -e "${CYAN}Config (${#configs[@]}):${NC} ${configs[*]##*:}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Proceed with installation? [Y/n]: " confirm
|
|
||||||
|
|
||||||
if [[ $confirm =~ ^[Nn] ]]; then
|
# Skip confirmation if profile was provided via command line
|
||||||
print_info "Installation cancelled"
|
if [ "$NON_INTERACTIVE" = true ]; then
|
||||||
cleanup_and_exit 0
|
print_info "Installing automatically (profile specified)..."
|
||||||
|
perform_installation
|
||||||
|
else
|
||||||
|
read -p "Proceed with installation? [Y/n]: " confirm
|
||||||
|
|
||||||
|
if [[ $confirm =~ ^[Nn] ]]; then
|
||||||
|
print_info "Installation cancelled"
|
||||||
|
cleanup_and_exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
perform_installation
|
||||||
fi
|
fi
|
||||||
|
|
||||||
perform_installation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
@ -808,18 +816,22 @@ main() {
|
||||||
core|--core)
|
core|--core)
|
||||||
INSTALL_MODE="profile"
|
INSTALL_MODE="profile"
|
||||||
PROFILE="core"
|
PROFILE="core"
|
||||||
|
NON_INTERACTIVE=true
|
||||||
;;
|
;;
|
||||||
developer|--developer)
|
developer|--developer)
|
||||||
INSTALL_MODE="profile"
|
INSTALL_MODE="profile"
|
||||||
PROFILE="developer"
|
PROFILE="developer"
|
||||||
|
NON_INTERACTIVE=true
|
||||||
;;
|
;;
|
||||||
full|--full)
|
full|--full)
|
||||||
INSTALL_MODE="profile"
|
INSTALL_MODE="profile"
|
||||||
PROFILE="full"
|
PROFILE="full"
|
||||||
|
NON_INTERACTIVE=true
|
||||||
;;
|
;;
|
||||||
advanced|--advanced)
|
advanced|--advanced)
|
||||||
INSTALL_MODE="profile"
|
INSTALL_MODE="profile"
|
||||||
PROFILE="advanced"
|
PROFILE="advanced"
|
||||||
|
NON_INTERACTIVE=true
|
||||||
;;
|
;;
|
||||||
list|--list)
|
list|--list)
|
||||||
check_dependencies
|
check_dependencies
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue