Files
darkforge/toolchain/scripts/100-download-phase3.sh
2026-03-20 15:09:30 +01:00

142 lines
7.0 KiB
Bash

#!/bin/bash
# ============================================================================
# DarkForge Linux — Phase 3: Download Additional Source Tarballs
# ============================================================================
# Purpose: Download packages needed for Chapter 8 (full base system) that
# were not already downloaded in Phase 0.
# Inputs: Running inside chroot or on host with $LFS set
# Outputs: Additional source tarballs in /sources/ (chroot) or $LFS/sources/
# Updated: 2026-03-21
# ============================================================================
set -euo pipefail
# Detect if we're in chroot (/ is the LFS root) or on host
if [ -f /sources/darkforge-env.sh ]; then
SRCDIR="/sources"
else
LFS="${LFS:-/mnt/darkforge}"
SRCDIR="${LFS}/sources"
fi
GNU_MIRROR="http://ftp.klid.dk/ftp/gnu"
cd "${SRCDIR}"
echo "=== DarkForge Phase 3: Downloading additional source tarballs ==="
download() {
local url="$1"
local filename="${2:-$(basename "${url}")}"
if [ -f "${filename}" ]; then
echo " [SKIP] ${filename}"
return 0
fi
echo " [GET] ${filename}"
wget --no-verbose --continue "${url}" -O "${filename}" || {
echo " [FAIL] ${filename} — trying curl"
curl -fLo "${filename}" "${url}" || {
echo " [ERROR] Failed: ${filename}"
return 1
}
}
}
# ==============================================================================
# Packages NOT in Phase 0 download list
# ==============================================================================
echo ">>> IANA-Etc (protocol/service definitions)..."
download "https://github.com/Mic92/iana-etc/releases/download/20250306/iana-etc-20250306.tar.gz"
echo ">>> Compression libraries..."
download "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
download "https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz"
echo ">>> Libraries..."
download "${GNU_MIRROR}/readline/readline-8.3.tar.gz"
download "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.tar.bz2"
download "https://github.com/besser82/libxcrypt/releases/download/v4.4.38/libxcrypt-4.4.38.tar.xz"
download "https://savannah.nongnu.org/download/attr/attr-2.5.2.tar.gz"
download "https://savannah.nongnu.org/download/acl/acl-2.3.2.tar.xz"
download "https://kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.76.tar.xz"
download "https://sourceware.org/elfutils/ftp/0.192/elfutils-0.192.tar.bz2"
download "https://github.com/libffi/libffi/releases/download/v3.4.7/libffi-3.4.7.tar.gz"
download "https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.xz"
download "https://savannah.nongnu.org/download/libpipeline/libpipeline-1.5.8.tar.gz"
echo ">>> Build tools..."
download "https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz"
download "https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.4.3.tar.gz" "pkgconf-2.4.3.tar.gz"
download "${GNU_MIRROR}/bc/bc-7.0.3.tar.xz"
download "${GNU_MIRROR}/autoconf/autoconf-2.72.tar.xz"
download "${GNU_MIRROR}/automake/automake-1.17.tar.xz"
download "${GNU_MIRROR}/libtool/libtool-2.5.4.tar.xz"
download "https://github.com/ninja-build/ninja/archive/v1.12.1/ninja-1.12.1.tar.gz"
download "https://github.com/mesonbuild/meson/releases/download/1.7.0/meson-1.7.0.tar.gz"
download "https://cmake.org/files/v3.31/cmake-3.31.6.tar.gz"
download "${GNU_MIRROR}/intltool/intltool-0.51.0.tar.gz"
echo ">>> Test frameworks..."
download "https://downloads.sourceforge.net/tcl/tcl8.6.16-src.tar.gz"
download "https://downloads.sourceforge.net/expect/expect5.45.4.tar.gz"
download "${GNU_MIRROR}/dejagnu/dejagnu-1.6.3.tar.gz"
echo ">>> Security and crypto..."
download "https://github.com/openssl/openssl/releases/download/openssl-3.5.0/openssl-3.5.0.tar.gz"
download "https://github.com/shadow-maint/shadow/releases/download/4.17.4/shadow-4.17.4.tar.xz"
echo ">>> Database and XML..."
download "${GNU_MIRROR}/gdbm/gdbm-1.24.tar.gz"
download "${GNU_MIRROR}/gperf/gperf-3.1.tar.gz"
download "https://www.sqlite.org/2025/sqlite-autoconf-3490100.tar.gz"
download "https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.47.tar.gz"
echo ">>> Python packages..."
download "https://pypi.org/packages/source/f/flit-core/flit_core-3.11.0.tar.gz"
download "https://pypi.org/packages/source/p/packaging/packaging-25.0.tar.gz"
download "https://pypi.org/packages/source/w/wheel/wheel-0.45.1.tar.gz"
download "https://pypi.org/packages/source/s/setuptools/setuptools-78.1.0.tar.gz"
download "https://pypi.org/packages/source/M/MarkupSafe/markupsafe-3.0.2.tar.gz"
download "https://pypi.org/packages/source/J/Jinja2/jinja2-3.1.6.tar.gz"
echo ">>> System utilities..."
download "https://ftp.isc.org/isc/dhcp/4.4.3-P1/dhcp-4.4.3-P1.tar.gz" 2>/dev/null || true
download "${GNU_MIRROR}/inetutils/inetutils-2.6.tar.xz"
download "https://mirrors.edge.kernel.org/pub/linux/utils/kbd/kbd-2.7.1.tar.xz"
download "https://mirrors.edge.kernel.org/pub/linux/utils/kernel/kmod/kmod-34.tar.xz"
download "${GNU_MIRROR}/less/less-668.tar.gz"
download "${GNU_MIRROR}/groff/groff-1.23.0.tar.gz"
download "https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2/iproute2-6.13.0.tar.xz"
download "https://github.com/termux/procps/releases/download/v4.0.5/procps-ng-4.0.5.tar.xz" 2>/dev/null || \
download "https://sourceforge.net/projects/procps-ng/files/Production/procps-ng-4.0.5.tar.xz"
download "https://github.com/psmisc/psmisc/releases/download/v23.7/psmisc-23.7.tar.xz"
download "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.40/util-linux-2.40.4.tar.xz" 2>/dev/null || true
download "https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.2/e2fsprogs-1.47.2.tar.gz"
echo ">>> Init and logging..."
download "https://github.com/slicer69/sysklogd/releases/download/v2.7.0/sysklogd-2.7.0.tar.gz"
download "https://github.com/slicer69/sysvinit/releases/download/3.14/sysvinit-3.14.tar.xz"
echo ">>> eudev (udev without systemd)..."
download "https://github.com/eudev-project/eudev/releases/download/v3.2.14/eudev-3.2.14.tar.gz"
echo ">>> Documentation..."
download "https://download.savannah.gnu.org/releases/man-db/man-db-2.13.0.tar.xz"
download "https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-6.12.tar.xz"
echo ">>> Editor..."
download "https://github.com/vim/vim/archive/v9.1.1166/vim-9.1.1166.tar.gz"
echo ">>> Patches..."
download "https://www.linuxfromscratch.org/patches/lfs/13.0/bzip2-1.0.8-install_docs-1.patch"
download "https://www.linuxfromscratch.org/patches/lfs/13.0/coreutils-9.10-i18n-1.patch"
download "https://www.linuxfromscratch.org/patches/lfs/13.0/expect-5.45.4-gcc15-1.patch"
download "https://www.linuxfromscratch.org/patches/lfs/13.0/kbd-2.9.0-backspace-1.patch" 2>/dev/null || true
download "https://www.linuxfromscratch.org/patches/lfs/13.0/sysvinit-3.14-consolidated-1.patch"
echo ""
echo "=== Phase 3 downloads complete ==="
FILECOUNT=$(ls -1 "${SRCDIR}/"*.{tar.*,patch,gz,xz,bz2} 2>/dev/null | wc -l)
echo "${FILECOUNT} total files in ${SRCDIR}/"