9f21313942
Update version Refactor Pacman to always use `-Syu` regardless of what operation it's doing. I did this solely to prevent partial updates from even being possible. Unlike pacman, which let's you do bad commands with no warning. Remove un-needed Root question from AUR Installer Set up AUR installer to update the system before cloning and building (to be safe, we add a warning about partial updates. See, it isn't that hard Pacman!) Add repair command that will fix issues with the pkg.list file Add a check to the handleUpdate function that advises the user to run `repair` if it has a problem reading the pkg.list
40 lines
961 B
Go
40 lines
961 B
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"fmt"
|
|
"io/fs"
|
|
|
|
"pixelridgesoftworks.com/AllPac/pkg/logger"
|
|
"pixelridgesoftworks.com/AllPac/pkg/packagemanager"
|
|
)
|
|
|
|
func handleUpdateError(updateOption string, err error) {
|
|
if err != nil {
|
|
fmt.Printf("Error occurred during '%s' update: %v\n", updateOption, err)
|
|
} else {
|
|
fmt.Printf("Update '%s' completed successfully.\n", updateOption)
|
|
}
|
|
}
|
|
|
|
//go:embed .version
|
|
var versionFS embed.FS
|
|
|
|
func handleVersion(args []string) {
|
|
content, err := fs.ReadFile(versionFS, ".version")
|
|
if err != nil {
|
|
logger.Errorf("Error reading version file: %v", err)
|
|
}
|
|
fmt.Println(string(content))
|
|
}
|
|
|
|
func handleRepair(args []string) {
|
|
// Assuming GetPkgListPath() returns a string path
|
|
pkgListPath, _ := packagemanager.GetPkgListPath()
|
|
|
|
err :=packagemanager.InitializePkgListFile(pkgListPath)
|
|
if err != nil {
|
|
logger.Errorf("Error initializing version file: %v", err)
|
|
}
|
|
}
|