aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manager/updatestate.go
diff options
context:
space:
mode:
Diffstat (limited to 'manager/updatestate.go')
-rw-r--r--manager/updatestate.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/manager/updatestate.go b/manager/updatestate.go
index b54cc367..4cc9a8f8 100644
--- a/manager/updatestate.go
+++ b/manager/updatestate.go
@@ -9,6 +9,7 @@ import (
"log"
"time"
+ "golang.zx2c4.com/wireguard/windows/conf"
"golang.zx2c4.com/wireguard/windows/updater"
"golang.zx2c4.com/wireguard/windows/version"
)
@@ -35,12 +36,23 @@ func checkForUpdates() {
first := true
for {
- update, err := updater.CheckForUpdate()
- if err == nil && update != nil {
- log.Println("An update is available")
- updateState = UpdateStateFoundUpdate
- IPCServerNotifyUpdateFound(updateState)
- return
+ var err error
+ if conf.AdminBool("SilentUpdate") {
+ progress := updater.DownloadVerifyAndExecute(0)
+ for {
+ dp := <-progress
+ if dp.Complete || dp.Error != nil {
+ break
+ }
+ }
+ } else {
+ update, err := updater.CheckForUpdate()
+ if err == nil && update != nil {
+ log.Println("An update is available")
+ updateState = UpdateStateFoundUpdate
+ IPCServerNotifyUpdateFound(updateState)
+ return
+ }
}
if err != nil {
log.Printf("Update checker: %v", err)