Skip to content

Commit 162e83d

Browse files
authored
Add support of --license flag with AGPLv3 as the default one (#10)
1 parent 4002927 commit 162e83d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

main.go

+10-8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ var (
6161
Default("deb,rpm,apk").
6262
Short('p').
6363
Enum("deb", "rpm", "apk", "deb,rpm,apk")
64+
license = app.Flag("license", "Set the license of this package, defaults to `AGPLv3`").
65+
Default("AGPLv3").Short('l').String()
6466
releaseDir = app.Flag("releaseDir", "Release directory (that contains os-arch specific dirs) to pick up binaries to package, defaults to `appName+\"-release\"`").
6567
Short('d').String()
6668
scriptsDir = app.Flag("scriptsDir", "Directory that contains package scripts (preinstall.sh, postinstall.sh, preremove.sh and postremove.sh), defaults to the current directory").
@@ -77,17 +79,13 @@ description: |
7779
{{ .Description }}
7880
vendor: "MinIO, Inc."
7981
homepage: "https://min.io"
80-
license: "AGPLv3"
82+
license: "{{ .License }}"
8183
rpm:
8284
group: Applications/File
8385
contents:
8486
- src: {{ .ReleaseDir }}/{{ .OS }}-{{ .Arch }}/{{ .Binary }}.{{ .Release }}
8587
dst: /usr/local/bin/{{ .App }}
86-
{{if eq .Binary "minio" }}
87-
- src: minio.service
88-
dst: /lib/systemd/system/minio.service
89-
{{end}}
90-
{{if eq .Binary "aistor" }}
88+
{{if or (eq .Binary "minio") (eq .Binary "aistor")}}
9189
- src: minio.service
9290
dst: /lib/systemd/system/minio.service
9391
{{end}}
@@ -428,7 +426,7 @@ func main() {
428426
}
429427

430428
semVerTag := semVerRelease(*release)
431-
if err := doPackage(*appName, *release, *packager, *scriptsDir); err != nil {
429+
if err := doPackage(*appName, *license, *release, *packager, *scriptsDir); err != nil {
432430
if !*ignoreMissingArch {
433431
kingpin.Fatalf(err.Error())
434432
} else {
@@ -457,6 +455,7 @@ func main() {
457455

458456
type releaseTmpl struct {
459457
App string
458+
License string
460459
ReleaseDir string
461460
Binary string
462461
Description string
@@ -502,7 +501,7 @@ func semVerRelease(release string) string {
502501
}
503502

504503
// nolint:funlen
505-
func doPackage(appName, release, packager, scriptsDir string) error {
504+
func doPackage(appName, license, release, packager, scriptsDir string) error {
506505
mtmpl, err := template.New("minio").Parse(tmpl)
507506
if err != nil {
508507
return err
@@ -532,6 +531,9 @@ func doPackage(appName, release, packager, scriptsDir string) error {
532531
}
533532
return appName
534533
}(),
534+
License: func() string {
535+
return license
536+
}(),
535537
ReleaseDir: releaseDirName(),
536538
Binary: func() string {
537539
if appName == "minio-enterprise" {

0 commit comments

Comments
 (0)