ipn/localapi: define a cert dir for Synology DSM6

Fixes #4060

Change-Id: I5f145d4f56f6edb14825268e858d419c55918673
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-07-18 08:47:37 -07:00
committed by Brad Fitzpatrick
parent c6648db333
commit 469c30c33b
3 changed files with 25 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ package distro
import (
"os"
"runtime"
"strconv"
"sync/atomic"
)
@@ -94,3 +95,17 @@ func freebsdDistro() Distro {
}
return ""
}
// DSMVersion reports the Synology DSM major version.
//
// If not Synology, it reports 0.
func DSMVersion() int {
if runtime.GOOS != "linux" {
return 0
}
if Get() != Synology {
return 0
}
v, _ := strconv.Atoi(os.Getenv("SYNOPKG_DSM_VERSION_MAJOR"))
return v
}