hostinfo: [windows] check if running via Scoop
You can now install Tailscale on Windows via [Scoop](https://scoop.sh).
This change adds a check to `packageTypeWindows()`, looking at the exe's path, and
checking if it starts with: `C:\User\<NAME>\scoop\apps\tailscale`. If so, it
returns `"scoop"` as the package type.
Fixes:
"fmt"
"os"
"path/filepath"
+ "strings"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
@@ -69,6 +70,10 @@ func packageTypeWindows() string {
if err != nil {
return ""
}
+ home, _ := os.UserHomeDir()
+ 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)
