mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-22 13:37:10 +00:00
clientupdate: change Mac App Store support (#9891)
In the sandboxed app from the app store, we cannot check `/Library/Preferences/com.apple.commerce.plist` or run `softwareupdate`. We can at most print a helpful message and open the app store page. Also, reenable macsys update function to mark it as supporting c2n updates. macsys support in `tailscale update` was fixed. Updates #755 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -47,19 +47,7 @@ var isSandboxedMacOS lazy.SyncValue[bool]
|
||||
// and macsys (System Extension) version on macOS, and false for
|
||||
// tailscaled-on-macOS.
|
||||
func IsSandboxedMacOS() bool {
|
||||
if runtime.GOOS != "darwin" {
|
||||
return false
|
||||
}
|
||||
return isSandboxedMacOS.Get(func() bool {
|
||||
if IsMacSysExt() {
|
||||
return true
|
||||
}
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return filepath.Base(exe) == "io.tailscale.ipn.macsys.network-extension" || strings.HasSuffix(exe, "/Contents/MacOS/Tailscale") || strings.HasSuffix(exe, "/Contents/MacOS/IPNExtension")
|
||||
})
|
||||
return IsMacAppStore() || IsMacSysExt()
|
||||
}
|
||||
|
||||
var isMacSysExt lazy.SyncValue[bool]
|
||||
@@ -79,6 +67,23 @@ func IsMacSysExt() bool {
|
||||
})
|
||||
}
|
||||
|
||||
var isMacAppStore lazy.SyncValue[bool]
|
||||
|
||||
// IsMacAppStore whether this binary is from the App Store version of Tailscale
|
||||
// for macOS.
|
||||
func IsMacAppStore() bool {
|
||||
if runtime.GOOS != "darwin" {
|
||||
return false
|
||||
}
|
||||
return isMacAppStore.Get(func() bool {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.HasSuffix(exe, "/Contents/MacOS/Tailscale") || strings.HasSuffix(exe, "/Contents/MacOS/IPNExtension")
|
||||
})
|
||||
}
|
||||
|
||||
var isAppleTV lazy.SyncValue[bool]
|
||||
|
||||
// IsAppleTV reports whether this binary is part of the Tailscale network extension for tvOS.
|
||||
|
||||
Reference in New Issue
Block a user