6 #include <rpm/rpmcli.h> 7 #include <rpm/rpmsign.h> 9 #include "lib/rpmsignfiles.h" 12 #if !defined(__GLIBC__) && !defined(__APPLE__) 30 N_(
"sign package(s)"), NULL },
32 N_(
"sign package(s) (identical to --addsign)"), NULL },
34 N_(
"delete package signatures"), NULL },
35 {
"signfiles",
'\0', POPT_ARG_NONE, &
signfiles, 0,
36 N_(
"sign package(s) files"), NULL},
38 N_(
"use file signing key <key>"),
40 {
"fskpass",
'\0', POPT_ARG_NONE, &
fskpass, 0,
41 N_(
"prompt for file signing key password"), NULL},
47 N_(
"Signature options:"), NULL },
49 N_(
"Common options for all rpm modes and executables:"), NULL },
57 static int doSign(poptContext optCon)
59 int rc = EXIT_FAILURE;
60 char * passPhrase = NULL;
61 char * name =
rpmExpand(
"%{?_gpg_name}", NULL);
65 fprintf(stderr,
_(
"You must set \"%%_gpg_name\" in your macro file\n"));
74 const char *key =
rpmExpand(
"%{?_file_signing_key}", NULL);
76 fprintf(stderr,
_(
"You must set \"$$_file_signing_key\" in your macro file or on the command line with --fskpath\n"));
82 argerror(
_(
"--fskpass may only be specified when signing files"));
88 addMacro(NULL,
"_file_signing_key_password", NULL,
100 while ((arg = poptGetArg(optCon)) != NULL) {
110 int main(
int argc,
char *argv[])
112 int ec = EXIT_FAILURE;
121 if (poptPeekArg(optCon) == NULL) {
126 argerror(
_(
"--fskpath may only be specified when signing files"));
136 while ((arg = poptGetArg(optCon)) != NULL) {
141 argerror(
_(
"only one major mode may be specified"));
int rpmPkgSign(const char *path, const struct rpmSignArgs *args)
Sign a package.
void printUsage(poptContext con, FILE *fp, int flags)
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
Misc helpers for RPM CLI tools.
static char * fileSigningKeyPassword
void argerror(const char *desc)
static struct poptOption optionsTable[]
static struct poptOption signOptsTable[]
static int rstreq(const char *s1, const char *s2)
Test for string equality.
int main(int argc, char *argv[])
void addMacro(rpmMacroContext mc, const char *n, const char *o, const char *b, int level)
Add macro to context.
int rpmPkgDelSign(const char *path)
Delete signature(s) from a package.
char * rpmExpand(const char *arg,...) RPM_GNUC_NULL_TERMINATED
Return (malloc'ed) concatenated macro expansion(s).
static char * fileSigningKey
static int doSign(poptContext optCon)
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.