Update
This commit is contained in:
12
vendor/tailscale.com/version/cmdname.go
generated
vendored
12
vendor/tailscale.com/version/cmdname.go
generated
vendored
@@ -12,7 +12,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func CmdName() string {
|
||||
func cmdName(exe string) string {
|
||||
// fallbackName, the lowercase basename of the executable, is what we return if
|
||||
// we can't find the Go module metadata embedded in the file.
|
||||
fallbackName := filepath.Base(strings.TrimSuffix(strings.ToLower(exe), ".exe"))
|
||||
fallbackName := prepExeNameForCmp(exe, runtime.GOARCH)
|
||||
|
||||
var ret string
|
||||
info, err := findModuleInfo(exe)
|
||||
@@ -45,10 +45,10 @@ func cmdName(exe string) string {
|
||||
break
|
||||
}
|
||||
}
|
||||
if strings.HasPrefix(ret, "wg") && fallbackName == "tailscale-ipn" {
|
||||
// The tailscale-ipn.exe binary for internal build system packaging reasons
|
||||
// has a path of "tailscale.io/win/wg64", "tailscale.io/win/wg32", etc.
|
||||
// Ignore that name and use "tailscale-ipn" instead.
|
||||
if runtime.GOOS == "windows" && strings.HasPrefix(ret, "gui") && checkPreppedExeNameForGUI(fallbackName) {
|
||||
// The GUI binary for internal build system packaging reasons
|
||||
// has a path of "tailscale.io/win/gui".
|
||||
// Ignore that name and use fallbackName instead.
|
||||
return fallbackName
|
||||
}
|
||||
if ret == "" {
|
||||
|
||||
12
vendor/tailscale.com/version/distro/distro.go
generated
vendored
12
vendor/tailscale.com/version/distro/distro.go
generated
vendored
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"tailscale.com/types/lazy"
|
||||
"tailscale.com/util/lineiter"
|
||||
@@ -31,6 +32,7 @@ const (
|
||||
Unraid = Distro("unraid")
|
||||
Alpine = Distro("alpine")
|
||||
UBNT = Distro("ubnt") // Ubiquiti Networks
|
||||
JetKVM = Distro("jetkvm")
|
||||
)
|
||||
|
||||
var distro lazy.SyncValue[Distro]
|
||||
@@ -102,10 +104,20 @@ func linuxDistro() Distro {
|
||||
return Unraid
|
||||
case have("/etc/alpine-release"):
|
||||
return Alpine
|
||||
case runtime.GOARCH == "arm" && isDeviceModel("JetKVM"):
|
||||
return JetKVM
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func isDeviceModel(want string) bool {
|
||||
if runtime.GOOS != "linux" {
|
||||
return false
|
||||
}
|
||||
v, _ := os.ReadFile("/sys/firmware/devicetree/base/model")
|
||||
return want == strings.Trim(string(v), "\x00\r\n\t ")
|
||||
}
|
||||
|
||||
func freebsdDistro() Distro {
|
||||
switch {
|
||||
case have("/etc/pfSense-rc"):
|
||||
|
||||
25
vendor/tailscale.com/version/exename.go
generated
vendored
Normal file
25
vendor/tailscale.com/version/exename.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package version
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// prepExeNameForCmp strips any extension and arch suffix from exe, and
|
||||
// lowercases it.
|
||||
func prepExeNameForCmp(exe, arch string) string {
|
||||
baseNoExt := strings.ToLower(strings.TrimSuffix(filepath.Base(exe), filepath.Ext(exe)))
|
||||
archSuffix := "-" + arch
|
||||
return strings.TrimSuffix(baseNoExt, archSuffix)
|
||||
}
|
||||
|
||||
func checkPreppedExeNameForGUI(preppedExeName string) bool {
|
||||
return preppedExeName == "tailscale-ipn" || preppedExeName == "tailscale-gui"
|
||||
}
|
||||
|
||||
func isGUIExeName(exe, arch string) bool {
|
||||
return checkPreppedExeNameForGUI(prepExeNameForCmp(exe, arch))
|
||||
}
|
||||
1
vendor/tailscale.com/version/print.go
generated
vendored
1
vendor/tailscale.com/version/print.go
generated
vendored
@@ -20,6 +20,7 @@ var stringLazy = sync.OnceValue(func() string {
|
||||
if gitCommit() != "" {
|
||||
fmt.Fprintf(&ret, " tailscale commit: %s%s\n", gitCommit(), dirtyString())
|
||||
}
|
||||
fmt.Fprintf(&ret, " long version: %s\n", Long())
|
||||
if extraGitCommitStamp != "" {
|
||||
fmt.Fprintf(&ret, " other commit: %s\n", extraGitCommitStamp)
|
||||
}
|
||||
|
||||
4
vendor/tailscale.com/version/prop.go
generated
vendored
4
vendor/tailscale.com/version/prop.go
generated
vendored
@@ -159,7 +159,9 @@ func IsWindowsGUI() bool {
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.EqualFold(exe, "tailscale-ipn.exe") || strings.EqualFold(exe, "tailscale-ipn")
|
||||
// It is okay to use GOARCH here because we're checking whether our
|
||||
// _own_ process is the GUI.
|
||||
return isGUIExeName(exe, runtime.GOARCH)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user