aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/updater/msirunner_windows.go
blob: 286cec1e7114dfe21ef4e1953b0f8c29c271510b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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"), "/qb", "/i", msiPath).Run()
}

func msiSaveDirectory() (string, error) {
	configRootDir, err := conf.RootDirectory()
	if err != nil {
		return "", err
	}
	return path.Join(configRootDir, "Updates"), nil
}