diff --git a/cmd/tailscale/depaware.txt b/cmd/tailscale/depaware.txt index ad13374f6..3a237ad24 100644 --- a/cmd/tailscale/depaware.txt +++ b/cmd/tailscale/depaware.txt @@ -81,6 +81,8 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep W tailscale.com/util/endian from tailscale.com/net/netns tailscale.com/util/groupmember from tailscale.com/cmd/tailscale/cli tailscale.com/util/lineread from tailscale.com/net/interfaces+ + W tailscale.com/util/winutil from tailscale.com/hostinfo + W 💣 tailscale.com/util/winutil/vss from tailscale.com/util/winutil tailscale.com/version from tailscale.com/cmd/tailscale/cli+ tailscale.com/version/distro from tailscale.com/cmd/tailscale/cli+ tailscale.com/wgengine/filter from tailscale.com/types/netmap diff --git a/hostinfo/hostinfo_windows.go b/hostinfo/hostinfo_windows.go index aa78cde2e..023f92463 100644 --- a/hostinfo/hostinfo_windows.go +++ b/hostinfo/hostinfo_windows.go @@ -8,11 +8,11 @@ import ( "fmt" "os" "path/filepath" - "strings" "sync/atomic" "golang.org/x/sys/windows" "golang.org/x/sys/windows/registry" + "tailscale.com/util/winutil" ) func init() { @@ -65,32 +65,20 @@ func packageTypeWindows() string { if _, err := os.Stat(`C:\ProgramData\chocolatey\lib\tailscale`); err == nil { return "choco" } + if msiSentinel := winutil.GetRegInteger("MSI", 0); msiSentinel == 1 { + return "msi" + } exe, err := os.Executable() if err != nil { return "" } dir := filepath.Dir(exe) - if !strings.Contains(dir, "Program Files") { - // Atypical. Not worth trying to detect. Likely open - // source tailscaled or a developer running by hand. - return "" - } nsisUninstaller := filepath.Join(dir, "Uninstall-Tailscale.exe") _, err = os.Stat(nsisUninstaller) if err == nil { return "nsis" } - if os.IsNotExist(err) { - _, cliErr := os.Stat(filepath.Join(dir, "tailscale.exe")) - _, daemonErr := os.Stat(filepath.Join(dir, "tailscaled.exe")) - if cliErr == nil && daemonErr == nil { - // Almost certainly MSI. - // We have tailscaled.exe and tailscale.exe - // next to each other in Program Files, but no - // uninstaller. - // TODO(bradfitz,dblohm7): tighter heuristic? - return "msi" - } - } + // Atypical. Not worth trying to detect. Likely open + // source tailscaled or a developer running by hand. return "" }