Files
darkforge/toolchain/scripts/031-cleanup.sh
Danny 029642ae5b Initial commit: DarkForge Linux — Phases 0-12
Complete from-scratch Linux distribution targeting AMD Ryzen 9 9950X3D +
NVIDIA RTX 5090 on ASUS ROG CROSSHAIR X870E HERO.

Deliverables:
- dpack: custom package manager in Rust (3,800 lines)
  - TOML package parser, dependency resolver, build sandbox
  - CRUX Pkgfile and Gentoo ebuild converters
  - Shared library conflict detection
- 124 package definitions across 4 repos (core/extra/desktop/gaming)
- 34 toolchain bootstrap scripts (LFS 13.0 adapted for Zen 5)
- Linux 6.19.8 kernel config (hardware-specific, fully commented)
- SysVinit init system with rc.d service scripts
- Live ISO builder (UEFI-only, squashfs+xorriso)
- Interactive installer (GPT partitioning, EFISTUB boot)
- Integration test checklist (docs/TESTING.md)

No systemd. No bootloader. No display manager.
Kernel boots via EFISTUB → auto-login → dwl Wayland compositor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 11:30:40 +01:00

69 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# DarkForge Linux — Phase 0, Chapter 7: Cleanup Temporary Tools
# ============================================================================
# Purpose: Clean up the temporary toolchain now that we have native tools
# in the chroot. Remove documentation, static libraries, and the
# cross-compiler tools directory.
# Inputs: None
# Outputs: Cleaned filesystem, removed /tools
# Assumes: Running inside chroot, all chroot builds (024-030) complete
# Ref: LFS 13.0 §7.13
# ============================================================================
set -euo pipefail
echo "=== DarkForge: Cleaning up temporary tools ==="
# Remove documentation installed by temporary packages
rm -rf /usr/share/{info,man,doc}/*
# Remove libtool .la files (they cause problems in final builds)
find /usr/{lib,libexec} -name \*.la -delete 2>/dev/null || true
# Remove the cross-compiler toolchain directory
# We no longer need it — native compiler is in /usr/bin/gcc
rm -rf /tools
echo "=== Cleanup complete ==="
echo ""
echo ">>> PHASE 0 COMPLETE!"
echo ""
echo "The chroot environment now has:"
echo " - Native GCC ${GCC_VERSION:-15.2.0} compiler"
echo " - GNU binutils"
echo " - glibc"
echo " - Bash, coreutils, make, and essential build tools"
echo " - Perl, Python 3, bison, gettext, texinfo"
echo " - util-linux"
echo ""
echo "Exit criteria check: Can we compile a Hello World?"
echo ""
# --- Exit criteria test -------------------------------------------------------
cat > /tmp/hello.c << 'EOF'
#include <stdio.h>
int main(void) {
printf("DarkForge Linux: Phase 0 toolchain bootstrap successful!\n");
return 0;
}
EOF
echo "Compiling test program..."
gcc -o /tmp/hello /tmp/hello.c
echo "Running test program..."
/tmp/hello
# Verify the binary is dynamically linked to our glibc
echo ""
echo "Binary details:"
file /tmp/hello
ldd /tmp/hello
# Cleanup test
rm -f /tmp/hello /tmp/hello.c
echo ""
echo ">>> Phase 0 exit criteria: PASSED"
echo ">>> Ready to proceed to Phase 1 (dpack core)."