Files
Das-OS/scripts/container/build-iso.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

100 lines
3.8 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}
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"
;;
*)
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
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")" \
-I "$include" \
-l "$locale" \
-k us \
-T "$title" \
-C "$cmdline" \
-o "$iso"