diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-28 12:27:06 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-29 08:41:30 +0200 |
commit | 51a410523acd4687a91ff6b48e05a4c7d711126a (patch) | |
tree | 1c3e6059569376c72336ba09f06e9a5ee5e1e833 /updater/msirunner_windows.go | |
parent | go.mod: use forked winio with no thirdparty deps (diff) | |
download | wireguard-windows-51a410523acd4687a91ff6b48e05a4c7d711126a.tar.xz wireguard-windows-51a410523acd4687a91ff6b48e05a4c7d711126a.zip |
updater: add initial skeleton
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'updater/msirunner_windows.go')
-rw-r--r-- | updater/msirunner_windows.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/updater/msirunner_windows.go b/updater/msirunner_windows.go new file mode 100644 index 00000000..a498af3c --- /dev/null +++ b/updater/msirunner_windows.go @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: MIT + * + * Copyright (C) 2019 WireGuard LLC. All Rights Reserved. + */ + +package updater + +import ( + "golang.org/x/sys/windows" + "golang.zx2c4.com/wireguard/windows/conf" + "os/exec" + "path" +) + +func runMsi(msiPath string) error { + system32, err := windows.GetSystemDirectory() + if err != nil { + return err + } + // BUG: The Go documentation says that its built-in shell quoting isn't good for msiexec.exe. + // See https://github.com/golang/go/issues/15566. But perhaps our limited set of options + // actually works fine? Investigate this! + return exec.Command(path.Join(system32, "msiexec.exe"), "/quiet", "/i", msiPath).Run() +} + +func msiSaveDirectory() (string, error) { + configRootDir, err := conf.RootDirectory() + if err != nil { + return "", err + } + return path.Join(configRootDir, "Updates"), nil +} |