mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 19:45:35 +00:00
eef15b4ffc
Pass an optional PEM-encoded ECDSA key to `cmd/dist` to sign all built tarballs. The signature is stored next to the tarball with a `.sig` extension. Tested this with an `openssl`-generated key pair and verified the resulting signature. Updates #8760 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// The dist command builds Tailscale release packages for distribution.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"crypto"
|
|
"errors"
|
|
"flag"
|
|
"log"
|
|
"os"
|
|
|
|
"tailscale.com/release/dist"
|
|
"tailscale.com/release/dist/cli"
|
|
"tailscale.com/release/dist/synology"
|
|
"tailscale.com/release/dist/unixpkgs"
|
|
)
|
|
|
|
var synologyPackageCenter bool
|
|
|
|
func getTargets(tgzSigner crypto.Signer) ([]dist.Target, error) {
|
|
var ret []dist.Target
|
|
|
|
ret = append(ret, unixpkgs.Targets(tgzSigner)...)
|
|
// Synology packages can be built either for sideloading, or for
|
|
// distribution by Synology in their package center. When
|
|
// distributed through the package center, apps can request
|
|
// additional permissions to use a tuntap interface and control
|
|
// the NAS's network stack, rather than be forced to run in
|
|
// userspace mode.
|
|
//
|
|
// Since only we can provide packages to Synology for
|
|
// distribution, we default to building the "sideload" variant of
|
|
// packages that we distribute on pkgs.tailscale.com.
|
|
ret = append(ret, synology.Targets(synologyPackageCenter)...)
|
|
return ret, nil
|
|
}
|
|
|
|
func main() {
|
|
cmd := cli.CLI(getTargets)
|
|
for _, subcmd := range cmd.Subcommands {
|
|
if subcmd.Name == "build" {
|
|
subcmd.FlagSet.BoolVar(&synologyPackageCenter, "synology-package-center", false, "build synology packages with extra metadata for the official package center")
|
|
}
|
|
}
|
|
|
|
if err := cmd.ParseAndRun(context.Background(), os.Args[1:]); err != nil && !errors.Is(err, flag.ErrHelp) {
|
|
log.Fatal(err)
|
|
}
|
|
}
|