mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-30 05:22:44 -08:00
Adds a CLI subcommand that downloads a signed Tailscale appliance image (Gokrazy archive format, GAF) from pkgs.tailscale.com, constructs a fresh GPT-partitioned disk from it (mbr.img + a synthesized partition table + boot.img + root.img), formats /perm as ext4 in pure Go via go-diskfs, and ejects the disk so a user running on a regular workstation can flash an SD card or homelab VM disk in one command without installing e2fsprogs. On macOS the target disk is auto-discovered via diskutil, skipping the boot disk and anything bigger than 256 GB out of paranoia. On Linux the user passes --disk=/dev/sdX explicitly. Windows is not supported yet and the command returns an error. The GPT layout matches monogok's full-disk layout via the new public github.com/bradfitz/monogok/disklayout package; a drift- guard test inside monogok asserts the two implementations stay byte-identical so OTA updates against monogok-built images keep working. Behind a ts_omit_flashappliance build tag (on by default). Updates #1866 Signed-off-by: Brad Fitzpatrick <[email protected]> Change-Id: Ic1a8cd185e7039edccb7702ab4104544fcb58d29
55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package cli
|
|
|
|
import (
|
|
"flag"
|
|
"strings"
|
|
|
|
"github.com/peterbourgon/ff/v3/ffcli"
|
|
)
|
|
|
|
var (
|
|
maybeJetKVMConfigureCmd,
|
|
maybeConfigSynologyCertCmd,
|
|
_ 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(),
|
|
flashApplianceCmd(),
|
|
ccall(maybeConfigSynologyCertCmd),
|
|
ccall(maybeSysExtCmd),
|
|
ccall(maybeVPNConfigCmd),
|
|
ccall(maybeJetKVMConfigureCmd),
|
|
ccall(maybeSystrayCmd),
|
|
),
|
|
}
|
|
}
|
|
|
|
// 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()
|
|
}
|