Files
Das-OS/scripts/container/build-packages.sh
T
dasandClaude Opus 5.5 eba4516998 Stage 6: server image with a console installer (0.4.0)
- server/ profile and build-iso.sh [desktop|server]; make iso-server,
  make qemu-server, run-qemu.sh --serial; login on tty and ttyS0
- das-server: SSH, chrony, NetworkManager/dhcpcd, Docker with Compose,
  nftables (closed except SSH, own table), fail2ban reading socklog,
  sshd without root passwords, Docker log rotation, tools
- das-server-install: dialog installer in Ukrainian and English, or
  unattended with --config; GPT + Btrfs subvolumes, GRUB for UEFI and BIOS,
  serial console, SSH key with optional keys-only logins
- das-install-common: mount-source and postinstall shared with Calamares
- dsv: runit service manager (list, enable, disable, start, stop,
  restart, status, logs) with bash completion, also on the desktop
- das-update split into a subpackage without GTK; the window and tray
  icon move to /usr/libexec/das/das-update-gui
- das-snapper-setup enables dbus, which snapper needs
- TODO: ISO size review with measured numbers and options

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 21:28:26 +03:00

68 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds every template in srcpkgs/ with xbps-src into the local repository
# out/hostdir/binpkgs. Runs inside the builder container, see scripts/builder.sh.
#
# xbps-src needs the whole void-packages tree (build styles, shared hooks), so our
# templates are overlaid onto a shallow clone of it in out/void-packages.
set -euo pipefail
vp=/work/out/void-packages
hostdir=/work/out/hostdir
# xbps-src refuses to run as root. Like Void's own CI, build as an unprivileged
# member of xbuilder (allowed to use xbps-uchroot); the host's UID keeps out/ owned by the user.
useradd --uid "$HOST_UID" --groups xbuilder --no-create-home builder
as_builder() {
sudo --preserve-env=HOME -u builder "$@"
}
export HOME=/tmp
mkdir -p "$hostdir"
chown "$HOST_UID:$HOST_GID" /work/out "$hostdir"
if [[ -d $vp/.git ]]; then
echo "==> Updating void-packages"
as_builder git -C "$vp" fetch --quiet --depth 1 origin master
as_builder git -C "$vp" reset --quiet --hard FETCH_HEAD
as_builder git -C "$vp" clean --quiet -fd srcpkgs
else
echo "==> Cloning void-packages"
as_builder git clone --quiet --depth 1 https://github.com/void-linux/void-packages "$vp"
fi
cat > "$vp/etc/conf" <<CONF
XBPS_CHROOT_CMD=uchroot
XBPS_MAKEJOBS=$(nproc)
CONF
names=()
for dir in /work/srcpkgs/*/; do
name=$(basename "$dir")
if git -C "$vp" cat-file -e "HEAD:srcpkgs/$name/template" 2>/dev/null; then
echo "warning: $name is now in void-packages, consider dropping our template" >&2
fi
rm -rf "$vp/srcpkgs/$name"
# A subpackage is a link to its source package's directory and is built with it
if [[ -L ${dir%/} ]]; then
as_builder ln -s "$(readlink "${dir%/}")" "$vp/srcpkgs/$name"
continue
fi
as_builder cp -rL "$dir" "$vp/srcpkgs/$name"
names+=("$name")
done
cd "$vp"
# The bootstrapped masterdir stays in out/void-packages, so later builds skip this step
if [[ ! -f masterdir-x86_64/.xbps_chroot_init ]]; then
as_builder ./xbps-src -H "$hostdir" binary-bootstrap
fi
# A failed build leaves its destdir behind, and the next build of that package
# (also as a dependency of another one) would package the stale files
rm -rf masterdir-x86_64/destdir/*
for name in "${names[@]}"; do
echo "==> Building $name"
as_builder ./xbps-src -H "$hostdir" -f pkg "$name"
done
echo "==> Repository: $hostdir/binpkgs"
ls -1 "$hostdir"/binpkgs/*.xbps