util: distro, engine: resources: Update virt-builder res

A little easier to maintain if we support more distros eventually.
This commit is contained in:
James Shubin
2024-10-15 20:35:13 -04:00
parent e45d9be065
commit 067eef9007
2 changed files with 35 additions and 12 deletions

View File

@@ -71,6 +71,18 @@ var (
"PackageKit",
},
}
// MapDistroToGuestfsPackages is a map of distro to packages needed to
// run the virt-builder software and guestfs suite.
MapDistroToGuestfsPackages = map[string][]string{
// TODO: add more values
DistroDebian: {
"guestfs-tools",
},
DistroFedora: {
"guestfs-tools",
},
}
)
// DistroToBootstrapPackages returns the list of packages corresponding to the
@@ -80,6 +92,14 @@ func DistroToBootstrapPackages(distro string) ([]string, bool) {
return l, exists
}
// DistroToGuestfsPackages returns the list of packages corresponding to the
// distro for running the virt-builder software and guestfs suite. This returns
// false if the value doesn't exist.
func DistroToGuestfsPackages(distro string) ([]string, bool) {
l, exists := MapDistroToGuestfsPackages[distro]
return l, exists
}
// Family returns the distro family.
func Family(ctx context.Context) (string, error) {
if b, err := IsFamilyRedHat(ctx); err != nil {