banger/scripts
Thales Maciel 7192ba24ae
Phase 3: banger kernel import bridges make-*-kernel.sh output
`banger kernel import <name> --from <dir>` copies a staged kernel
bundle into the local catalog. <dir> is the output of
`make void-kernel` or `make alpine-kernel` (build/manual/void-kernel/
or build/manual/alpine-kernel/).

kernelcat.DiscoverPaths locates artifacts under <dir>:
 1. Prefers metadata.json (written by make-void-kernel.sh).
 2. Falls back to globbing: boot/vmlinux-* or vmlinuz-* (Alpine
    fallback), boot/initramfs-*, lib/modules/<latest>.

The daemon's KernelImport copies kernel + optional initrd via
system.CopyFilePreferClone and modules via system.CopyDirContents
(no-sudo mode — catalog lives under ~/.local/state), computes SHA256
over the kernel, and writes the manifest via kernelcat.WriteLocal.

While wiring this up, fixed a latent bug in system.CopyDirContents:
filepath.Join(sourceDir, ".") silently drops the trailing dot, so
`cp -a source source/contents target/` was copying the whole source
directory (including its basename) instead of just its contents.
Replaced the join with a manual "/." suffix. imagemgr.StageBootArtifacts
(the only existing caller) silently benefits.

scripts/register-void-image.sh and scripts/register-alpine-image.sh
are rewritten to use `banger kernel import … && banger image register
--kernel-ref …` instead of the find-and-pass-paths dance. Preserves
the same user-facing commands and env vars.

Tests cover: metadata.json preference, glob fallback, Alpine vmlinuz
fallback, kernel-missing error, round-trip copy into the catalog, and
the --from required flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:53:49 -03:00
..
bench-create.sh Reorganize the source checkout layout 2026-03-21 17:22:57 -03:00
customize.sh Install claude and pi through mise 2026-04-13 18:29:02 -03:00
interactive.sh Add an experimental Alpine image flow 2026-03-21 20:25:55 -03:00
make-alpine-kernel.sh Add an experimental Alpine image flow 2026-03-21 20:25:55 -03:00
make-rootfs-alpine.sh Wait for real guest vsock health before opencode 2026-03-21 21:14:22 -03:00
make-rootfs-void.sh Install claude and pi through mise 2026-04-13 18:29:02 -03:00
make-rootfs.sh Remove runtime-bundle image dependencies 2026-03-21 18:34:53 -03:00
make-void-kernel.sh Fix void-kernel output directory setup 2026-04-01 19:42:30 -03:00
register-alpine-image.sh Phase 3: banger kernel import bridges make-*-kernel.sh output 2026-04-16 14:53:49 -03:00
register-void-image.sh Phase 3: banger kernel import bridges make-*-kernel.sh output 2026-04-16 14:53:49 -03:00
verify.sh Rename experimental Void image to void 2026-04-01 20:15:28 -03:00