builder/adapters/container-runner-finalize.sh

24 lines
1.8 KiB
Bash

# Container Runner installed-system defaults. No graphical target or desktop stack.
systemctl --root=/job/core disable systemd-networkd archipelago-firstboot@ttyS0 getty@tty1 serial-getty@ttyS0
# Keep the console onboarding path; the installed system is a multi-user server.
systemctl --root=/job/core enable NetworkManager cockpit.socket
systemctl --root=/job/core set-default multi-user.target
mkdir -p /job/core/etc/cockpit /job/core/etc/NetworkManager/conf.d /job/core/etc/sudoers.d
# Cockpit's stock self-signed certificate; never allow plaintext or unauthenticated use.
printf '[WebService]\nAllowUnencrypted = false\n' > /job/core/etc/cockpit/cockpit.conf
printf '[main]\ndns=systemd-resolved\n' > /job/core/etc/NetworkManager/conf.d/20-archipelago.conf
printf '%%wheel ALL=(ALL:ALL) ALL\n' > /job/core/etc/sudoers.d/10-archipelago-wheel
chmod 0440 /job/core/etc/sudoers.d/10-archipelago-wheel
arch-chroot /job/core visudo -c
# binfmt registrations are applied by the statically enabled systemd-binfmt.service.
compgen -G '/job/core/usr/lib/binfmt.d/qemu-*.conf' >/dev/null
# Tailscale and firewalld are installed but deliberately not enabled; no keys,
# accounts or firewall rules are baked into the image.
test "$(systemctl --root=/job/core is-enabled tailscaled.service 2>/dev/null || true)" != enabled
test "$(systemctl --root=/job/core is-enabled firewalld.service 2>/dev/null || true)" != enabled
arch-chroot /job/core pacman --config /dev/null --dbpath /usr/lib/archipelago/package-db -Qq > /job/evidence/container-runner-package-names.txt
if grep -Ei '^(packagekit($|-)|libpackagekit)' /job/evidence/container-runner-package-names.txt; then
echo 'D-095: PackageKit is excluded from Container Runner' >&2
exit 1
fi
printf 'Container Runner: Cockpit enabled; Tailscale and firewall are operator actions\n' > /job/core/usr/lib/archipelago/container-runner-status