Fix script hanging issues - Add comprehensive non-interactive mode
Major fixes for script reliability: Interactive Mode Issues: - Added NON_INTERACTIVE detection when run via curl | bash - Automatic defaults for config wizard in non-interactive mode - Sensible fallbacks for existing installation handling Potential Hang Points Fixed: - Non-interactive mode uses bootstrap node type by default - Placeholder Solana wallet for automated installs - Auto-update existing installations without prompts - Fixed log function definition order issue Error Handling Improvements: - Better network operation error handling - Cleaner function organization - Removed duplicate log function code Now supports both interactive and non-interactive usage modes safely.
This commit is contained in:
parent
63ab2d54ac
commit
ec3cca20aa
@ -22,11 +22,18 @@ RQLITE_NODE_PORT="5002"
|
||||
RAFT_BOOTSTRAP_PORT="7001"
|
||||
RAFT_NODE_PORT="7002"
|
||||
UPDATE_MODE=false
|
||||
NON_INTERACTIVE=false
|
||||
|
||||
log() {
|
||||
echo -e "${CYAN}[$(date '+%Y-%m-%d %H:%M:%S')]${NOCOLOR} $1"
|
||||
}
|
||||
|
||||
# Check if running non-interactively (piped from curl)
|
||||
if [ ! -t 0 ]; then
|
||||
NON_INTERACTIVE=true
|
||||
log "Running in non-interactive mode"
|
||||
fi
|
||||
|
||||
error() {
|
||||
echo -e "${RED}[ERROR]${NOCOLOR} $1"
|
||||
}
|
||||
@ -100,6 +107,12 @@ check_existing_installation() {
|
||||
log "Node service is currently running"
|
||||
fi
|
||||
|
||||
if [ "$NON_INTERACTIVE" = true ]; then
|
||||
log "Non-interactive mode: updating existing installation"
|
||||
UPDATE_MODE=true
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Existing installation detected!${NOCOLOR}"
|
||||
echo -e "${CYAN}Options:${NOCOLOR}"
|
||||
echo -e "${CYAN}1) Update existing installation${NOCOLOR}"
|
||||
@ -369,6 +382,18 @@ configuration_wizard() {
|
||||
log "${GREEN} DeBros Network Configuration Wizard ${NOCOLOR}"
|
||||
log "${BLUE}==================================================${NOCOLOR}"
|
||||
|
||||
if [ "$NON_INTERACTIVE" = true ]; then
|
||||
log "Non-interactive mode: using default configuration"
|
||||
NODE_TYPE="bootstrap"
|
||||
SOLANA_WALLET="11111111111111111111111111111111" # Placeholder wallet
|
||||
CONFIGURE_FIREWALL="yes"
|
||||
log "Node Type: $NODE_TYPE"
|
||||
log "Installation Directory: $INSTALL_DIR"
|
||||
log "Firewall Configuration: $CONFIGURE_FIREWALL"
|
||||
success "Configuration completed with defaults"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Node type selection
|
||||
while true; do
|
||||
echo -e "${GREEN}Select node type:${NOCOLOR}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user