#!/bin/bash # ============================================================================ # DarkForge Linux — Phase 3, Chapter 8: Master Batch 4 Runner # ============================================================================ # Purpose: Execute all 25 scripts from batch 4 (Chapter 8 final) in order. # Run this from inside the chroot. # Inputs: All 155-179 scripts present and executable # Outputs: Complete base system with all utilities installed # Assumes: Running inside chroot, Phase 0-3 earlier scripts complete # ============================================================================ set -euo pipefail source /sources/toolchain-scripts/100-chroot-env.sh echo "==========================================================================" echo "DarkForge Linux — Phase 3, Chapter 8: BATCH 4 EXECUTION" echo "==========================================================================" echo "" echo "This script will execute all 25 build scripts from batch 4 in sequence." echo "Each script builds one major package or group of packages." echo "" echo "Total build time: expect 30-60 minutes (depends on CPU speed)" echo "" read -p "Press Enter to continue, or Ctrl+C to abort... " dummy cd /sources/toolchain-scripts || { echo "ERROR: Cannot find scripts directory"; exit 1; } # Array of all scripts in execution order SCRIPTS=( "155-kmod.sh" "156-coreutils.sh" "157-diffutils.sh" "158-gawk.sh" "159-findutils.sh" "160-groff.sh" "161-gzip.sh" "162-iproute2.sh" "163-kbd.sh" "164-libpipeline.sh" "165-make.sh" "166-patch.sh" "167-tar.sh" "168-texinfo.sh" "169-vim.sh" "170-markupsafe.sh" "171-jinja2.sh" "172-eudev.sh" "173-man-db.sh" "174-procps-ng.sh" "175-util-linux.sh" "176-e2fsprogs.sh" "177-sysklogd.sh" "178-sysvinit.sh" "179-strip-and-cleanup.sh" ) SUCCESS_COUNT=0 FAIL_COUNT=0 FAILED_SCRIPTS=() echo "" echo "==========================================================================" echo "Starting batch 4 build sequence..." echo "==========================================================================" echo "" START_TIME=$(date +%s) for i in "${!SCRIPTS[@]}"; do SCRIPT="${SCRIPTS[$i]}" CURRENT=$((i + 1)) TOTAL=${#SCRIPTS[@]} if [ ! -f "$SCRIPT" ]; then echo "[ERROR] Script not found: $SCRIPT" FAILED_SCRIPTS+=("$SCRIPT (not found)") ((FAIL_COUNT++)) continue fi echo "" echo "------------------------------------------------------------------------" echo "[$CURRENT/$TOTAL] Running: $SCRIPT" echo "------------------------------------------------------------------------" if ./"$SCRIPT"; then echo "[SUCCESS] $SCRIPT completed" ((SUCCESS_COUNT++)) else echo "[FAILED] $SCRIPT exited with error code $?" FAILED_SCRIPTS+=("$SCRIPT") ((FAIL_COUNT++)) # Don't exit on error — continue to see all failures # (Or uncomment next line to stop on first failure) # exit 1 fi done END_TIME=$(date +%s) ELAPSED=$((END_TIME - START_TIME)) echo "" echo "==========================================================================" echo "BATCH 4 BUILD COMPLETE" echo "==========================================================================" echo "" echo "Build Summary:" echo " Total scripts: ${#SCRIPTS[@]}" echo " Successful: $SUCCESS_COUNT" echo " Failed: $FAIL_COUNT" echo " Elapsed time: $((ELAPSED / 60))m $((ELAPSED % 60))s" echo "" if [ $FAIL_COUNT -gt 0 ]; then echo "FAILED SCRIPTS:" for script in "${FAILED_SCRIPTS[@]}"; do echo " - $script" done echo "" echo "Please review the error messages above and rerun failed scripts individually." exit 1 else echo "All scripts completed successfully!" echo "" echo "Next steps:" echo " 1. Exit chroot (type 'exit' or press Ctrl+D)" echo " 2. Proceed with Phase 4 — Kernel Configuration" echo " 3. Then Phase 5 — Init System Configuration" echo "" fi