managers: Add dnf support
Signed-off-by: Thomas Hipp <thomas.hipp@canonical.com>
This commit is contained in:
parent
dbebec3c55
commit
d00cfc5b70
28
managers/dnf.go
Normal file
28
managers/dnf.go
Normal file
@ -0,0 +1,28 @@
|
||||
package managers
|
||||
|
||||
// NewDnf creates a new Manager instance.
|
||||
func NewDnf() *Manager {
|
||||
return &Manager{
|
||||
command: "dnf",
|
||||
flags: ManagerFlags{
|
||||
global: []string{
|
||||
"-y",
|
||||
},
|
||||
install: []string{
|
||||
"install",
|
||||
},
|
||||
remove: []string{
|
||||
"remove",
|
||||
},
|
||||
refresh: []string{
|
||||
"makecache",
|
||||
},
|
||||
update: []string{
|
||||
"upgrade",
|
||||
},
|
||||
clean: []string{
|
||||
"clean", "all",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
@ -27,14 +27,16 @@ type Manager struct {
|
||||
// Get returns a Manager specified by name.
|
||||
func Get(name string) *Manager {
|
||||
switch name {
|
||||
case "apk":
|
||||
return NewApk()
|
||||
case "apt":
|
||||
return NewApt()
|
||||
case "dnf":
|
||||
return NewDnf()
|
||||
case "pacman":
|
||||
return NewPacman()
|
||||
case "yum":
|
||||
return NewYum()
|
||||
case "apk":
|
||||
return NewApk()
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -196,8 +196,9 @@ func (d *Definition) Validate() error {
|
||||
validManagers := []string{
|
||||
"apk",
|
||||
"apt",
|
||||
"yum",
|
||||
"dnf",
|
||||
"pacman",
|
||||
"yum",
|
||||
}
|
||||
if !shared.StringInSlice(strings.TrimSpace(d.Packages.Manager), validManagers) {
|
||||
return fmt.Errorf("packages.manager must be one of %v", validManagers)
|
||||
|
Loading…
Reference in New Issue
Block a user