From 72f52d3200c577e2e205f76439de9c3b876118be Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Wed, 17 May 2023 06:50:52 +0000 Subject: [PATCH] fix: support --no-headers for debian --- distro/debian/debian.go | 12 ++++++++++-- kernel/kernel.go | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/distro/debian/debian.go b/distro/debian/debian.go index 79fb50a..b01560f 100644 --- a/distro/debian/debian.go +++ b/distro/debian/debian.go @@ -14,6 +14,7 @@ import ( "code.dumpstack.io/tools/out-of-tree/cache" "code.dumpstack.io/tools/out-of-tree/config" "code.dumpstack.io/tools/out-of-tree/container" + "code.dumpstack.io/tools/out-of-tree/distro/debian/snapshot" "code.dumpstack.io/tools/out-of-tree/fs" ) @@ -316,13 +317,20 @@ func ContainerVolumes(km config.KernelMask, pkgname string) (volumes container.V return } -func InstallCommands(km config.KernelMask, pkgname string) (cmds []string, err error) { +func InstallCommands(km config.KernelMask, pkgname string, headers bool) (cmds []string, err error) { dk, err := getCachedKernel(pkgname + ".deb") if err != nil { return } - for _, pkg := range dk.Packages() { + var pkgs []snapshot.Package + if headers { + pkgs = dk.Packages() + } else { + pkgs = []snapshot.Package{dk.Image} + } + + for _, pkg := range pkgs { found, newurl := cache.PackageURL( km.DistroType, pkg.Deb.URL, diff --git a/kernel/kernel.go b/kernel/kernel.go index 1991e03..1e181ad 100644 --- a/kernel/kernel.go +++ b/kernel/kernel.go @@ -407,7 +407,7 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e } case config.Debian: var commands []string - commands, err = debian.InstallCommands(sk, pkgname) + commands, err = debian.InstallCommands(sk, pkgname, headers) if err != nil { return }