Jelajahi Sumber

control/controlclient: report whether we're in a snap package

Signed-off-by: Brad Fitzpatrick <[email protected]>
Brad Fitzpatrick 4 tahun lalu
induk
melakukan
dfa5e38fad
1 mengubah file dengan 7 tambahan dan 0 penghapusan
  1. 7 0
      control/controlclient/direct.go

+ 7 - 0
control/controlclient/direct.go

@@ -220,6 +220,13 @@ func packageType() string {
 		// Using tailscaled or IPNExtension?
 		exe, _ := os.Executable()
 		return filepath.Base(exe)
+	case "linux":
+		// Report whether this is in a snap.
+		// See https://snapcraft.io/docs/environment-variables
+		// We just look at two somewhat arbitrarily.
+		if os.Getenv("SNAP_NAME") != "" && os.Getenv("SNAP") != "" {
+			return "snap"
+		}
 	}
 	return ""
 }