mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
hostinfo: [windows] check if running via Scoop (#7068)
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: #6988 Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
This commit is contained in:
parent
038d25bd04
commit
6f992909f0
@ -8,6 +8,7 @@
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
"golang.org/x/sys/windows/registry"
|
"golang.org/x/sys/windows/registry"
|
||||||
@ -69,6 +70,10 @@ func packageTypeWindows() string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
home, _ := os.UserHomeDir()
|
||||||
|
if strings.HasPrefix(exe, filepath.Join(home, "scoop", "apps", "tailscale")) {
|
||||||
|
return "scoop"
|
||||||
|
}
|
||||||
dir := filepath.Dir(exe)
|
dir := filepath.Dir(exe)
|
||||||
nsisUninstaller := filepath.Join(dir, "Uninstall-Tailscale.exe")
|
nsisUninstaller := filepath.Join(dir, "Uninstall-Tailscale.exe")
|
||||||
_, err = os.Stat(nsisUninstaller)
|
_, err = os.Stat(nsisUninstaller)
|
||||||
|
Loading…
Reference in New Issue
Block a user