#include "install.h"
#include "lib/rpmerr.h"
#include "lib/messages.h"
+#include "lib/signature.h"
#include "query.h"
#include "verify.h"
#include "rpmlib.h"
void printVersion(void);
void printBanner(void);
void printUsage(void);
-void build(char * arg, int buildAmount);
+void build(char * arg, int buildAmount, char *passPhrase);
void printVersion(void) {
printf("RPM version %s\n", version);
puts(" and remove spec file, sources, patches, and icons.");
}
-void build(char * arg, int buildAmount) {
+void build(char * arg, int buildAmount, char *passPhrase) {
FILE *f;
Spec s;
char * specfile;
-
+
if (arg[0] == '/') {
specfile = arg;
} else {
s = parseSpec(f, specfile);
fclose(f);
if (s) {
- if (doBuild(s, buildAmount)) {
+ if (doBuild(s, buildAmount, passPhrase)) {
fprintf(stderr, "Build failed.\n");
}
freeSpec(s);
int interfaceFlags = 0;
int buildAmount = 0;
int clean = 0;
+ int signIt = 0;
char * prefix = "/";
char * specFile;
+ char *passPhrase = "";
struct option options[] = {
{ "all", 0, 0, 'a' },
{ "build", 1, 0, 'b' },
{ "replacefiles", 0, &replaceFiles, 0 },
{ "replacepkgs", 0, &replacePackages, 0 },
{ "root", 1, 0, 'r' },
+ { "sign", 0, &signIt, 0 },
{ "state", 0, 0, 's' },
{ "stdin-files", 0, 0, 'F' },
{ "stdin-group", 0, 0, 'G' },
if (bigMode != MODE_BUILD && clean)
argerror("--clean may only be used during package building");
+ if (signIt) {
+ if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD) {
+ if ((optind != argc) && (sigLookupType() == RPMSIG_PGP262_1024)) {
+ passPhrase = strdup(getPassPhrase("Enter pass phrase:"));
+ }
+ } else {
+ argerror("--sign may only be used during package building");
+ }
+ } else {
+ /* Override any rpmrc setting */
+ setVar(RPMVAR_SIGTYPE, "none");
+ }
+
switch (bigMode) {
case MODE_UNKNOWN:
if (!version && !help) printUsage();
if (doSourceInstall("/", argv[optind++], &specFile))
exit(-1);
- build(specFile, buildAmount);
+ build(specFile, buildAmount, passPhrase);
}
break;
argerror("no spec files given for build");
while (optind < argc)
- build(argv[optind++], buildAmount);
+ build(argv[optind++], buildAmount, passPhrase);
break;
case MODE_UNINSTALL: