diff --git a/setup.sh b/setup.sh index 6c7184d..fb9817d 100644 --- a/setup.sh +++ b/setup.sh @@ -2,9 +2,7 @@ # setup.sh - Main dotfiles setup orchestrator # Runs all numbered scripts in sequence -# Temporarily disable strict mode for debugging -# set -euo pipefail -set -e +set -euo pipefail # Get the absolute path to the directory containing this script # This handles symlinks and relative paths to always find the dotfiles root @@ -25,49 +23,27 @@ log_info "Working directory: $DOTFILES_DIR" if [ -d "$DOTFILES_DIR/scripts" ]; then log_info "Running setup scripts..." - # Look for numbered scripts and run them in order script_count=0 - # Get list of numbered scripts, sorted - script_files=$(find "$DOTFILES_DIR/scripts" -name '[0-9][0-9]-*.sh' -type f | sort) - - echo "DEBUG: script_files found:" - echo "$script_files" - echo "DEBUG: Starting loop..." - - for script in $script_files; do - echo "DEBUG: Processing script: '$script'" - if [ -f "$script" ]; then - script_name=$(basename "$script") - log_info "Running $script_name..." - - echo "DEBUG: About to run: bash '$script' '$DOTFILES_DIR'" - bash "$script" "$DOTFILES_DIR" - exit_code=$? - echo "DEBUG: Script exited with code: $exit_code" - - if [ $exit_code -eq 0 ]; then - log_success "✓ $script_name completed" - echo "DEBUG: Script '$script_name' completed successfully" - else - log_error "✗ $script_name failed" - exit 1 - fi - - ((script_count++)) - echo "DEBUG: script_count is now: $script_count" + # Find all numbered scripts and run them in order + find "$DOTFILES_DIR/scripts" -name '[0-9][0-9]-*.sh' -type f | sort | while read -r script; do + script_name=$(basename "$script") + log_info "Running $script_name..." + + if bash "$script" "$DOTFILES_DIR"; then + log_success "✓ $script_name completed" else - echo "DEBUG: '$script' is not a file" + log_error "✗ $script_name failed" + exit 1 fi - echo "DEBUG: End of loop iteration for '$script'" + + ((script_count++)) done - echo "DEBUG: Loop completed. Final script_count: $script_count" - if [ $script_count -eq 0 ]; then log_warning "No numbered scripts found in scripts/ directory" else - log_success "Completed $script_count setup script(s)" + log_success "Completed setup scripts" fi else log_error "No scripts directory found! Something went wrong with the installation."