Files
Vetting/live-image/mkosi.postinst
T
josh caebd00d8d
CI / Lint + build + test (push) Successful in 1m47s
Release / release (push) Successful in 2m14s
live-image: symlink /initrd.img to match /vmlinuz
The linux-image-amd64 postinst creates /vmlinuz but the paired
/initrd.img symlink only shows up via an initramfs-tools hook that
doesn't fire when we call update-initramfs ourselves. Without it,
the top-level Makefile's `cp live-image/build/initrd.img` fails and
`make release` aborts with a broken bundle.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 10:54:25 -04:00

25 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# mkosi postinst: enable the vetting-agent service and generate the
# initrd. The binary lands in the image via mkosi.extra/ (staged by the
# live-image Makefile from ../bin/vetting-agent.linux-amd64); the
# service unit lands via mkosi.skeleton/.
set -eu
mkdir -p "$BUILDROOT/etc/systemd/system/multi-user.target.wants"
ln -sf /etc/systemd/system/vetting-agent.service \
"$BUILDROOT/etc/systemd/system/multi-user.target.wants/vetting-agent.service"
# Bootable=no means mkosi won't run update-initramfs for us, and the
# deferred initramfs-tools trigger inside the chroot doesn't actually
# generate /boot/initrd.img-<kver>. Do it explicitly so the top-level
# Makefile's cp of live-image/build/initrd.img has something to copy.
kver=$(ls "$BUILDROOT/lib/modules/" | head -n1)
chroot "$BUILDROOT" update-initramfs -c -k "$kver"
# linux-image-amd64 creates /vmlinuz -> boot/vmlinuz-<kver>, but the
# corresponding /initrd.img symlink only gets created by an
# initramfs-tools postinst hook that relies on the kernel package's
# "postinst_hook" infrastructure — which doesn't fire when we invoke
# update-initramfs ourselves. Create it to mirror /vmlinuz.
ln -sf "boot/initrd.img-${kver}" "$BUILDROOT/initrd.img"