feat: migrate to system cache with changing core logic
This commit is contained in:
@ -28,7 +28,15 @@ import (
|
||||
|
||||
// Pacman represents the Pacman package manager
|
||||
type Pacman struct {
|
||||
rootCmd string
|
||||
CommonPackageManager
|
||||
}
|
||||
|
||||
func NewPacman() *Pacman {
|
||||
return &Pacman{
|
||||
CommonPackageManager: CommonPackageManager{
|
||||
noConfirmArg: "--noconfirm",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (*Pacman) Exists() bool {
|
||||
@ -44,10 +52,6 @@ func (*Pacman) Format() string {
|
||||
return "archlinux"
|
||||
}
|
||||
|
||||
func (p *Pacman) SetRootCmd(s string) {
|
||||
p.rootCmd = s
|
||||
}
|
||||
|
||||
func (p *Pacman) Sync(opts *Opts) error {
|
||||
opts = ensureOpts(opts)
|
||||
cmd := p.getCmd(opts, "pacman", "-Sy")
|
||||
@ -156,20 +160,3 @@ func (p *Pacman) IsInstalled(pkg string) (bool, error) {
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (p *Pacman) getCmd(opts *Opts, mgrCmd string, args ...string) *exec.Cmd {
|
||||
var cmd *exec.Cmd
|
||||
if opts.AsRoot {
|
||||
cmd = exec.Command(getRootCmd(p.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, "--noconfirm")
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
Reference in New Issue
Block a user