mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-27 11:41:14 +00:00
To write the init script. And fix the JetKVM detection to work during early boot while the filesystem and modules are still being loaded; it wasn't being detected on early boot and then tailscaled was failing to start because it didn't know it was on JetKVM and didn't modprobe tun. Updates #16524 Change-Id: I0524ca3abd7ace68a69af96aab4175d32c07e116 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package cli
|
|
|
|
import (
|
|
"flag"
|
|
"strings"
|
|
|
|
"github.com/peterbourgon/ff/v3/ffcli"
|
|
)
|
|
|
|
var maybeJetKVMConfigureCmd func() *ffcli.Command // non-nil only on Linux/arm for JetKVM
|
|
|
|
func configureCmd() *ffcli.Command {
|
|
return &ffcli.Command{
|
|
Name: "configure",
|
|
ShortUsage: "tailscale configure <subcommand>",
|
|
ShortHelp: "Configure the host to enable more Tailscale features",
|
|
LongHelp: strings.TrimSpace(`
|
|
The 'configure' set of commands are intended to provide a way to enable different
|
|
services on the host to use Tailscale in more ways.
|
|
`),
|
|
FlagSet: (func() *flag.FlagSet {
|
|
fs := newFlagSet("configure")
|
|
return fs
|
|
})(),
|
|
Subcommands: nonNilCmds(
|
|
configureKubeconfigCmd(),
|
|
synologyConfigureCmd(),
|
|
synologyConfigureCertCmd(),
|
|
ccall(maybeSysExtCmd),
|
|
ccall(maybeVPNConfigCmd),
|
|
ccall(maybeJetKVMConfigureCmd),
|
|
),
|
|
}
|
|
}
|
|
|
|
// ccall calls the function f if it is non-nil, and returns its result.
|
|
//
|
|
// It returns the zero value of the type T if f is nil.
|
|
func ccall[T any](f func() T) T {
|
|
var zero T
|
|
if f == nil {
|
|
return zero
|
|
}
|
|
return f()
|
|
}
|