Skip to content

Commit

Permalink
try changing package function
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgopack4 committed Nov 19, 2024
1 parent 30f3152 commit 9eb8e7e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 90 deletions.
17 changes: 5 additions & 12 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,13 @@ func Packages(dist string) (r []config.NFPM) {
return []config.NFPM{}
}
return []config.NFPM{
Package(dist, true),
Package(dist, false),
Package(dist),
}
}

// Package configures goreleaser to build a system package.
// https://goreleaser.com/customization/nfpm/
func Package(dist string, pie bool) config.NFPM {
id := dist
build := dist
if pie {
id = id + "-pie"
build = build + "-pie"
}
func Package(dist string) config.NFPM {
nfpmContents := config.NFPMContents{
{
Source: fmt.Sprintf("%s.service", dist),
Expand All @@ -242,8 +235,8 @@ func Package(dist string, pie bool) config.NFPM {
})
}
return config.NFPM{
ID: id,
Builds: []string{build},
ID: dist,
Builds: []string{dist},
Formats: []string{"deb", "rpm"},

License: "Apache 2.0",
Expand All @@ -258,7 +251,7 @@ func Package(dist string, pie bool) config.NFPM {
},

NFPMOverridables: config.NFPMOverridables{
PackageName: id,
PackageName: dist,
Scripts: config.NFPMScripts{
PreInstall: "preinstall.sh",
PostInstall: "postinstall.sh",
Expand Down
27 changes: 0 additions & 27 deletions distributions/otelcol-contrib/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,6 @@ archives:
- otelcol-contrib
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
nfpms:
- package_name: otelcol-contrib-pie
contents:
- src: otelcol-contrib.service
dst: /lib/systemd/system/otelcol-contrib.service
- src: otelcol-contrib.conf
dst: /etc/otelcol-contrib/otelcol-contrib.conf
type: config|noreplace
- src: config.yaml
dst: /etc/otelcol-contrib/config.yaml
type: config|noreplace
scripts:
preinstall: preinstall.sh
postinstall: postinstall.sh
preremove: preremove.sh
overrides:
rpm:
dependencies:
- /bin/sh
id: otelcol-contrib-pie
builds:
- otelcol-contrib-pie
formats:
- deb
- rpm
maintainer: The OpenTelemetry Collector maintainers <[email protected]>
description: OpenTelemetry Collector - otelcol-contrib
license: Apache 2.0
- package_name: otelcol-contrib
contents:
- src: otelcol-contrib.service
Expand Down
24 changes: 0 additions & 24 deletions distributions/otelcol-otlp/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,30 +118,6 @@ archives:
- otelcol-otlp
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
nfpms:
- package_name: otelcol-otlp-pie
contents:
- src: otelcol-otlp.service
dst: /lib/systemd/system/otelcol-otlp.service
- src: otelcol-otlp.conf
dst: /etc/otelcol-otlp/otelcol-otlp.conf
type: config|noreplace
scripts:
preinstall: preinstall.sh
postinstall: postinstall.sh
preremove: preremove.sh
overrides:
rpm:
dependencies:
- /bin/sh
id: otelcol-otlp-pie
builds:
- otelcol-otlp-pie
formats:
- deb
- rpm
maintainer: The OpenTelemetry Collector maintainers <[email protected]>
description: OpenTelemetry Collector - otelcol-otlp
license: Apache 2.0
- package_name: otelcol-otlp
contents:
- src: otelcol-otlp.service
Expand Down
27 changes: 0 additions & 27 deletions distributions/otelcol/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,6 @@ archives:
- otelcol
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
nfpms:
- package_name: otelcol-pie
contents:
- src: otelcol.service
dst: /lib/systemd/system/otelcol.service
- src: otelcol.conf
dst: /etc/otelcol/otelcol.conf
type: config|noreplace
- src: config.yaml
dst: /etc/otelcol/config.yaml
type: config|noreplace
scripts:
preinstall: preinstall.sh
postinstall: postinstall.sh
preremove: preremove.sh
overrides:
rpm:
dependencies:
- /bin/sh
id: otelcol-pie
builds:
- otelcol-pie
formats:
- deb
- rpm
maintainer: The OpenTelemetry Collector maintainers <[email protected]>
description: OpenTelemetry Collector - otelcol
license: Apache 2.0
- package_name: otelcol
contents:
- src: otelcol.service
Expand Down

0 comments on commit 9eb8e7e

Please sign in to comment.