mirror of
https://github.com/rwinkhart/cachyos-postinstall-helper.git
synced 2026-09-05 08:37:39 -04:00
Add utility function for simple package management
This commit is contained in:
@@ -23,6 +23,14 @@ func manageService(action, service string) {
|
||||
}
|
||||
}
|
||||
|
||||
func managePackage(action, targetPackage string) {
|
||||
cmd := exec.Command("pacman", action, targetPackage, "--noconfirm")
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
other.PrintError("Failed to "+action+" "+targetPackage, 1)
|
||||
}
|
||||
}
|
||||
|
||||
func writeFile(path, data, owner string, perms os.FileMode) {
|
||||
err := os.WriteFile(path, []byte(data), perms)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user