diff --git a/cmd/update.go b/cmd/update.go index f397f91..b104127 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -61,7 +61,11 @@ func Update(cmd *cobra.Command, args []string) { if err != nil { systemUpdater.Config.Enabled = false } else { - systemUpdater.Check() + enableUpd, err := systemUpdater.Check() + if err != nil { + slog.Error("Failed checking for updates") + } + systemUpdater.Config.Enabled = enableUpd } brewUpdater, err := drv.BrewUpdater{}.New(*initConfiguration) diff --git a/drv/brew.go b/drv/brew.go index 6ea96d7..155862b 100644 --- a/drv/brew.go +++ b/drv/brew.go @@ -67,19 +67,19 @@ type BrewUpdater struct { func (up BrewUpdater) New(config UpdaterInitConfiguration) (BrewUpdater, error) { brewPrefix, empty := os.LookupEnv("HOMEBREW_PREFIX") - if empty { + if empty || brewPrefix == "" { brewPrefix = "/home/linuxbrew/.linuxbrew" } brewRepo, empty := os.LookupEnv("HOMEBREW_REPOSITORY") - if empty { + if empty || brewRepo == "" { brewRepo = fmt.Sprintf("%s/Homebrew", brewPrefix) } brewCellar, empty := os.LookupEnv("HOMEBREW_CELLAR") - if empty { + if empty || brewCellar == "" { brewCellar = fmt.Sprintf("%s/Cellar", brewPrefix) } brewPath, empty := os.LookupEnv("HOMEBREW_PATH") - if empty { + if empty || brewPath == "" { brewPath = fmt.Sprintf("%s/bin/brew", brewPrefix) } diff --git a/drv/distrobox.go b/drv/distrobox.go index fb0da23..de4ff21 100644 --- a/drv/distrobox.go +++ b/drv/distrobox.go @@ -79,7 +79,7 @@ func (up *DistroboxUpdater) Update() (*[]CommandOutput, error) { for _, user := range up.users { up.Tracker.Tracker.IncrementSection(err) lib.ChangeTrackerMessageFancy(*up.Tracker.Writer, up.Tracker.Tracker, up.Tracker.Progress, lib.TrackerMessage{Title: up.Config.Title, Description: *up.Config.UserDescription + " " + user.Name}) - out, err := lib.RunUID(user.UID, []string{"/usr/bin/flatpak", "update", "-y"}, nil) + out, err := lib.RunUID(user.UID, []string{"/usr/bin/distrobox", "upgrade", "-a"}, nil) tmpout = CommandOutput{}.New(out, err) if err != nil { tmpout.SetFailureContext(fmt.Sprintf("Distroboxes for User: %s", user.Name)) diff --git a/drv/system.go b/drv/system.go index 29779a1..d5883b7 100644 --- a/drv/system.go +++ b/drv/system.go @@ -43,7 +43,7 @@ func (up SystemUpdater) New(initconfig UpdaterInitConfiguration) (SystemUpdater, } func (up *SystemUpdater) Check() (bool, error) { - if up.Config.DryRun || !up.Config.Enabled { + if up.Config.DryRun { return true, nil } updateAvailable, err := up.SystemDriver.UpdateAvailable()