Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move system updater-related logic to unified driver #31

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions cmd/imageOutdated.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package cmd

import (
"log"
"log/slog"

"github.com/spf13/cobra"
"github.com/ublue-os/uupd/drv"
)

func ImageOutdated(cmd *cobra.Command, args []string) {
systemDriver, err := drv.GetSystemUpdateDriver()
systemUpdater, err := drv.SystemUpdater{}.New(drv.UpdaterInitConfiguration{})
if err != nil {
log.Fatalf("Failed to get system update driver: %v", err)
slog.Error("Failed getting system driver", slog.Any("error", err))
return
}
outdated, err := systemDriver.ImageOutdated()
if err != nil {
log.Fatalf("Cannot determine if image is outdated: %v", err)
}
log.Printf("%t", outdated)

println(systemUpdater.Outdated)
}
19 changes: 13 additions & 6 deletions cmd/updateCheck.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
package cmd

import (
"log/slog"

"github.com/spf13/cobra"
"github.com/ublue-os/uupd/drv"
"log"
)

func UpdateCheck(cmd *cobra.Command, args []string) {
systemDriver, err := drv.GetSystemUpdateDriver()
systemUpdater, err := drv.SystemUpdater{}.New(drv.UpdaterInitConfiguration{})
if err != nil {
log.Fatalf("Failed to get system update driver: %v", err)
slog.Error("Failed getting system driver", slog.Any("error", err))
return
}
update, err := systemDriver.UpdateAvailable()
updateAvailable, err := systemUpdater.Check()
if err != nil {
log.Fatalf("Failed to check for updates: %v", err)
slog.Error("Failed checking for updates", slog.Any("error", err))
return
}
if updateAvailable {
slog.Info("Update Available")
} else {
slog.Info("No updates available")
}
log.Printf("Update Available: %v", update)
}
157 changes: 0 additions & 157 deletions drv/bootc.go

This file was deleted.

Loading
Loading