aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/updater/msirunner_windows.go
blob: dfa921eecdbf16a24d6a02df17cd23c57cda6a48 (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
/* 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
	}
	cmd := exec.Command(path.Join(system32, "msiexec.exe"), "/qb!-", "/i", path.Base(msiPath))
	cmd.Dir = path.Dir(msiPath)
	return cmd.Run()
}

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