Prune legacy void/alpine + customize.sh flows
The golden-image Dockerfile + catalog pipeline replaces the entire
manual rootfs-build stack. With that shipped, the per-distro shell
flows are dead code.
Removed:
- scripts/customize.sh, scripts/interactive.sh, scripts/verify.sh
- scripts/make-rootfs{,-void,-alpine}.sh
- scripts/register-{void,alpine}-image.sh
- scripts/make-{void,alpine}-kernel.sh
- internal/imagepreset/ (only consumer was `banger internal packages`,
which fed customize.sh)
- examples/{void,alpine}.config.toml
- Makefile targets: rootfs, rootfs-void, rootfs-alpine, void-kernel,
alpine-kernel, void-register, alpine-register, void-vm, alpine-vm,
verify-void, verify-alpine, plus the ALPINE_RELEASE / *_IMAGE_NAME
/ *_VM_NAME variables
The void-6.12 kernel catalog entry is also gone — golden image pairs
with generic-6.12 and nothing else in the catalog depended on it.
Consolidated: imagemgr now holds the small DebianBasePackages list +
package-hash helper inline, so the `image build --from-image` flow
(still supported) no longer pulls from a separate imagepreset package.
Net: 3,815 lines deleted, 59 added. No runtime functionality removed
beyond the `banger internal packages` subcommand (hidden, used only
by the deleted customize.sh).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8029b2e1bc
commit
6083e2dde5
23 changed files with 73 additions and 3814 deletions
|
|
@ -30,7 +30,6 @@ import (
|
|||
"banger/internal/guest"
|
||||
"banger/internal/hostnat"
|
||||
"banger/internal/imagecat"
|
||||
"banger/internal/imagepreset"
|
||||
"banger/internal/imagepull"
|
||||
"banger/internal/model"
|
||||
"banger/internal/paths"
|
||||
|
|
@ -219,7 +218,6 @@ func newInternalCommand() *cobra.Command {
|
|||
newInternalSSHKeyPathCommand(),
|
||||
newInternalFirecrackerPathCommand(),
|
||||
newInternalVSockAgentPathCommand(),
|
||||
newInternalPackagesCommand(),
|
||||
newInternalMakeBundleCommand(),
|
||||
)
|
||||
return cmd
|
||||
|
|
@ -284,39 +282,6 @@ func newInternalVSockAgentPathCommand() *cobra.Command {
|
|||
}
|
||||
}
|
||||
|
||||
func newInternalPackagesCommand() *cobra.Command {
|
||||
var docker bool
|
||||
cmd := &cobra.Command{
|
||||
Use: "packages <debian|void|alpine>",
|
||||
Hidden: true,
|
||||
Args: exactArgsUsage(1, "usage: banger internal packages <debian|void|alpine> [--docker]"),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var packages []string
|
||||
switch strings.TrimSpace(args[0]) {
|
||||
case "debian":
|
||||
packages = imagepreset.DebianBasePackages()
|
||||
if docker {
|
||||
packages = append(packages, "docker.io")
|
||||
}
|
||||
case "void":
|
||||
packages = imagepreset.VoidBasePackages()
|
||||
case "alpine":
|
||||
packages = imagepreset.AlpineBasePackages()
|
||||
default:
|
||||
return fmt.Errorf("unknown package preset %q", args[0])
|
||||
}
|
||||
for _, pkg := range packages {
|
||||
if _, err := fmt.Fprintln(cmd.OutOrStdout(), pkg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVar(&docker, "docker", false, "include docker-specific additions")
|
||||
return cmd
|
||||
}
|
||||
|
||||
func newInternalMakeBundleCommand() *cobra.Command {
|
||||
var (
|
||||
rootfsTarPath string
|
||||
|
|
|
|||
|
|
@ -190,24 +190,6 @@ func TestInternalNATFlagsExist(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestInternalPackagesCommandSupportsAlpine(t *testing.T) {
|
||||
cmd := NewBangerCommand()
|
||||
var stdout bytes.Buffer
|
||||
cmd.SetOut(&stdout)
|
||||
cmd.SetArgs([]string{"internal", "packages", "alpine"})
|
||||
|
||||
if err := cmd.Execute(); err != nil {
|
||||
t.Fatalf("Execute(): %v", err)
|
||||
}
|
||||
|
||||
output := stdout.String()
|
||||
for _, want := range []string{"alpine-base", "docker", "libgcc", "libstdc++", "mkinitfs", "openssh"} {
|
||||
if !strings.Contains(output, want+"\n") {
|
||||
t.Fatalf("output = %q, want package %q", output, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPSAndVMListAliasesAndFlagsExist(t *testing.T) {
|
||||
root := NewBangerCommand()
|
||||
ps, _, err := root.Find([]string{"ps"})
|
||||
|
|
|
|||
|
|
@ -8,14 +8,44 @@ package imagemgr
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"banger/internal/imagepreset"
|
||||
"banger/internal/system"
|
||||
)
|
||||
|
||||
// debianBasePackages is the apt package list applied by
|
||||
// `image build --from-image` to Debian-based managed rootfses. Small
|
||||
// curated set: most of the developer tooling the golden image ships
|
||||
// lives in the Dockerfile, not here.
|
||||
var debianBasePackages = []string{
|
||||
"make",
|
||||
"git",
|
||||
"less",
|
||||
"tree",
|
||||
"ca-certificates",
|
||||
"curl",
|
||||
"wget",
|
||||
"iproute2",
|
||||
"vim",
|
||||
"tmux",
|
||||
}
|
||||
|
||||
// DebianBasePackages returns a copy of the base package set.
|
||||
func DebianBasePackages() []string {
|
||||
return append([]string(nil), debianBasePackages...)
|
||||
}
|
||||
|
||||
// hashPackages returns the hex sha256 of the package list, used as
|
||||
// drift-detection metadata alongside a built rootfs.
|
||||
func hashPackages(lines []string) string {
|
||||
sum := sha256.Sum256([]byte(strings.Join(lines, "\n") + "\n"))
|
||||
return fmt.Sprintf("%x", sum)
|
||||
}
|
||||
|
||||
// ValidateRegisterPaths checks that rootfs + kernel exist and that optional
|
||||
// artifacts, when provided, also exist.
|
||||
func ValidateRegisterPaths(rootfsPath, workSeedPath, kernelPath, initrdPath, modulesDir string) error {
|
||||
|
|
@ -102,7 +132,7 @@ func StageOptionalArtifactPath(artifactDir, stagedPath, name string) string {
|
|||
// managed image build. The #feature:docker sentinel is appended when
|
||||
// docker is requested.
|
||||
func BuildMetadataPackages(docker bool) []string {
|
||||
packages := imagepreset.DebianBasePackages()
|
||||
packages := DebianBasePackages()
|
||||
if docker {
|
||||
packages = append(packages, "#feature:docker")
|
||||
}
|
||||
|
|
@ -116,5 +146,5 @@ func WritePackagesMetadata(rootfsPath string, packages []string) error {
|
|||
return nil
|
||||
}
|
||||
metadataPath := rootfsPath + ".packages.sha256"
|
||||
return os.WriteFile(metadataPath, []byte(imagepreset.Hash(packages)+"\n"), 0o644)
|
||||
return os.WriteFile(metadataPath, []byte(hashPackages(packages)+"\n"), 0o644)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
"banger/internal/api"
|
||||
"banger/internal/daemon/imagemgr"
|
||||
"banger/internal/imagepreset"
|
||||
"banger/internal/kernelcat"
|
||||
"banger/internal/model"
|
||||
"banger/internal/system"
|
||||
|
|
@ -86,7 +85,7 @@ func (d *Daemon) BuildImage(ctx context.Context, params api.ImageBuildParams) (i
|
|||
if err != nil {
|
||||
return model.Image{}, err
|
||||
}
|
||||
packages := imagepreset.DebianBasePackages()
|
||||
packages := imagemgr.DebianBasePackages()
|
||||
metadataPackages := imagemgr.BuildMetadataPackages(params.Docker)
|
||||
spec := imageBuildSpec{
|
||||
ID: id,
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
package imagepreset
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var debianBase = []string{
|
||||
"make",
|
||||
"git",
|
||||
"less",
|
||||
"tree",
|
||||
"ca-certificates",
|
||||
"curl",
|
||||
"wget",
|
||||
"iproute2",
|
||||
"vim",
|
||||
"tmux",
|
||||
}
|
||||
|
||||
var voidBase = []string{
|
||||
"base-minimal",
|
||||
"base-devel",
|
||||
"bash",
|
||||
"ca-certificates",
|
||||
"curl",
|
||||
"docker",
|
||||
"docker-compose",
|
||||
"e2fsprogs",
|
||||
"git",
|
||||
"iproute2",
|
||||
"less",
|
||||
"make",
|
||||
"openssh",
|
||||
"procps-ng",
|
||||
"runit",
|
||||
"shadow",
|
||||
"sudo",
|
||||
"tmux",
|
||||
"tree",
|
||||
"vim",
|
||||
"wget",
|
||||
}
|
||||
|
||||
var alpineBase = []string{
|
||||
"alpine-base",
|
||||
"bash",
|
||||
"ca-certificates",
|
||||
"curl",
|
||||
"docker",
|
||||
"docker-cli-compose",
|
||||
"e2fsprogs",
|
||||
"git",
|
||||
"iproute2",
|
||||
"less",
|
||||
"libgcc",
|
||||
"libstdc++",
|
||||
"make",
|
||||
"mkinitfs",
|
||||
"openssh",
|
||||
"procps-ng",
|
||||
"shadow",
|
||||
"sudo",
|
||||
"tmux",
|
||||
"tree",
|
||||
"vim",
|
||||
"wget",
|
||||
}
|
||||
|
||||
func DebianBasePackages() []string {
|
||||
return append([]string(nil), debianBase...)
|
||||
}
|
||||
|
||||
func VoidBasePackages() []string {
|
||||
return append([]string(nil), voidBase...)
|
||||
}
|
||||
|
||||
func AlpineBasePackages() []string {
|
||||
return append([]string(nil), alpineBase...)
|
||||
}
|
||||
|
||||
func Hash(lines []string) string {
|
||||
sum := sha256.Sum256([]byte(strings.Join(lines, "\n") + "\n"))
|
||||
return fmt.Sprintf("%x", sum)
|
||||
}
|
||||
|
|
@ -10,16 +10,6 @@
|
|||
"tarball_sha256": "d6f9ba2a957260063241cf9d79ae538d0c349107d37f0bfccc33281d29bd0901",
|
||||
"size_bytes": 9098722,
|
||||
"description": "Generic Firecracker kernel 6.12.8 (all drivers built-in, no initrd needed)"
|
||||
},
|
||||
{
|
||||
"name": "void-6.12",
|
||||
"distro": "void",
|
||||
"arch": "x86_64",
|
||||
"kernel_version": "6.12.81_1",
|
||||
"tarball_url": "https://kernels.thaloco.com/void-6.12-x86_64.tar.zst",
|
||||
"tarball_sha256": "3de6d03c4a3b5d3b8164f20049ddcb38b32a1864ea7133f01ff7fbb56c34d428",
|
||||
"size_bytes": 187734807,
|
||||
"description": "Void Linux 6.12 kernel for Firecracker microVMs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ type DiscoveredArtifacts struct {
|
|||
ModulesDir string
|
||||
}
|
||||
|
||||
// metadataFile is the JSON dropped by scripts/make-void-kernel.sh alongside
|
||||
// its staged output. We read it when present to avoid guessing at filenames.
|
||||
// metadataFile is the optional JSON a kernel-build script can drop
|
||||
// alongside its staged output to point ReadLocal at specific filenames
|
||||
// without guessing.
|
||||
type metadataFile struct {
|
||||
KernelPath string `json:"kernel_path"`
|
||||
InitrdPath string `json:"initrd_path"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue