Phase 1: local kernel catalog scaffolding
Introduces a read/write kernel catalog on disk without any network dependency, so later phases (image register --kernel-ref, import, pull) can build on a working foundation. Layout: adds KernelsDir to paths.Layout, ensured under ~/.local/state/banger/kernels/. Each cataloged kernel lives at <KernelsDir>/<name>/ with a manifest.json alongside vmlinux and optional initrd.img / modules/. New internal/kernelcat package owns the disk format: - Entry (Name, Distro, Arch, KernelVersion, SHA256, Source, ImportedAt) - ValidateName (alphanumeric + dots/hyphens/underscores, no traversal) - ReadLocal / ListLocal / WriteLocal / DeleteLocal - SumFile helper The daemon exposes three RPC methods dispatched in daemon.go: kernel.list, kernel.show, kernel.delete. Implementations live in a new internal/daemon/kernels.go and are thin wrappers over kernelcat using d.layout.KernelsDir. CLI: new top-level `banger kernel` with list / show / rm subcommands mirroring the image-command pattern (ensureDaemon, RPC call, table or JSON output). No sudo required — kernel ops are user-space only. Users can now manually populate ~/.local/state/banger/kernels/<name>/ and see it via `banger kernel list`. Phase 2 wires --kernel-ref into image register; Phase 3 adds `banger kernel import`; Phase 4 adds remote pulls. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ca4865447c
commit
83cc3aee15
9 changed files with 691 additions and 3 deletions
|
|
@ -274,6 +274,31 @@ type ImageShowResult struct {
|
|||
Image model.Image `json:"image"`
|
||||
}
|
||||
|
||||
type KernelEntry struct {
|
||||
Name string `json:"name"`
|
||||
Distro string `json:"distro,omitempty"`
|
||||
Arch string `json:"arch,omitempty"`
|
||||
KernelVersion string `json:"kernel_version,omitempty"`
|
||||
SHA256 string `json:"sha256,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
ImportedAt string `json:"imported_at,omitempty"`
|
||||
KernelPath string `json:"kernel_path,omitempty"`
|
||||
InitrdPath string `json:"initrd_path,omitempty"`
|
||||
ModulesDir string `json:"modules_dir,omitempty"`
|
||||
}
|
||||
|
||||
type KernelListResult struct {
|
||||
Entries []KernelEntry `json:"entries"`
|
||||
}
|
||||
|
||||
type KernelRefParams struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type KernelShowResult struct {
|
||||
Entry KernelEntry `json:"entry"`
|
||||
}
|
||||
|
||||
type SudoStatus struct {
|
||||
Available bool `json:"available"`
|
||||
Command string `json:"command,omitempty"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue