mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-25 10:14:36 +00:00
cmd/tailscale: fix configure-host command for Synology
d5e7e309 changed the `hostinfo.GetVersion` from distro and distro version to UTS Name Release and moved distribution information under `hostinfo.Distro*`. `tailscale configure-host` command implementation for Synology DSM environments relies on the old semantics of this string for matching DSM Major version so it's been broken for a few days. Pull in `hostinfo` and prefix match `hostinfo.DistroVersion` to match DSM major version. Signed-off-by: Berk D. Demir <bdd@mindcast.org>
This commit is contained in:
parent
ed248b04a7
commit
ff13c66f55
@ -48,11 +48,11 @@ func runConfigureHost(ctx context.Context, args []string) error {
|
|||||||
if uid := os.Getuid(); uid != 0 {
|
if uid := os.Getuid(); uid != 0 {
|
||||||
return fmt.Errorf("must be run as root, not %q (%v)", os.Getenv("USER"), uid)
|
return fmt.Errorf("must be run as root, not %q (%v)", os.Getenv("USER"), uid)
|
||||||
}
|
}
|
||||||
osVer := hostinfo.GetOSVersion()
|
hi:= hostinfo.New()
|
||||||
isDSM6 := strings.HasPrefix(osVer, "Synology 6")
|
isDSM6 := strings.HasPrefix(hi.DistroVersion, "6.")
|
||||||
isDSM7 := strings.HasPrefix(osVer, "Synology 7")
|
isDSM7 := strings.HasPrefix(hi.DistroVersion, "7.")
|
||||||
if !isDSM6 && !isDSM7 {
|
if !isDSM6 && !isDSM7 {
|
||||||
return fmt.Errorf("unsupported DSM version %q", osVer)
|
return fmt.Errorf("unsupported DSM version %q", hi.DistroVersion)
|
||||||
}
|
}
|
||||||
if _, err := os.Stat("/dev/net/tun"); os.IsNotExist(err) {
|
if _, err := os.Stat("/dev/net/tun"); os.IsNotExist(err) {
|
||||||
if err := os.MkdirAll("/dev/net", 0755); err != nil {
|
if err := os.MkdirAll("/dev/net", 0755); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user