#!/bin/sh
# Scutarius base-installer.d hook (scutarius-tasks-udeb): a DEFAULT for the
# installed kernel, never a mandate.
#
# base-installer picks its default from linux-image-<flavour> metas it knows
# (arm64, amd64, ...); our flavours are scutarius-<arch> and gb10, so it finds
# none, falls back to guessing, and ASKS at high priority (first seen in the
# 7.1.12 VM test, 2026-09-06, once the preseed pin had been removed on the
# owner's ruling). A preseeded VALUE would be honoured but is marked seen and
# silences the question even in expert mode -- the mandate the owner rejected.
# Setting the value here and leaving "seen" false gives base-installer a
# present default: non-expert installs take it silently (medium priority),
# expert installs see the question with it preselected.
#
# The default = the kernel this installer booted (same version, generic
# flavour): installer udebs and the installed kernel come from the same view.
# A hardware profile (gb10) adds its own kernel through its task later.
set -e
. /usr/share/debconf/confmodule
K="linux-image-$(uname -r)"
db_get base-installer/kernel/image || true
if [ -z "$RET" ]; then
	db_set base-installer/kernel/image "$K"
	db_fset base-installer/kernel/image seen false || true
	logger -t scutarius-kernel-default "default kernel $K (not seen: expert mode still asks)"
fi
exit 0
