From f27f06f622b6575411e3919958f8aab1228efe2c Mon Sep 17 00:00:00 2001 From: Hadi Chokr Date: Thu, 23 Apr 2026 16:10:08 +0200 Subject: [PATCH] IMPORTANT, DROP THIS. --- build.sh | 58 ++++++++++++++++++++++++++++ mkosi.postinst.chroot | 89 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) diff --git a/build.sh b/build.sh index 308e28d..b386268 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,64 @@ set -ex +# TODO: REMOVE WHEN SYSTEMD STABLE GETS ISO9660 SUPPORT +#------------------------------------------------------------------------------------------------------------------------------------ +# --- Configuration --- +BUILDER_USER="aurbuilder" +AUR_PACKAGE="systemd-git" +WORK_DIR="/tmp/aur_build" + +# 1. Install build dependencies +pacman -Syu --noconfirm --needed base-devel git sudo + +# 2. Create temporary builder user with sudo (NOPASSWD) +if id "$BUILDER_USER" &>/dev/null; then + userdel -r -f "$BUILDER_USER" 2>/dev/null || true +fi +useradd -m -G wheel "$BUILDER_USER" +echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99-builder +chmod 440 /etc/sudoers.d/99-builder + +# 3. Prepare work directory +rm -rf "$WORK_DIR" +mkdir -p "$WORK_DIR" +chown "$BUILDER_USER:$BUILDER_USER" "$WORK_DIR" + +# 4. Build packages (but do NOT install yet) +su - "$BUILDER_USER" </dev/null || true + +echo ":: Removing existing stable systemd packages..." +stable_packages=$(pacman -Q | grep '^systemd' | grep -v '\-git' | grep -v 'systemd-bootchart' | cut -d' ' -f1 || true) +if [ -n "$stable_packages" ]; then + pacman -Rdd --noconfirm $stable_packages +fi + +# 6. Install the newly built packages +echo ":: Installing systemd-git packages..." +pacman -U --noconfirm "$WORK_DIR"/systemd-git/*.pkg.tar.zst + +# 7. Cleanup +userdel -r -f "$BUILDER_USER" 2>/dev/null || true +rm -f /etc/sudoers.d/99-builder +rm -rf "$WORK_DIR" + +echo ":: systemd-git installation completed successfully." +systemd-repart --version +systemd-repart --help | grep --color=always el-torito || echo "WARNING: --el-torito option not found!" + +cat /usr/lib/udev/rules.d/99-systemd.rules +#--------------------------------------------------------------------------------------------------------------------------------- + # Creates an archive containing the data from just the kde-linux-debug repository packages, # essentially the debug symbols for KDE apps, to be used as a sysext. make_debug_archive () { diff --git a/mkosi.postinst.chroot b/mkosi.postinst.chroot index 6888dbc..65a6a98 100755 --- a/mkosi.postinst.chroot +++ b/mkosi.postinst.chroot @@ -141,6 +141,95 @@ for theme in $(plymouth-set-default-theme --list); do fi done +# TODO: REMOVE WHEN SYSTEMD STABLE GETS ISO9660 SUPPORT +#------------------------------------------------------------------------------------------------------------------------------------ +# --- Configuration --- +mkdir -p /etc/pacman.d +BUILD_REPO=$(curl --fail --silent https://storage.kde.org/kde-linux-packages/testing/repo/build_repo.txt) +if [ -z "$BUILD_REPO" ]; then + echo "ERROR: Could not fetch build_repo.txt — refusing to build out-of-sync image." >&2 + exit 1 +fi +echo "Server = ${BUILD_REPO}/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist + +# Write a minimal pacman.conf that uses this mirrorlist +rm /etc/pacman.conf +cat > /etc/pacman.conf </dev/null; then + userdel -r -f "$BUILDER_USER" 2>/dev/null || true +fi +useradd -m -G wheel "$BUILDER_USER" +echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99-builder +chmod 440 /etc/sudoers.d/99-builder + +# 2. Prepare work directory +rm -rf "$WORK_DIR" +mkdir -p "$WORK_DIR" +chown "$BUILDER_USER:$BUILDER_USER" "$WORK_DIR" + +# 3. Build packages (but do NOT install yet) +su - "$BUILDER_USER" </dev/null || true + +echo ":: Removing existing stable systemd packages..." +stable_packages=$(pacman -Q | grep '^systemd' | grep -v '\-git' | grep -v 'systemd-bootchart' | cut -d' ' -f1 || true) +if [ -n "$stable_packages" ]; then + pacman -Rdd --noconfirm $stable_packages +fi + +# 5. Install the newly built packages +echo ":: Installing systemd-git packages..." +pacman -U --noconfirm "$WORK_DIR"/systemd-git/*.pkg.tar.zst + +# 6. Cleanup +userdel -r -f "$BUILDER_USER" 2>/dev/null || true +rm -f /etc/sudoers.d/99-builder +rm -rf "$WORK_DIR" + +echo ":: systemd-git installation completed successfully." +systemd-repart --version +systemd-repart --help | grep --color=always el-torito || echo "WARNING: --el-torito option not found!" +cat /usr/lib/udev/rules.d/99-systemd.rules +#--------------------------------------------------------------------------------------------------------------------------------- + cd /tmp /usr/lib/rebuild-efi mv -v ./*.efi /