Fixed error loops

This commit is contained in:
partisan 2025-03-02 09:59:00 +01:00
parent 44d20eb983
commit f3a78f4bd6
3 changed files with 20 additions and 22 deletions

33
auto.go
View file

@ -196,23 +196,22 @@ func DownloadSpecified(specs []AppIndexEntry) error {
}
fmt.Printf("[INFO] Found matching APPINDEX entry: %+v\n", *matchingEntry)
// // Check if an update is needed
// updateNeeded, err := IsUpdateNeeded(
// installDir,
// matchingEntry.Name,
// matchingEntry.Release,
// matchingEntry.Version,
// matchingEntry.Arch,
// matchingEntry.OS,
// )
// if err != nil {
// return fmt.Errorf("[ERROR] Failed to check if update is needed for %s: %w", matchingEntry.Name, err)
// }
updateNeeded, err := IsUpdateNeeded(
installDir,
matchingEntry.Name,
matchingEntry.Release,
matchingEntry.Version,
matchingEntry.Arch,
matchingEntry.OS,
)
if err != nil {
return fmt.Errorf("[ERROR] Failed to check if update is needed for %s: %w", matchingEntry.Name, err)
}
// if !updateNeeded {
// fmt.Printf("[INFO] No update needed for package '%s'\n", matchingEntry.Name)
// continue
// }
if !updateNeeded {
fmt.Printf("[INFO] No update needed for package '%s'\n", matchingEntry.Name)
continue
}
// 5) Download the package
downloadDir := GetTempDir()
@ -243,7 +242,7 @@ func DownloadSpecified(specs []AppIndexEntry) error {
}
fmt.Printf("[INFO] Package '%s' decompressed successfully to: %s\n", matchingEntry.Name, tempDir)
// 7) Store in pendingUpdates for InstallUpdates
// Add to pendingUpdates for InstallUpdates
fmt.Printf("[INFO] Adding '%s' to pending updates\n", matchingEntry.Name)
pendingUpdates = append(pendingUpdates, *matchingEntry)
}