Compare commits
1 Commits
main
...
raggi/bump
Author | SHA1 | Date |
---|---|---|
![]() |
5c05ff5848 |
|
@ -11,9 +11,10 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/goreleaser/nfpm"
|
||||
_ "github.com/goreleaser/nfpm/deb"
|
||||
_ "github.com/goreleaser/nfpm/rpm"
|
||||
"github.com/goreleaser/nfpm/v2"
|
||||
_ "github.com/goreleaser/nfpm/v2/deb"
|
||||
"github.com/goreleaser/nfpm/v2/files"
|
||||
_ "github.com/goreleaser/nfpm/v2/rpm"
|
||||
)
|
||||
|
||||
// parseFiles parses a comma-separated list of colon-separated pairs
|
||||
|
@ -48,7 +49,7 @@ func main() {
|
|||
description := flag.String("description", "The easiest, most secure, cross platform way to use WireGuard + oauth2 + 2FA/SSO", "package description")
|
||||
goarch := flag.String("arch", "amd64", "GOARCH this package is for")
|
||||
pkgType := flag.String("type", "deb", "type of package to build (deb or rpm)")
|
||||
files := flag.String("files", "", "comma-separated list of files in src:dst form")
|
||||
filesFlag := flag.String("files", "", "comma-separated list of files in src:dst form")
|
||||
configFiles := flag.String("configs", "", "like --files, but for files marked as user-editable config files")
|
||||
emptyDirs := flag.String("emptydirs", "", "comma-separated list of empty directories")
|
||||
version := flag.String("version", "0.0.0", "version of the package")
|
||||
|
@ -60,7 +61,7 @@ func main() {
|
|||
recommends := flag.String("recommends", "", "comma-separated list of packages this package recommends")
|
||||
flag.Parse()
|
||||
|
||||
filesMap, err := parseFiles(*files)
|
||||
filesMap, err := parseFiles(*filesFlag)
|
||||
if err != nil {
|
||||
log.Fatalf("Parsing --files: %v", err)
|
||||
}
|
||||
|
@ -69,6 +70,29 @@ func main() {
|
|||
log.Fatalf("Parsing --configs: %v", err)
|
||||
}
|
||||
emptyDirList := parseEmptyDirs(*emptyDirs)
|
||||
|
||||
contents := files.Contents{}
|
||||
for src, dst := range filesMap {
|
||||
contents = append(contents, &files.Content{
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
Type: files.TypeFile,
|
||||
})
|
||||
}
|
||||
for src, dst := range configsMap {
|
||||
contents = append(contents, &files.Content{
|
||||
Source: src,
|
||||
Destination: dst,
|
||||
Type: files.TypeConfig,
|
||||
})
|
||||
}
|
||||
for _, dir := range emptyDirList {
|
||||
contents = append(contents, &files.Content{
|
||||
Destination: dir,
|
||||
Type: files.TypeDir,
|
||||
})
|
||||
}
|
||||
|
||||
info := nfpm.WithDefaults(&nfpm.Info{
|
||||
Name: *name,
|
||||
Arch: *goarch,
|
||||
|
@ -79,9 +103,7 @@ func main() {
|
|||
Homepage: "https://www.tailscale.com",
|
||||
License: "MIT",
|
||||
Overridables: nfpm.Overridables{
|
||||
EmptyFolders: emptyDirList,
|
||||
Files: filesMap,
|
||||
ConfigFiles: configsMap,
|
||||
Contents: contents,
|
||||
Scripts: nfpm.Scripts{
|
||||
PostInstall: *postinst,
|
||||
PreRemove: *prerm,
|
||||
|
|
7
go.mod
7
go.mod
|
@ -33,7 +33,7 @@ require (
|
|||
github.com/google/go-containerregistry v0.14.0
|
||||
github.com/google/nftables v0.1.1-0.20230115205135-9aa6fdf5a28c
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/goreleaser/nfpm v1.10.3
|
||||
github.com/goreleaser/nfpm/v2 v2.28.0
|
||||
github.com/hdevalence/ed25519consensus v0.1.0
|
||||
github.com/iancoleman/strcase v0.2.0
|
||||
github.com/illarion/gonotify v1.0.1
|
||||
|
@ -104,6 +104,7 @@ require (
|
|||
4d63.com/gochecknoglobals v0.2.1 // indirect
|
||||
filippo.io/edwards25519 v1.0.0 // indirect
|
||||
github.com/Abirdcfly/dupword v0.0.11 // indirect
|
||||
github.com/AlekSi/pointer v1.2.0 // indirect
|
||||
github.com/Antonboom/errname v0.1.9 // indirect
|
||||
github.com/Antonboom/nilnil v0.1.4 // indirect
|
||||
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||
|
@ -201,10 +202,9 @@ require (
|
|||
github.com/google/gnostic v0.6.9 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 // indirect
|
||||
github.com/google/rpmpack v0.0.0-20221120200012-98b63d62fd77 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect
|
||||
github.com/goreleaser/chglog v0.4.2 // indirect
|
||||
github.com/goreleaser/fileglob v0.3.1 // indirect
|
||||
github.com/goreleaser/fileglob v1.3.0 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.4.2 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
|
||||
|
@ -287,7 +287,6 @@ require (
|
|||
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect
|
||||
github.com/sassoftware/go-rpmutils v0.2.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.15.0 // indirect
|
||||
github.com/sergi/go-diff v1.3.1 // indirect
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
|
||||
|
|
|
@ -15,8 +15,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/goreleaser/nfpm"
|
||||
_ "github.com/goreleaser/nfpm/deb"
|
||||
"github.com/goreleaser/nfpm/v2"
|
||||
_ "github.com/goreleaser/nfpm/v2/deb"
|
||||
)
|
||||
|
||||
func TestDebInfo(t *testing.T) {
|
||||
|
@ -38,6 +38,7 @@ func TestDebInfo(t *testing.T) {
|
|||
"Section", "net",
|
||||
"Priority", "extra",
|
||||
"Architecture", "amd64",
|
||||
"Maintainer", "Unset Maintainer <unset@localhost>",
|
||||
"Installed-Size", "0",
|
||||
"Description", "test package"),
|
||||
},
|
||||
|
@ -54,6 +55,7 @@ func TestDebInfo(t *testing.T) {
|
|||
"Section", "net",
|
||||
"Priority", "extra",
|
||||
"Architecture", "arm64",
|
||||
"Maintainer", "Unset Maintainer <unset@localhost>",
|
||||
"Installed-Size", "0",
|
||||
"Description", "test package"),
|
||||
},
|
||||
|
@ -70,6 +72,7 @@ func TestDebInfo(t *testing.T) {
|
|||
"Section", "net",
|
||||
"Priority", "extra",
|
||||
"Architecture", "amd64",
|
||||
"Maintainer", "Unset Maintainer <unset@localhost>",
|
||||
"Installed-Size", "0",
|
||||
"Description", "test package"),
|
||||
},
|
||||
|
|
|
@ -16,7 +16,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/goreleaser/nfpm"
|
||||
"github.com/goreleaser/nfpm/v2"
|
||||
"github.com/goreleaser/nfpm/v2/files"
|
||||
"tailscale.com/release/dist"
|
||||
)
|
||||
|
||||
|
@ -203,13 +204,11 @@ func (t *debTarget) Build(b *dist.Build) ([]string, error) {
|
|||
Section: "net",
|
||||
Priority: "extra",
|
||||
Overridables: nfpm.Overridables{
|
||||
Files: map[string]string{
|
||||
ts: "/usr/bin/tailscale",
|
||||
tsd: "/usr/sbin/tailscaled",
|
||||
filepath.Join(tailscaledDir, "tailscaled.service"): "/lib/systemd/system/tailscaled.service",
|
||||
},
|
||||
ConfigFiles: map[string]string{
|
||||
filepath.Join(tailscaledDir, "tailscaled.defaults"): "/etc/default/tailscaled",
|
||||
Contents: files.Contents{
|
||||
{Source: ts, Destination: "/usr/bin/tailscale", Type: files.TypeFile},
|
||||
{Source: tsd, Destination: "/usr/sbin/tailscaled", Type: files.TypeFile},
|
||||
{Source: filepath.Join(tailscaledDir, "tailscaled.service"), Destination: "/lib/systemd/system/tailscaled.service", Type: files.TypeFile},
|
||||
{Source: filepath.Join(tailscaledDir, "tailscaled.defaults"), Destination: "/etc/default/tailscaled", Type: files.TypeConfig},
|
||||
},
|
||||
Scripts: nfpm.Scripts{
|
||||
PostInstall: filepath.Join(repoDir, "release/deb/debian.postinst.sh"),
|
||||
|
@ -294,17 +293,15 @@ func (t *rpmTarget) Build(b *dist.Build) ([]string, error) {
|
|||
Homepage: "https://www.tailscale.com",
|
||||
License: "MIT",
|
||||
Overridables: nfpm.Overridables{
|
||||
Files: map[string]string{
|
||||
ts: "/usr/bin/tailscale",
|
||||
tsd: "/usr/sbin/tailscaled",
|
||||
filepath.Join(tailscaledDir, "tailscaled.service"): "/lib/systemd/system/tailscaled.service",
|
||||
Contents: files.Contents{
|
||||
{Source: ts, Destination: "/usr/bin/tailscale", Type: files.TypeFile},
|
||||
{Source: tsd, Destination: "/usr/sbin/tailscaled", Type: files.TypeFile},
|
||||
{Source: filepath.Join(tailscaledDir, "tailscaled.service"), Destination: "/lib/systemd/system/tailscaled.service", Type: files.TypeFile},
|
||||
{Source: filepath.Join(tailscaledDir, "tailscaled.defaults"), Destination: "/etc/default/tailscaled", Type: files.TypeConfig},
|
||||
// SELinux policy on e.g. CentOS 8 forbids writing to /var/cache.
|
||||
// Creating an empty directory at install time resolves this issue.
|
||||
{Destination: "/var/cache/tailscale", Type: files.TypeDir},
|
||||
},
|
||||
ConfigFiles: map[string]string{
|
||||
filepath.Join(tailscaledDir, "tailscaled.defaults"): "/etc/default/tailscaled",
|
||||
},
|
||||
// SELinux policy on e.g. CentOS 8 forbids writing to /var/cache.
|
||||
// Creating an empty directory at install time resolves this issue.
|
||||
EmptyFolders: []string{"/var/cache/tailscale"},
|
||||
Scripts: nfpm.Scripts{
|
||||
PostInstall: filepath.Join(repoDir, "release/rpm/rpm.postinst.sh"),
|
||||
PreRemove: filepath.Join(repoDir, "release/rpm/rpm.prerm.sh"),
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
|
||||
"tailscale.com/release/dist"
|
||||
|
||||
_ "github.com/goreleaser/nfpm/deb"
|
||||
_ "github.com/goreleaser/nfpm/rpm"
|
||||
_ "github.com/goreleaser/nfpm/v2/deb"
|
||||
_ "github.com/goreleaser/nfpm/v2/rpm"
|
||||
)
|
||||
|
||||
func Targets() []dist.Target {
|
||||
|
|
Loading…
Reference in New Issue