mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Add batch flag for publish commands
This commit is contained in:
@@ -16,6 +16,7 @@ func getSigner(flags *flag.FlagSet) (utils.Signer, error) {
|
|||||||
signer.SetKey(flags.Lookup("gpg-key").Value.String())
|
signer.SetKey(flags.Lookup("gpg-key").Value.String())
|
||||||
signer.SetKeyRing(flags.Lookup("keyring").Value.String(), flags.Lookup("secret-keyring").Value.String())
|
signer.SetKeyRing(flags.Lookup("keyring").Value.String(), flags.Lookup("secret-keyring").Value.String())
|
||||||
signer.SetPassphrase(flags.Lookup("passphrase").Value.String(), flags.Lookup("passphrase-file").Value.String())
|
signer.SetPassphrase(flags.Lookup("passphrase").Value.String(), flags.Lookup("passphrase-file").Value.String())
|
||||||
|
signer.SetBatch(flags.Lookup("batch").Value.Get().(bool))
|
||||||
|
|
||||||
err := signer.Init()
|
err := signer.Init()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ Example:
|
|||||||
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
|
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
|
||||||
cmd.Flag.String("component", "", "component names to update (for multi-component publishing, separate components with commas)")
|
cmd.Flag.String("component", "", "component names to update (for multi-component publishing, separate components with commas)")
|
||||||
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
||||||
|
cmd.Flag.Bool("batch", false, "run gpg with a detached tty")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ Example:
|
|||||||
cmd.Flag.String("passphrase-file", "", "GPG passhprase-file for the key (warning: could be insecure)")
|
cmd.Flag.String("passphrase-file", "", "GPG passhprase-file for the key (warning: could be insecure)")
|
||||||
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
|
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
|
||||||
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
||||||
|
cmd.Flag.Bool("batch", false, "run gpg with a detached tty")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ type Signer interface {
|
|||||||
SetKey(keyRef string)
|
SetKey(keyRef string)
|
||||||
SetKeyRing(keyring, secretKeyring string)
|
SetKeyRing(keyring, secretKeyring string)
|
||||||
SetPassphrase(passphrase, passphraseFile string)
|
SetPassphrase(passphrase, passphraseFile string)
|
||||||
|
SetBatch(batch bool)
|
||||||
DetachedSign(source string, destination string) error
|
DetachedSign(source string, destination string) error
|
||||||
ClearSign(source string, destination string) error
|
ClearSign(source string, destination string) error
|
||||||
}
|
}
|
||||||
@@ -42,6 +43,11 @@ type GpgSigner struct {
|
|||||||
keyRef string
|
keyRef string
|
||||||
keyring, secretKeyring string
|
keyring, secretKeyring string
|
||||||
passphrase, passphraseFile string
|
passphrase, passphraseFile string
|
||||||
|
batch bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GpgSigner) SetBatch(batch bool) {
|
||||||
|
g.batch = batch
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetKey sets key ID to use when signing files
|
// SetKey sets key ID to use when signing files
|
||||||
@@ -79,6 +85,9 @@ func (g *GpgSigner) gpgArgs() []string {
|
|||||||
if g.passphraseFile != "" {
|
if g.passphraseFile != "" {
|
||||||
args = append(args, "--passphrase-file", g.passphraseFile)
|
args = append(args, "--passphrase-file", g.passphraseFile)
|
||||||
}
|
}
|
||||||
|
if g.batch {
|
||||||
|
args = append(args, "--no-tty")
|
||||||
|
}
|
||||||
|
|
||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user