ab2582dc60
Install.go Changes ``` - Add comments to each file/package to elaborate on their purpose - Add package list functions to install.go to keep track of installed packages and their sources - Remove the dependancy on YAY, we are just gonna handle AUR operations ourselves. - Remove YAY methods from install.go - Add calls to the package install logger to the end of each install functions - Add dependancy install functions to install.go ``` flatpak.go Changes: ``` - Completely write flatpak.go - Include functions for uninstalling flatpak programs - Include functions for updating flatpak programs ``` pacman.go Changes: ``` - Completely write pacman.go - Include functions for uninstalling pacman packages - Include functions for updating pacman packages ``` yay.go Changes: ``` - Completely removed ``` search.go Changes: ``` - Completely write search.go - Include functions for searching pacman - Include functions for searching snap - Include functions for searching flatpak ``` toolcheck.go Changes: ``` - Completely write toolcheck.go - Include functions for checking for Git - Include functions for checking for base-devel group - Include functions for checking for pacman - Include functions for checking for Snapd - Include functions for checking for flatpak - Include function to ask to install flatpak - Include function to ask to install Snapd - Include function to ask to install Git - Include function to ask to install the base-devel group ```
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package packagemanager
|
|
|
|
// This package is responsible for handling updating and uninstalling pacman packages
|
|
|
|
import (
|
|
"os/exec"
|
|
"fmt"
|
|
)
|
|
|
|
// UpdatePacmanPackages updates specified Pacman packages or all if no specific package is provided
|
|
func UpdatePacmanPackages(packageNames ...string) error {
|
|
var cmd *exec.Cmd
|
|
if len(packageNames) == 0 {
|
|
cmd = exec.Command("sudo", "pacman", "-Syu")
|
|
} else {
|
|
args := append([]string{"-S", "--noconfirm"}, packageNames...)
|
|
cmd = exec.Command("sudo", "pacman", args...)
|
|
}
|
|
|
|
if output, err := cmd.CombinedOutput(); err != nil {
|
|
return fmt.Errorf("error updating Pacman packages: %s, %v", output, err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UninstallPacmanPackage uninstalls a specified Pacman package
|
|
func UninstallPacmanPackage(packageName string) error {
|
|
cmd := exec.Command("sudo", "pacman", "-Rns", "--noconfirm", packageName)
|
|
if output, err := cmd.CombinedOutput(); err != nil {
|
|
return fmt.Errorf("error uninstalling Pacman package: %s, %v", output, err)
|
|
}
|
|
return nil
|
|
}
|