-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: separate system drivers in new style (#37)
* refactor: move system updater-related logic to unified driver * refactor: separate rpm-ostree and bootc drivers w/ new format * fix: linting * refactor: use interface for single system driver * fix: proper number of steps for main system driver
- Loading branch information
1 parent
a0430fc
commit 14f9233
Showing
6 changed files
with
286 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.