chroot: Honor package set order for install/remove
Signed-off-by: Thomas Hipp <thomas.hipp@canonical.com>
This commit is contained in:
parent
7031511afa
commit
9907a513cf
@ -53,9 +53,6 @@ func managePackages(def shared.DefinitionPackages, actions []shared.DefinitionAc
|
||||
}
|
||||
}
|
||||
|
||||
var installablePackages []string
|
||||
var removablePackages []string
|
||||
|
||||
for _, set := range def.Sets {
|
||||
if len(set.Releases) > 0 && !lxd.StringInSlice(release, set.Releases) {
|
||||
continue
|
||||
@ -66,9 +63,12 @@ func managePackages(def shared.DefinitionPackages, actions []shared.DefinitionAc
|
||||
}
|
||||
|
||||
if set.Action == "install" {
|
||||
installablePackages = append(installablePackages, set.Packages...)
|
||||
err = manager.Install(set.Packages)
|
||||
} else if set.Action == "remove" {
|
||||
removablePackages = append(removablePackages, set.Packages...)
|
||||
err = manager.Remove(set.Packages)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,16 +77,6 @@ func managePackages(def shared.DefinitionPackages, actions []shared.DefinitionAc
|
||||
manager.SetInstallFlags("install", "--allow-downgrade")
|
||||
}
|
||||
|
||||
err = manager.Install(installablePackages)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = manager.Remove(removablePackages)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if def.Cleanup {
|
||||
err = manager.Clean()
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user