From e8e05576879bf68e21a998e902d8ea60fcb410ac Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Sun, 4 Sep 2022 11:59:55 -0500 Subject: [PATCH] Fix UI update button (#1349) * add os-specific UpdateCommand functions to pkg/skyenv * set return variable type for skyenv/values__windows.go and skyenv/values__darwin.go --- go.mod | 1 + go.sum | 2 ++ pkg/skyenv/values_darwin.go | 5 +++++ pkg/skyenv/values_linux.go | 14 ++++++++++++++ pkg/skyenv/values_windows.go | 5 +++++ vendor/github.com/godbus/dbus/v5/conn.go | 2 +- vendor/modules.txt | 3 +++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8e0ea01713..67903262a1 100644 --- a/go.mod +++ b/go.mod @@ -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 ( diff --git a/go.sum b/go.sum index 9a25709f0e..e3df18bb82 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/skyenv/values_darwin.go b/pkg/skyenv/values_darwin.go index 1b413ea079..5ee1c03e39 100644 --- a/pkg/skyenv/values_darwin.go +++ b/pkg/skyenv/values_darwin.go @@ -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"`} +} diff --git a/pkg/skyenv/values_linux.go b/pkg/skyenv/values_linux.go index cce473e6f0..8827c77bcc 100644 --- a/pkg/skyenv/values_linux.go +++ b/pkg/skyenv/values_linux.go @@ -3,6 +3,10 @@ package skyenv +import ( + "periph.io/x/periph/host/distro" +) + const ( //OS detection at runtime OS = "linux" @@ -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."`} +} diff --git a/pkg/skyenv/values_windows.go b/pkg/skyenv/values_windows.go index 6f68ba720d..83aad0145e 100644 --- a/pkg/skyenv/values_windows.go +++ b/pkg/skyenv/values_windows.go @@ -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"`} +} diff --git a/vendor/github.com/godbus/dbus/v5/conn.go b/vendor/github.com/godbus/dbus/v5/conn.go index 8080f3e918..69978ea26a 100644 --- a/vendor/github.com/godbus/dbus/v5/conn.go +++ b/vendor/github.com/godbus/dbus/v5/conn.go @@ -432,7 +432,7 @@ func (conn *Conn) inWorker() { case TypeSignal: conn.handleSignal(sequence, msg) case TypeMethodCall: -conn.handleCall(msg) + go conn.handleCall(msg) } } diff --git a/vendor/modules.txt b/vendor/modules.txt index c3d5f3a24d..bfc462a77a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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