New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add packager-specific nfpm config (#1829) #1849
Changes from 1 commit
1449777
b422197
5d815ff
ca44ac5
8b68b09
9ecc6ef
eb7a59e
213c807
50b3919
a2ceae5
03eeeab
4026a2d
d4712e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,6 +322,63 @@ type NFPMScripts struct { | |
PostRemove string `yaml:"postremove,omitempty"` | ||
} | ||
|
||
// NFPMDebScripts is scripts only available on deb packages. | ||
type NFPMDebScripts struct { | ||
Rules string `yaml:"rules,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add
|
||
} | ||
|
||
// NFPMDebTriggers contains triggers only available for deb packages. | ||
// https://wiki.debian.org/DpkgTriggers | ||
// https://man7.org/linux/man-pages/man5/deb-triggers.5.html | ||
type NFPMDebTriggers struct { | ||
Interest []string `yaml:"interest,omitempty"` | ||
InterestAwait []string `yaml:"interest_await,omitempty"` | ||
InterestNoAwait []string `yaml:"interest_noawait,omitempty"` | ||
Activate []string `yaml:"activate,omitempty"` | ||
ActivateAwait []string `yaml:"activate_await,omitempty"` | ||
ActivateNoAwait []string `yaml:"activate_noawait,omitempty"` | ||
} | ||
|
||
// NFPMDebSignature contains config for signing deb packages created by nfpm. | ||
type NFPMDebSignature struct { | ||
// PGP secret key, can be ASCII-armored | ||
KeyFile string `yaml:"key_file,omitempty"` | ||
KeyPassphrase string `yaml:"-"` // populated from environment variable | ||
// origin, maint or archive (defaults to origin) | ||
Type string `yaml:"type,omitempty"` | ||
} | ||
|
||
// type alias to prevent stack overflowing in the custom unmarshaler. | ||
type nfpmDebSignature NFPMDebSignature | ||
|
||
func (nds *NFPMDebSignature) UnmarshalYAML(unmarshal func(interface{}) error) error { | ||
var sig nfpmDebSignature | ||
if err := unmarshal(&sig); err != nil { | ||
return err | ||
} | ||
|
||
debPassphrase := os.Getenv("NFPM_DEB_PASSPHRASE") | ||
if debPassphrase != "" { | ||
sig.KeyPassphrase = debPassphrase | ||
} else { | ||
generalPassphrase := os.Getenv("NFPM_PASSPHRASE") | ||
sig.KeyPassphrase = generalPassphrase | ||
} | ||
|
||
*nds = NFPMDebSignature(sig) | ||
|
||
return nil | ||
} | ||
|
||
// NFPMDeb is custom configs that are only available on deb packages. | ||
type NFPMDeb struct { | ||
Scripts NFPMDebScripts `yaml:"scripts,omitempty"` | ||
Triggers NFPMDebTriggers `yaml:"triggers,omitempty"` | ||
Breaks []string `yaml:"breaks,omitempty"` | ||
VersionMetadata string `yaml:"metadata,omitempty"` // Deprecated: Moved to Info | ||
Signature NFPMDebSignature `yaml:"signature,omitempty"` | ||
} | ||
|
||
// NFPMOverridables is used to specify per package format settings. | ||
type NFPMOverridables struct { | ||
FileNameTemplate string `yaml:"file_name_template,omitempty"` | ||
|
@@ -337,6 +394,7 @@ type NFPMOverridables struct { | |
Files map[string]string `yaml:",omitempty"` | ||
ConfigFiles map[string]string `yaml:"config_files,omitempty"` | ||
Scripts NFPMScripts `yaml:"scripts,omitempty"` | ||
Deb NFPMDeb `yaml:"deb,omitempty"` | ||
} | ||
|
||
// Sign config. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,39 @@ nfpms: | |
"tmp/app_generated.conf": "/etc/app-rpm.conf" | ||
scripts: | ||
preinstall: "scripts/preinstall-rpm.sh" | ||
|
||
# Custon configuration applied only to the Deb packager. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
deb: | ||
# Custom deb rules script. | ||
scripts: | ||
rules: foo.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this to this
|
||
|
||
# Custom deb triggers | ||
triggers: | ||
# register interrest on a trigger activated by another package | ||
# (also available: interest_await, interest_noawait) | ||
interest: | ||
- some-trigger-name | ||
# activate a trigger for another package | ||
# (also available: activate_await, activate_noawait) | ||
activate: | ||
- another-trigger-name | ||
|
||
# Packages which would break if this package would be installed. | ||
# The installation of this package is blocked if `some-package` | ||
# is already installed. | ||
breaks: | ||
- some-package | ||
|
||
# The package is signed if a key_file is set | ||
signature: | ||
# PGP secret key (can also be ASCII-armored). The passphrase is taken | ||
# from the environment variable $NFPM_DEB_PASSPHRASE with a fallback | ||
# to #NFPM_PASSPHRASE. | ||
key_file: key.gpg | ||
# The type describes the signers role, possible values are "origin", | ||
# "maint" and "archive". If unset, the type defaults to "origin". | ||
type: origin | ||
``` | ||
|
||
!!! tip | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add