manifest/os: move fs tool selection into the pipeline

Always include the tools for all the filesystem types in the partition table. There may be
usecases for having additional ones, for instance if the partition table is not known, but
this gives us a minimal baseline.

This includes dosfstools in images that have a vfat partition but did not include the tools.
This commit is contained in:
Tom Gundersen 2022-07-06 10:13:45 +01:00
parent d791138b27
commit 39c3d6ec35
33 changed files with 591 additions and 4 deletions

View file

@ -18,7 +18,6 @@ func ec2CommonPackageSet(t *imageType) rpmmd.PackageSet {
"chrony",
"langpacks-en",
"libxcrypt-compat",
"xfsprogs",
"cloud-init",
"checkpolicy",
"net-tools",

View file

@ -133,19 +133,49 @@ func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
// If we have a logical volume we need to include the lvm2 package
if p.PartitionTable != nil && p.OSTree == nil {
hasLVM := false
hasBtrfs := false
hasXFS := false
hasFAT := false
hasEXT4 := false
isLVM := func(e disk.Entity, path []disk.Entity) error {
switch e.(type) {
introspectPT := func(e disk.Entity, path []disk.Entity) error {
switch ent := e.(type) {
case *disk.LVMLogicalVolume:
hasLVM = true
case *disk.Btrfs:
hasBtrfs = true
case *disk.Filesystem:
switch ent.GetFSType() {
case "vfat":
hasFAT = true
case "btrfs":
hasBtrfs = true
case "xfs":
hasXFS = true
case "ext4":
hasEXT4 = true
}
}
return nil
}
_ = p.PartitionTable.ForEachEntity(isLVM)
_ = p.PartitionTable.ForEachEntity(introspectPT)
// TODO: LUKS
if hasLVM {
packages = append(packages, "lvm2")
}
if hasBtrfs {
packages = append(packages, "btrfs-progs")
}
if hasXFS {
packages = append(packages, "xfsprogs")
}
if hasFAT {
packages = append(packages, "dosfstools")
}
if hasEXT4 {
packages = append(packages, "e2fsprogs")
}
}
if len(p.NTPServers) > 0 {