mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
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>
This commit is contained in:
parent
87c5ad4c2c
commit
2cb408f9b1
@ -72,10 +72,6 @@ func packageTypeWindows() string {
|
|||||||
if _, err := os.Stat(`C:\ProgramData\chocolatey\lib\tailscale`); err == nil {
|
if _, err := os.Stat(`C:\ProgramData\chocolatey\lib\tailscale`); err == nil {
|
||||||
return "choco"
|
return "choco"
|
||||||
}
|
}
|
||||||
msiSentinel, _ := winutil.GetRegInteger("MSI")
|
|
||||||
if msiSentinel == 1 {
|
|
||||||
return "msi"
|
|
||||||
}
|
|
||||||
exe, err := os.Executable()
|
exe, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
@ -84,13 +80,15 @@ func packageTypeWindows() string {
|
|||||||
if strings.HasPrefix(exe, filepath.Join(home, "scoop", "apps", "tailscale")) {
|
if strings.HasPrefix(exe, filepath.Join(home, "scoop", "apps", "tailscale")) {
|
||||||
return "scoop"
|
return "scoop"
|
||||||
}
|
}
|
||||||
dir := filepath.Dir(exe)
|
msiSentinel, _ := winutil.GetRegInteger("MSI")
|
||||||
nsisUninstaller := filepath.Join(dir, "Uninstall-Tailscale.exe")
|
if msiSentinel != 1 {
|
||||||
_, err = os.Stat(nsisUninstaller)
|
// Atypical. Not worth trying to detect. Likely open
|
||||||
if err == nil {
|
// source tailscaled or a developer running by hand.
|
||||||
return "nsis"
|
return ""
|
||||||
}
|
}
|
||||||
// Atypical. Not worth trying to detect. Likely open
|
result := "msi"
|
||||||
// source tailscaled or a developer running by hand.
|
if env, _ := winutil.GetRegString("MSIDist"); env != "" {
|
||||||
return ""
|
result += "/" + env
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user