mirror of https://github.com/tailscale/tailscale/
feature/sdnotify: move util/systemd to a modular feature
Updates #12614 Change-Id: I08e714c83b455df7f538cc99cafe940db936b480 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>pull/17315/head
parent
7bcab4ab28
commit
976389c0f7
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
// Code generated by gen.go; DO NOT EDIT.
|
||||||
|
|
||||||
|
//go:build ts_omit_sdnotify
|
||||||
|
|
||||||
|
package buildfeatures
|
||||||
|
|
||||||
|
// HasSDNotify is whether the binary was built with support for modular feature "systemd notification support".
|
||||||
|
// Specifically, it's whether the binary was NOT built with the "ts_omit_sdnotify" build tag.
|
||||||
|
// It's a const so it can be used for dead code elimination.
|
||||||
|
const HasSDNotify = false
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
// Code generated by gen.go; DO NOT EDIT.
|
||||||
|
|
||||||
|
//go:build !ts_omit_sdnotify
|
||||||
|
|
||||||
|
package buildfeatures
|
||||||
|
|
||||||
|
// HasSDNotify is whether the binary was built with support for modular feature "systemd notification support".
|
||||||
|
// Specifically, it's whether the binary was NOT built with the "ts_omit_sdnotify" build tag.
|
||||||
|
// It's a const so it can be used for dead code elimination.
|
||||||
|
const HasSDNotify = true
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
//go:build linux && !ts_omit_sdnotify
|
||||||
|
|
||||||
|
package condregister
|
||||||
|
|
||||||
|
import _ "tailscale.com/feature/sdnotify"
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
// 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...)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +0,0 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
//go:build !linux || android
|
|
||||||
|
|
||||||
package systemd
|
|
||||||
|
|
||||||
func Ready() {}
|
|
||||||
func Status(string, ...any) {}
|
|
||||||
Loading…
Reference in New Issue