#!/bin/bash # ============================================================================ # DarkForge Linux โ€” Phase 3, Chapter 8.29: Shadow # ============================================================================ # Purpose: Build Shadow, which provides tools for user and group management: # useradd, userdel, usermod, passwd, su, login, etc. # CRITICAL: Disable systemd support โ€” we use SysVinit only. # Inputs: /sources/shadow-4.17.4.tar.xz # libxcrypt already installed # Outputs: User/group management tools in /usr/bin, /usr/sbin, /etc/default # Ref: LFS 13.0 ยง8.29 # Notes: NO systemd-enable, NO logind, NO PAM modules for systemd # ============================================================================ set -euo pipefail source /sources/toolchain-scripts/100-chroot-env.sh PACKAGE="shadow" VERSION="4.17.4" echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) โ€” SysVinit ONLY ===" pkg_extract "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" # Disable systemd and nls (language support) # Use traditional shadow files, not systemd-homed sed -i 's/^\t#\(ENCRYPT_METHOD\)/\1/' etc/default/useradd.in sed -i 's/^ENCRYPT_METHOD.*/ENCRYPT_METHOD SHA512/' etc/default/useradd.in # Configure shadow for traditional SysVinit system # --disable-nls: no i18n for now # --with-libcrypt=xcrypt: use libxcrypt for password hashing # --disable-man: we'll handle man pages separately ./configure \ --sysconfdir=/etc \ --with-libcrypt=xcrypt \ --disable-nls \ --without-libpam make make install # Verify that systemd is not included if grep -q "systemd" /etc/default/useradd; then echo "[ERROR] Shadow was built with systemd references!" exit 1 fi echo "Shadow version: $(/usr/bin/useradd --version 2>&1 | head -1)" cd "${SRCDIR}" pkg_cleanup "${PACKAGE}-${VERSION}" echo "=== ${PACKAGE}-${VERSION} complete (SysVinit mode) ==="