Skip to content

Commit

Permalink
fix tailscaled socket and state paths for gokrazy systems
Browse files Browse the repository at this point in the history
See https://gokrazy.org/ for more information.
  • Loading branch information
stapelberg authored and bradfitz committed Aug 6, 2023
1 parent 4e9cb4f commit 28a91b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/paths/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func DefaultTailscaledSocket() string {
if runtime.GOOS == "darwin" {
return "/var/run/tailscaled.socket"
}
if fi, err := os.Stat("/gokrazy"); err == nil && fi.IsDir() {
return "/perm/tailscaled/tailscaled.sock"
}
if fi, err := os.Stat("/var/run"); err == nil && fi.IsDir() {
return "/var/run/tailscale/tailscaled.sock"
}
Expand Down
4 changes: 4 additions & 0 deletions internal/paths/paths_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ func init() {
func statePath() string {
switch runtime.GOOS {
case "linux":
if fi, err := os.Stat("/gokrazy"); err == nil && fi.IsDir() {
return "/perm/tailscaled/tailscaled.state"
}

return "/var/lib/tailscale/tailscaled.state"
case "freebsd", "openbsd":
return "/var/db/tailscale/tailscaled.state"
Expand Down

0 comments on commit 28a91b6

Please sign in to comment.