feat: migrate to system cache with changing core logic
This commit is contained in:
@ -26,8 +26,16 @@ import (
|
||||
|
||||
// Zypper represents the Zypper package manager
|
||||
type Zypper struct {
|
||||
CommonPackageManager
|
||||
CommonRPM
|
||||
rootCmd string
|
||||
}
|
||||
|
||||
func NewZypper() *YUM {
|
||||
return &YUM{
|
||||
CommonPackageManager: CommonPackageManager{
|
||||
noConfirmArg: "-y",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (*Zypper) Exists() bool {
|
||||
@ -43,10 +51,6 @@ func (*Zypper) Format() string {
|
||||
return "rpm"
|
||||
}
|
||||
|
||||
func (z *Zypper) SetRootCmd(s string) {
|
||||
z.rootCmd = s
|
||||
}
|
||||
|
||||
func (z *Zypper) Sync(opts *Opts) error {
|
||||
opts = ensureOpts(opts)
|
||||
cmd := z.getCmd(opts, "zypper", "refresh")
|
||||
@ -109,20 +113,3 @@ func (z *Zypper) UpgradeAll(opts *Opts) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (z *Zypper) getCmd(opts *Opts, mgrCmd string, args ...string) *exec.Cmd {
|
||||
var cmd *exec.Cmd
|
||||
if opts.AsRoot {
|
||||
cmd = exec.Command(getRootCmd(z.rootCmd), mgrCmd)
|
||||
cmd.Args = append(cmd.Args, opts.Args...)
|
||||
cmd.Args = append(cmd.Args, args...)
|
||||
} else {
|
||||
cmd = exec.Command(mgrCmd, args...)
|
||||
}
|
||||
|
||||
if opts.NoConfirm {
|
||||
cmd.Args = append(cmd.Args, "-y")
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
Reference in New Issue
Block a user