mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-04 12:02:05 +02:00
Updates #12614 Change-Id: I08e714c83b455df7f538cc99cafe940db936b480 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
33 lines
916 B
Go
33 lines
916 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package feature
|
|
|
|
import (
|
|
"runtime"
|
|
|
|
"tailscale.com/feature/buildfeatures"
|
|
)
|
|
|
|
// HookSystemdReady sends a readiness to systemd. This will unblock service
|
|
// dependents from starting.
|
|
var HookSystemdReady Hook[func()]
|
|
|
|
// HookSystemdStatus holds a func that will send a single line status update to
|
|
// systemd so that information shows up in systemctl output.
|
|
var HookSystemdStatus Hook[func(format string, args ...any)]
|
|
|
|
// SystemdStatus sends a single line status update to systemd so that
|
|
// information shows up in systemctl output.
|
|
//
|
|
// It does nothing on non-Linux systems or if the binary was built without
|
|
// the sdnotify feature.
|
|
func SystemdStatus(format string, args ...any) {
|
|
if runtime.GOOS != "linux" || !buildfeatures.HasSDNotify {
|
|
return
|
|
}
|
|
if f, ok := HookSystemdStatus.GetOk(); ok {
|
|
f(format, args...)
|
|
}
|
|
}
|