2023-02-24 22:19:13 +00:00
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
2023-02-24 21:22:21 +00:00
// The dist command builds Tailscale release packages for distribution.
package main
import (
"context"
2023-07-31 22:47:00 +00:00
"crypto"
2023-02-24 21:22:21 +00:00
"errors"
"flag"
"log"
"os"
"tailscale.com/release/dist"
2023-02-24 22:15:35 +00:00
"tailscale.com/release/dist/cli"
2023-05-26 19:42:05 +00:00
"tailscale.com/release/dist/synology"
2023-02-24 21:22:21 +00:00
"tailscale.com/release/dist/unixpkgs"
)
2023-05-26 19:42:05 +00:00
var synologyPackageCenter bool
2023-07-31 22:47:00 +00:00
func getTargets ( tgzSigner crypto . Signer ) ( [ ] dist . Target , error ) {
2023-05-26 19:42:05 +00:00
var ret [ ] dist . Target
2023-07-31 22:47:00 +00:00
ret = append ( ret , unixpkgs . Targets ( tgzSigner ) ... )
2023-05-26 19:42:05 +00:00
// 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
2023-02-24 21:22:21 +00:00
}
2023-02-24 22:15:35 +00:00
func main ( ) {
cmd := cli . CLI ( getTargets )
2023-05-26 19:42:05 +00:00
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" )
}
}
2023-02-24 22:15:35 +00:00
if err := cmd . ParseAndRun ( context . Background ( ) , os . Args [ 1 : ] ) ; err != nil && ! errors . Is ( err , flag . ErrHelp ) {
log . Fatal ( err )
2023-02-24 21:22:21 +00:00
}
}