Files
Das-OS/scripts/container/build-iso.sh
T
dasandClaude Opus 5.5 a2bffc7fe9
build / build (push) Successful in 38m26s
Terminal: Das prompt, dprompt and dbanner (0.9.1)
- das-shell 0.1.0: the Das two-line bash prompt by default (replaces the
  PS1 of Void's skel .bashrc once), dprompt (Textual prompt builder with
  presets and live preview) and dbanner (SSH login banner editor: canvas
  tools, fields with values, widgets, das-banner service for cached ones,
  Das OS logo and tryzub pictures). Python tests in make test.
- das-server 0.3.0 depends on das-shell; the server installer mentions
  dprompt and dbanner; the desktop image includes it.
- run-qemu.sh forwards the guest's SSH to localhost:2222.
- Hardware fixes: Ventoy menu icon, boot menu titles "Das OS <version>".

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

132 lines
5.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds a Das OS live ISO with void-mklive from a profile directory:
# build-iso.sh the desktop image from live/
# build-iso.sh server the console server image from server/
# Runs inside the builder container, see scripts/builder.sh.
set -euo pipefail
profile=${1:-desktop}
ignore=""
repo=/work/out/hostdir/binpkgs
version=$(< /work/VERSION)
case $profile in
desktop)
dir=/work/live
iso=/work/out/iso/dasos-${version}-x86_64.iso
title="Das OS"
locale=uk_UA.UTF-8
cmdline="live.user=live quiet loglevel=3"
;;
server)
dir=/work/server
iso=/work/out/iso/dasos-server-${version}-x86_64.iso
title="Das OS Server"
locale=en_US.UTF-8
# Both consoles: a screen and a serial line (IPMI, VPS consoles, QEMU -nographic).
# mklive starts a login on ttyS0 when it sees console=ttyS0.
cmdline="live.user=live loglevel=4 console=tty0 console=ttyS0,115200"
# das-server keeps these packages out of the installed system; the image
# is built before das-server is installed, so tell mklive as well
ignore=$(sed -n 's/^ignorepkg=//p' /work/srcpkgs/das-server/files/xbps-ignore.conf | xargs)
;;
*)
echo "build-iso: unknown profile '$profile' (desktop, server)" >&2
exit 1
;;
esac
if ! compgen -G "$repo/*-repodata" >/dev/null; then
echo "build-iso: the local package repository is missing, run 'make packages' first" >&2
exit 1
fi
# Reads a list file: one item per line, '#' starts a comment
read_list() {
sed -e 's/#.*//' -e '/^[[:space:]]*$/d' "$1" | xargs
}
work=$(mktemp -d)
mkdir -p /work/out/iso
trap 'rm -rf "$work"; chown -R "$HOST_UID:$HOST_GID" /work/out/iso' EXIT
# Root file system overlay: static files from <profile>/include plus generated links
include=$work/include
mkdir -p "$include/etc"
[[ -d $dir/include ]] && cp -a "$dir/include/." "$include"
ln -sf /usr/share/zoneinfo/Europe/Kyiv "$include/etc/localtime"
if [[ $profile == desktop ]]; then
# PipeWire as the sound server, wired up the same way as Void's own live images
mkdir -p "$include"/etc/xdg/autostart "$include"/etc/pipewire/pipewire.conf.d "$include"/etc/alsa/conf.d
ln -sf /usr/share/applications/pipewire.desktop "$include"/etc/xdg/autostart/
ln -sf /usr/share/examples/wireplumber/10-wireplumber.conf "$include"/etc/pipewire/pipewire.conf.d/
ln -sf /usr/share/examples/pipewire/20-pipewire-pulse.conf "$include"/etc/pipewire/pipewire.conf.d/
ln -sf /usr/share/alsa/alsa.conf.d/50-pipewire.conf "$include"/etc/alsa/conf.d/
ln -sf /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf "$include"/etc/alsa/conf.d/
# The installer shows the Das OS version, which lives in VERSION, not in the package
branding=usr/share/calamares/branding/dasos
mkdir -p "$include/$branding"
sed -e "s/@VERSION@/$version/g" -e "s/@SHORT_VERSION@/${version%.*}/g" \
"/work/srcpkgs/das-installer/files/calamares/branding/dasos/branding.desc" >"$include/$branding/branding.desc"
fi
# mklive's dracut module creates the live user, hostname and passwords at boot.
# Rebrand its defaults in this container's copy (the image itself stays untouched).
adduser=/opt/void-mklive/dracut/vmklive/adduser.sh
for pattern in 'echo void-live >' 'voidlinux'; do
if ! grep -q "$pattern" "$adduser"; then
echo "build-iso: '$pattern' not found in $adduser, mklive changed; update this script" >&2
exit 1
fi
done
sed -i -e 's/echo void-live >/echo dasos >/' -e 's/voidlinux/live/g' "$adduser"
# mklive copies its /etc/issue (Void live logins) into the image, and the
# installers copy the image to disk, so use a Das OS one (the server's tells
# how to log in to the live system; its installer writes a neutral one).
cp "$dir/branding/issue" /opt/void-mklive/data/issue
# Size, also patched into this container's mklive copy:
# - the live initrd only has to find and mount the image, the GPU drivers and
# their firmware (~150 MB) load from the root file system after switch_root;
# - squashfs with 1 MB blocks and the x86 BCJ filter packs binaries tighter.
mklive=/opt/void-mklive/mklive.sh
for pattern in '--add-drivers "ahci"' '-comp "${SQUASHFS_COMPRESSION}"'; do
if ! grep -qF -- "$pattern" "$mklive"; then
echo "build-iso: '$pattern' not found in $mklive, mklive changed; update this script" >&2
exit 1
fi
done
sed -i \
-e 's/--add-drivers "ahci"/& --omit-drivers "amdgpu radeon nouveau i915 xe"/' \
-e 's/-comp "${SQUASHFS_COMPRESSION}"/& -b 1M -Xbcj x86/' \
"$mklive"
# Boot menu entries name the Das OS version instead of mklive's
# "<title> <kernel version> <arch>" (GRUB for UEFI, isolinux for BIOS).
isolinux=/opt/void-mklive/isolinux/isolinux.cfg.in
entry_title='ENTRY_TITLE="${BOOT_TITLE} ${KERNELVERSION} ${title_sfx}(${TARGET_ARCH})"'
if ! grep -qF -- "$entry_title" "$mklive" || ! grep -qF '@@BOOT_TITLE@@ @@KERNVER@@ @@ARCH@@' "$isolinux"; then
echo "build-iso: boot menu titles not found in mklive, mklive changed; update this script" >&2
exit 1
fi
sed -i 's/ENTRY_TITLE="${BOOT_TITLE} ${KERNELVERSION} ${title_sfx}(${TARGET_ARCH})"/ENTRY_TITLE="${BOOT_TITLE}${title_sfx:+ ${title_sfx% }}"/' "$mklive"
sed -i 's/@@BOOT_TITLE@@ @@KERNVER@@ @@ARCH@@/@@BOOT_TITLE@@/' "$isolinux"
rsvg-convert /work/live/branding/splash.svg --output "$work/splash.png"
rm -f "$iso"
cd /opt/void-mklive
SPLASH_IMAGE=$work/splash.png ./mklive.sh \
-a x86_64 \
-r "$repo" \
-c /var/cache/xbps \
-p "$(read_list "$dir/packages.x86_64")" \
-S "$(read_list "$dir/services")" \
${ignore:+-g "$ignore"} \
-I "$include" \
-l "$locale" \
-k us \
-T "$title $version" \
-C "$cmdline" \
-o "$iso"