Skip to content

Commit

Permalink
Fix UI update button (#1349)
Browse files Browse the repository at this point in the history
* add os-specific UpdateCommand functions to pkg/skyenv

* set return variable type for skyenv/values__windows.go and skyenv/values__darwin.go
  • Loading branch information
0pcom committed Sep 4, 2022
1 parent f1814f5 commit e8e0557
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ require (
github.com/skycoin/skywire-utilities v0.0.0-20220712142443-abafa30105ce
github.com/skycoin/systray v1.10.1-0.20220630135132-48d2a1fb85d8
github.com/spf13/pflag v1.0.5
periph.io/x/periph v3.6.8+incompatible
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
nhooyr.io/websocket v1.8.2 h1:LwdzfyyOZKtVFoXay6A39Acu03KmidSZ3YUUvPa13PA=
nhooyr.io/websocket v1.8.2/go.mod h1:LiqdCg1Cu7TPWxEvPjPa0TGYxCsy4pHNTN9gGluwBpQ=
periph.io/x/periph v3.6.8+incompatible h1:lki0ie6wHtvlilXhIkabdCUQMpb5QN4Fx33yNQdqnaA=
periph.io/x/periph v3.6.8+incompatible/go.mod h1:EWr+FCIU2dBWz5/wSWeiIUJTriYv9v2j2ENBmgYyy7Y=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
Expand Down
5 changes: 5 additions & 0 deletions pkg/skyenv/values_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ func UserConfig() PkgConfig {
usrconfig.Hypervisor.EnableAuth = true
return usrconfig
}

// UpdateCommand returns the commands which are run when the update button is clicked in the ui
func UpdateCommand() []string {
return []string{`echo "update not implemented for macOS. Download a new version from the release section here: https://github.com/skycoin/skywire/releases"`}
}
14 changes: 14 additions & 0 deletions pkg/skyenv/values_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

package skyenv

import (
"periph.io/x/periph/host/distro"
)

const (
//OS detection at runtime
OS = "linux"
Expand Down Expand Up @@ -31,3 +35,13 @@ func UserConfig() PkgConfig {
usrconfig.Hypervisor.EnableAuth = true
return usrconfig
}

// UpdateCommand returns the commands which are run when the update button is clicked in the ui
func UpdateCommand() []string {
if distro.IsArmbian() || distro.IsDebian() || distro.IsRaspbian() || distro.IsUbuntu() {
//enabling install-skyire.service and rebooting is required to avoid interrupting an update when the running visor is stopped
//install-skywire.service is provided by the skybian package and calls install-skywire.sh
return []string{`systemctl enable install-skywire.service && systemctl reboot || echo -e "Resource unavailable.\nPlease update manually as specified here:\nhttps://github.com/skycoin/skywire/wiki/Skywire-Package-Installation"`}
}
return []string{`echo -e "Update not implemented for this linux distro.\nPlease update skywire the same way you installed it."`}
}
5 changes: 5 additions & 0 deletions pkg/skyenv/values_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ func UserConfig() PkgConfig {
usrconfig.Hypervisor.EnableAuth = true
return usrconfig
}

// UpdateCommand returns the commands which are run when the update button is clicked in the ui
func UpdateCommand() []string {
return []string{`echo "Update not implemented for windows. Download a new version from the release section here: https://github.com/skycoin/skywire/releases"`}
}
2 changes: 1 addition & 1 deletion vendor/github.com/godbus/dbus/v5/conn.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,6 @@ nhooyr.io/websocket/internal/bpool
nhooyr.io/websocket/internal/errd
nhooyr.io/websocket/internal/wsjs
nhooyr.io/websocket/internal/xsync
# periph.io/x/periph v3.6.8+incompatible
## explicit
periph.io/x/periph/host/distro

0 comments on commit e8e0557

Please sign in to comment.