manifest/os: detect if the lvm2 package should be included
If the partition table includes logical volumes, the lvm2 package should be installed on the target system. Drop the corresponding logic from fedora/distro.go.
This commit is contained in:
parent
ec8cc01f95
commit
1bccf72b6b
2 changed files with 23 additions and 23 deletions
|
|
@ -575,27 +575,6 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti
|
|||
bpPackages = append(bpPackages, "chrony")
|
||||
}
|
||||
|
||||
// if we have file system customization that will need to a new mount point
|
||||
// the layout is converted to LVM so we need to corresponding packages
|
||||
if t.bootable && !t.rpmOstree {
|
||||
|
||||
pt, exists := t.basePartitionTables[t.platform.GetArch().String()]
|
||||
if !exists {
|
||||
panic(fmt.Sprintf("unknown no partition table for architecture %s", t.platform.GetArch().String()))
|
||||
}
|
||||
haveNewMountpoint := false
|
||||
|
||||
if fs := bp.Customizations.GetFilesystems(); fs != nil {
|
||||
for i := 0; !haveNewMountpoint && i < len(fs); i++ {
|
||||
haveNewMountpoint = !pt.ContainsMountpoint(fs[i].Mountpoint)
|
||||
}
|
||||
}
|
||||
|
||||
if haveNewMountpoint {
|
||||
bpPackages = append(bpPackages, "lvm2")
|
||||
}
|
||||
}
|
||||
|
||||
// depsolve bp packages separately
|
||||
// bp packages aren't restricted by exclude lists
|
||||
mergedSets[blueprintPkgsKey] = rpmmd.PackageSet{Include: bpPackages}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,26 @@ func NewOSPipeline(m *Manifest,
|
|||
|
||||
func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
|
||||
packages := p.platform.GetPackages()
|
||||
userPackages := []string{}
|
||||
|
||||
// If we have a logical volume we need to include the lvm2 package
|
||||
if p.PartitionTable != nil && p.OSTree == nil {
|
||||
hasLVM := false
|
||||
|
||||
isLVM := func(e disk.Entity, path []disk.Entity) error {
|
||||
switch e.(type) {
|
||||
case *disk.LVMLogicalVolume:
|
||||
hasLVM = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
_ = p.PartitionTable.ForEachEntity(isLVM)
|
||||
|
||||
if hasLVM {
|
||||
// TODO: put this in the base packages instead
|
||||
userPackages = append(userPackages, "lvm2")
|
||||
}
|
||||
}
|
||||
|
||||
chain := []rpmmd.PackageSet{
|
||||
{
|
||||
|
|
@ -132,9 +152,10 @@ func (p *OSPipeline) getPackageSetChain() []rpmmd.PackageSet {
|
|||
},
|
||||
}
|
||||
|
||||
if len(p.UserPackages) > 0 {
|
||||
userPackages = append(userPackages, p.UserPackages...)
|
||||
if len(userPackages) > 0 {
|
||||
chain = append(chain, rpmmd.PackageSet{
|
||||
Include: p.UserPackages,
|
||||
Include: userPackages,
|
||||
Repositories: append(p.repos, p.UserRepos...),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue