# lib/poptK.c

Go to the documentation of this file.

    00001
    00006 #include "system.h"
    00007
    00008 #include <rpmcli.h>
    00009
    00010 #include "debug.h"
    00011
    00012 /*@unchecked@*/
    00013 struct rpmSignArguments_s rpmKArgs =
    00014         { RESIGN_NONE, CHECKSIG_ALL, 0, NULL };
    00015
    00016 #define POPT_ADDSIGN            -1005
    00017 #define POPT_RESIGN             -1006
    00018
    00021 static void signArgCallback( /*@unused@*/ poptContext con,
    00022                 /*@unused@*/ enum poptCallbackReason reason,
    00023                 const struct poptOption * opt, /*@unused@*/ const char * arg,
    00024                 /*@unused@*/ const void * data)
    00025         /*@modifies rpmKArgs @*/
    00026 {
    00027     struct rpmSignArguments_s * rka = &rpmKArgs;
    00028
    00029     switch (opt->val) {
    00030     case 'K':
    00031         rka->addSign = RESIGN_CHK_SIGNATURE;
    00032         rka->sign = 0;
    00033         break;
    00034
    00035     case POPT_RESIGN:
    00036         rka->addSign = RESIGN_NEW_SIGNATURE;
    00037         rka->sign = 1;
    00038         break;
    00039
    00040     case POPT_ADDSIGN:
    00041         rka->addSign = RESIGN_ADD_SIGNATURE;
    00042         rka->sign = 1;
    00043         break;
    00044     }
    00045 }
    00046
    00049 /*@unchecked@*/
    00050 struct poptOption rpmSignPoptTable[] = {
    00051  { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
    00052         signArgCallback, 0, NULL, NULL },
    00053  { "addsign", '\0', 0, 0, POPT_ADDSIGN,
    00054         N_("add a signature to a package"), NULL },
    00055  { "resign", '\0', 0, 0, POPT_RESIGN,
    00056         N_("sign a package (discard current signature)"), NULL },
    00057  { "sign", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmKArgs.sign, 0,
    00058         N_("generate signature"), NULL },
    00059  { "checksig", 'K', 0, 0, 'K',
    00060         N_("verify package signature"), NULL },
    00061  { "nogpg", '\0', POPT_BIT_CLR,
    00062         &rpmKArgs.checksigFlags, CHECKSIG_GPG,
    00063         N_("skip any GPG signatures"), NULL },
    00064  { "nopgp", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN,
    00065         &rpmKArgs.checksigFlags, CHECKSIG_PGP,
    00066         N_("skip any PGP signatures"), NULL },
    00067  { "nomd5", '\0', POPT_BIT_CLR,
    00068         &rpmKArgs.checksigFlags, CHECKSIG_MD5,
    00069         N_("do not verify file md5 checksums"), NULL },
    00070
    00071    POPT_TABLEEND
    00072 };