hostinfo: update Windows hostinfo to include MSIDist registry value

We need to expand our enviornment information to include info about
the Windows store. Thinking about future plans, it would be nice
to include both the packaging mechanism and the distribution mechanism.

In this PR we change packageTypeWindows to check a new registry value
named MSIDist, and concatenate that value to "msi/" when present.

We also remove vestigial NSIS detection.

Updates https://github.com/tailscale/corp/issues/2790

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
pull/12527/head
Aaron Klotz 7 months ago
parent 87c5ad4c2c
commit 2cb408f9b1

@ -72,10 +72,6 @@ func packageTypeWindows() string {
if _, err := os.Stat(`C:\ProgramData\chocolatey\lib\tailscale`); err == nil {
return "choco"
}
msiSentinel, _ := winutil.GetRegInteger("MSI")
if msiSentinel == 1 {
return "msi"
}
exe, err := os.Executable()
if err != nil {
return ""
@ -84,13 +80,15 @@ func packageTypeWindows() string {
if strings.HasPrefix(exe, filepath.Join(home, "scoop", "apps", "tailscale")) {
return "scoop"
}
dir := filepath.Dir(exe)
nsisUninstaller := filepath.Join(dir, "Uninstall-Tailscale.exe")
_, err = os.Stat(nsisUninstaller)
if err == nil {
return "nsis"
msiSentinel, _ := winutil.GetRegInteger("MSI")
if msiSentinel != 1 {
// Atypical. Not worth trying to detect. Likely open
// source tailscaled or a developer running by hand.
return ""
}
result := "msi"
if env, _ := winutil.GetRegString("MSIDist"); env != "" {
result += "/" + env
}
// Atypical. Not worth trying to detect. Likely open
// source tailscaled or a developer running by hand.
return ""
return result
}

Loading…
Cancel
Save