feat: migrate to system cache with changing core logic

This commit is contained in:
2025-04-15 21:41:21 +03:00
parent 5ca34a572a
commit efa4f59403
62 changed files with 4002 additions and 1889 deletions

View File

@ -26,9 +26,16 @@ import (
// YUM represents the YUM package manager
type YUM struct {
CommonPackageManager
CommonRPM
}
rootCmd string
func NewYUM() *YUM {
return &YUM{
CommonPackageManager: CommonPackageManager{
noConfirmArg: "-y",
},
}
}
func (*YUM) Exists() bool {
@ -44,10 +51,6 @@ func (*YUM) Format() string {
return "rpm"
}
func (y *YUM) SetRootCmd(s string) {
y.rootCmd = s
}
func (y *YUM) Sync(opts *Opts) error {
opts = ensureOpts(opts)
cmd := y.getCmd(opts, "yum", "upgrade")
@ -110,20 +113,3 @@ func (y *YUM) UpgradeAll(opts *Opts) error {
}
return nil
}
func (y *YUM) getCmd(opts *Opts, mgrCmd string, args ...string) *exec.Cmd {
var cmd *exec.Cmd
if opts.AsRoot {
cmd = exec.Command(getRootCmd(y.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
}