Skip to content

Commit 6a7c12e

Browse files
committed
update to latest gokrazy/updater (now needs a context)
1 parent 7a30c17 commit 6a7c12e

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module github.com/gokrazy/selfupdate
22

3-
go 1.20
3+
go 1.24
4+
5+
toolchain go1.24.3
46

57
require (
68
github.com/antihax/optional v1.0.0
79
github.com/gokrazy/gokapi v0.0.0-20230221202227-fc8991bfa4ab
810
github.com/gokrazy/gokrazy v0.0.0-20230215184006-9cdaabefeec8
9-
github.com/gokrazy/updater v0.0.0-20230215172637-813ccc7f21e2
11+
github.com/gokrazy/updater v0.0.0-20250601065453-91649328574c
1012
)
1113

1214
require (

go.sum

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ github.com/gokrazy/gokrazy v0.0.0-20230215184006-9cdaabefeec8 h1:S2Ac5RfoKzqB8GA
66
github.com/gokrazy/gokrazy v0.0.0-20230215184006-9cdaabefeec8/go.mod h1:v4yQTOzEIpUmkKHYGMfqhktZXwvaxUpc2VfFTMyHAYI=
77
github.com/gokrazy/internal v0.0.0-20220129150711-9ed298107648 h1:kBuLicM0xJw3xEe4607WlnzGL+qSwPqdyh5/LUiCdq0=
88
github.com/gokrazy/internal v0.0.0-20220129150711-9ed298107648/go.mod h1:Gc9sU6yJ/qxg3gJZ1pjfcTAULa0swdTa4TH51g1e00E=
9-
github.com/gokrazy/updater v0.0.0-20230215172637-813ccc7f21e2 h1:kBY5R1tSf+EYZ+QaSrofLaVJtBqYsVNVBWkdMq3Smcg=
10-
github.com/gokrazy/updater v0.0.0-20230215172637-813ccc7f21e2/go.mod h1:PYOvzGOL4nlBmuxu7IyKQTFLaxr61+WPRNRzVtuYOHw=
9+
github.com/gokrazy/updater v0.0.0-20250601065453-91649328574c h1:a8dmMwaooonr7TdDG+UWD97zEPxaEp9R11woElaQ+nE=
10+
github.com/gokrazy/updater v0.0.0-20250601065453-91649328574c/go.mod h1:EtAn+BPibqnAHnYGj3FW5e284xNsiOOMOL2dJiwu7H4=
1111
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
1212
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
1313
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
1414
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
1515
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
1616
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
17+
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1718
github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg=
1819
github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4=
1920
github.com/mdlayher/watchdog v0.0.0-20201005150459-8bdc4f41966b h1:7tUBfsEEBWfFeHOB7CUfoOamak+Gx/BlirfXyPk1WjI=

selfupdate.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,42 +64,42 @@ func selfupdate(ctx context.Context, gusCli *gusapi.APIClient, gusServer, machin
6464

6565
log.Print("checking target partuuid support")
6666

67-
target, err := updater.NewTarget(uri, http.DefaultClient)
67+
target, err := updater.NewTarget(ctx, uri, http.DefaultClient)
6868
if err != nil {
6969
return fmt.Errorf("checking target partuuid support: %v", err)
7070
}
7171

7272
// Start with the root file system because writing to the non-active
7373
// partition cannot break the currently running system.
7474
log.Print("updating root file system")
75-
if err := target.StreamTo("root", readClosers.root); err != nil {
75+
if err := target.StreamTo(ctx, "root", readClosers.root); err != nil {
7676
return fmt.Errorf("updating root file system: %v", err)
7777
}
7878
readClosers.root.Close()
7979

8080
log.Print("updating boot file system")
81-
if err := target.StreamTo("boot", readClosers.boot); err != nil {
81+
if err := target.StreamTo(ctx, "boot", readClosers.boot); err != nil {
8282
return fmt.Errorf("updating boot file system: %v", err)
8383
}
8484
readClosers.boot.Close()
8585

8686
// Only relevant when running on non-Raspberry Pi devices.
8787
// As it does not use an MBR.
8888
log.Print("updating MBR")
89-
if err := target.StreamTo("mbr", readClosers.mbr); err != nil {
89+
if err := target.StreamTo(ctx, "mbr", readClosers.mbr); err != nil {
9090
return fmt.Errorf("updating MBR: %v", err)
9191
}
9292
readClosers.mbr.Close()
9393

9494
readClosers.zip.Close()
9595

9696
log.Print("switching to non-active partition")
97-
if err := target.Switch(); err != nil {
97+
if err := target.Switch(ctx); err != nil {
9898
return fmt.Errorf("switching to non-active partition: %v", err)
9999
}
100100

101101
log.Print("reboot")
102-
if err := target.Reboot(); err != nil {
102+
if err := target.Reboot(ctx); err != nil {
103103
return fmt.Errorf("reboot: %v", err)
104104
}
105105

0 commit comments

Comments
 (0)