2000-05-19 05:03:14 +08:00
|
|
|
#include "system.h"
|
2005-01-18 07:58:09 +08:00
|
|
|
const char *__progname;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2007-12-08 20:02:32 +08:00
|
|
|
#include <rpm/rpmcli.h>
|
2008-01-30 19:53:51 +08:00
|
|
|
#include <rpm/rpmlib.h> /* RPMSIGTAG, rpmReadPackageFile .. */
|
2007-12-08 20:02:32 +08:00
|
|
|
#include <rpm/rpmbuild.h>
|
|
|
|
#include <rpm/rpmlog.h>
|
|
|
|
#include <rpm/rpmdb.h>
|
|
|
|
#include <rpm/rpmps.h>
|
|
|
|
#include <rpm/rpmts.h>
|
2002-05-17 00:55:21 +08:00
|
|
|
|
2010-08-20 17:08:10 +08:00
|
|
|
#include "cliutils.h"
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2000-12-13 04:03:45 +08:00
|
|
|
#include "debug.h"
|
|
|
|
|
2010-10-08 16:59:51 +08:00
|
|
|
#if defined(IAM_RPMQ) || defined(IAM_RPMV)
|
|
|
|
#define IAM_RPMQV
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
enum modes {
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
MODE_QUERY = (1 << 0),
|
2000-05-25 01:53:35 +08:00
|
|
|
MODE_VERIFY = (1 << 3),
|
|
|
|
#define MODES_QV (MODE_QUERY | MODE_VERIFY)
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
MODE_INSTALL = (1 << 1),
|
2001-06-09 04:45:59 +08:00
|
|
|
MODE_ERASE = (1 << 2),
|
2002-02-03 06:45:41 +08:00
|
|
|
#define MODES_IE (MODE_INSTALL | MODE_ERASE)
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
MODE_UNKNOWN = 0
|
|
|
|
};
|
|
|
|
|
2010-09-03 21:57:50 +08:00
|
|
|
#define MODES_FOR_DBPATH (MODES_IE | MODES_QV)
|
2010-08-20 14:20:16 +08:00
|
|
|
#define MODES_FOR_NODEPS (MODES_IE | MODE_VERIFY)
|
|
|
|
#define MODES_FOR_TEST (MODES_IE)
|
2010-09-03 21:57:50 +08:00
|
|
|
#define MODES_FOR_ROOT (MODES_IE | MODES_QV)
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2007-11-13 19:09:01 +08:00
|
|
|
static int quiet;
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
/* the structure describing the options we take and the defaults */
|
|
|
|
static struct poptOption optionsTable[] = {
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2009-03-19 22:07:18 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQVSourcePoptTable, 0,
|
|
|
|
N_("Query/Verify package selection options:"),
|
|
|
|
NULL },
|
2010-10-08 16:59:51 +08:00
|
|
|
#endif
|
|
|
|
#ifdef IAM_RPMQ
|
2001-01-02 07:14:47 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
|
|
|
|
N_("Query options (with -q or --query):"),
|
|
|
|
NULL },
|
2010-10-08 16:59:51 +08:00
|
|
|
#endif
|
|
|
|
#ifdef IAM_RPMV
|
2001-01-02 07:14:47 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
|
|
|
|
N_("Verify options (with -V or --verify):"),
|
|
|
|
NULL },
|
2010-10-08 16:59:51 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
|
|
|
|
N_("Install/Upgrade/Erase options:"),
|
|
|
|
NULL },
|
|
|
|
#endif /* IAM_RPMEIU */
|
|
|
|
|
2010-08-20 19:31:16 +08:00
|
|
|
{ "quiet", '\0', POPT_ARGFLAG_DOC_HIDDEN, &quiet, 0, NULL, NULL},
|
2007-11-13 19:09:01 +08:00
|
|
|
|
2002-07-28 08:41:15 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
|
2004-07-05 23:24:17 +08:00
|
|
|
N_("Common options for all rpm modes and executables:"),
|
2001-01-02 07:14:47 +08:00
|
|
|
NULL },
|
|
|
|
|
2001-07-08 03:15:17 +08:00
|
|
|
POPT_AUTOALIAS
|
2001-01-02 07:14:47 +08:00
|
|
|
POPT_AUTOHELP
|
|
|
|
POPT_TABLEEND
|
2000-05-19 05:03:14 +08:00
|
|
|
};
|
|
|
|
|
2007-09-18 11:53:37 +08:00
|
|
|
int main(int argc, char *argv[])
|
2000-05-19 05:03:14 +08:00
|
|
|
{
|
2002-05-20 02:42:25 +08:00
|
|
|
rpmts ts = NULL;
|
2000-05-19 05:03:14 +08:00
|
|
|
enum modes bigMode = MODE_UNKNOWN;
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2002-07-30 07:06:06 +08:00
|
|
|
#if defined(IAM_RPMQV)
|
2001-10-25 09:36:32 +08:00
|
|
|
QVA_t qva = &rpmQVKArgs;
|
2000-06-12 03:15:27 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
#ifdef IAM_RPMEIU
|
2001-06-09 04:45:59 +08:00
|
|
|
struct rpmInstallArguments_s * ia = &rpmIArgs;
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
poptContext optCon;
|
|
|
|
int ec = 0;
|
2002-06-28 21:04:38 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
|
|
|
int i;
|
|
|
|
#endif
|
2010-08-20 18:16:48 +08:00
|
|
|
|
2010-08-20 20:17:08 +08:00
|
|
|
optCon = rpmcliInit(argc, argv, optionsTable);
|
2010-08-20 18:16:48 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
/* Set the major mode based on argv[0] */
|
|
|
|
#ifdef IAM_RPMQV
|
2009-08-31 17:55:33 +08:00
|
|
|
if (rstreq(__progname, "rpmquery")) bigMode = MODE_QUERY;
|
|
|
|
if (rstreq(__progname, "rpmverify")) bigMode = MODE_VERIFY;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
2002-07-30 07:06:06 +08:00
|
|
|
#if defined(IAM_RPMQV)
|
|
|
|
/* Jumpstart option from argv[0] if necessary. */
|
|
|
|
switch (bigMode) {
|
|
|
|
case MODE_QUERY: qva->qva_mode = 'q'; break;
|
|
|
|
case MODE_VERIFY: qva->qva_mode = 'V'; break;
|
|
|
|
case MODE_INSTALL:
|
|
|
|
case MODE_ERASE:
|
|
|
|
case MODE_UNKNOWN:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-12-20 07:41:52 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2001-07-17 11:03:14 +08:00
|
|
|
if (bigMode == MODE_UNKNOWN || (bigMode & MODES_QV)) {
|
2000-05-27 02:51:11 +08:00
|
|
|
switch (qva->qva_mode) {
|
|
|
|
case 'q': bigMode = MODE_QUERY; break;
|
|
|
|
case 'V': bigMode = MODE_VERIFY; break;
|
|
|
|
}
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
if (qva->qva_sourceCount) {
|
2001-01-02 08:10:45 +08:00
|
|
|
if (qva->qva_sourceCount > 2)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("one type of query/verify may be performed at a "
|
|
|
|
"time"));
|
|
|
|
}
|
|
|
|
if (qva->qva_flags && (bigMode & ~MODES_QV))
|
|
|
|
argerror(_("unexpected query flags"));
|
|
|
|
|
|
|
|
if (qva->qva_queryFormat && (bigMode & ~MODES_QV))
|
|
|
|
argerror(_("unexpected query format"));
|
|
|
|
|
2000-06-12 03:15:27 +08:00
|
|
|
if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("unexpected query source"));
|
2001-07-11 01:59:11 +08:00
|
|
|
}
|
2001-06-09 04:45:59 +08:00
|
|
|
#endif /* IAM_RPMQV */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMEIU
|
2001-07-17 11:03:14 +08:00
|
|
|
if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
|
2001-06-09 04:45:59 +08:00
|
|
|
{ int iflags = (ia->installInterfaceFlags &
|
2001-07-11 01:59:11 +08:00
|
|
|
(INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
|
|
|
|
int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
|
2001-06-09 04:45:59 +08:00
|
|
|
|
|
|
|
if (iflags & eflags)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
else if (iflags)
|
|
|
|
bigMode = MODE_INSTALL;
|
|
|
|
else if (eflags)
|
|
|
|
bigMode = MODE_ERASE;
|
|
|
|
}
|
2002-11-30 05:35:53 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
2000-06-01 12:47:42 +08:00
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#if defined(IAM_RPMEIU)
|
2001-06-09 04:45:59 +08:00
|
|
|
if (!( bigMode == MODE_INSTALL ) &&
|
2004-07-05 23:24:17 +08:00
|
|
|
(ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_OLDPACKAGE)))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("files may only be relocated during package installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (ia->relocations && ia->prefix)
|
2002-11-16 23:06:17 +08:00
|
|
|
argerror(_("cannot use --prefix with --relocate or --excludepath"));
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && ia->relocations)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--relocate and --excludepath may only be used when installing new packages"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && ia->prefix)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--prefix may only be used when installing new packages"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (ia->prefix && ia->prefix[0] != '/')
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("arguments to --prefix must begin with a /"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--hash (-h) may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--percent may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--replacepkgs may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--excludedocs may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && ia->incldocs)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--includedocs may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("only one of --excludedocs and --includedocs may be "
|
|
|
|
"specified"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--ignorearch may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--ignoreos may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2007-04-16 20:15:10 +08:00
|
|
|
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
|
2001-06-09 04:45:59 +08:00
|
|
|
(ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--ignoresize may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2009-02-12 18:24:31 +08:00
|
|
|
if ((ia->installInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--allmatches may only be specified during package "
|
|
|
|
"erasure"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--allfiles may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
|
|
|
|
bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--justdb may only be specified during package "
|
|
|
|
"installation and erasure"));
|
|
|
|
|
2008-12-18 15:51:37 +08:00
|
|
|
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE && bigMode != MODE_VERIFY &&
|
2001-06-09 04:45:59 +08:00
|
|
|
(ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
|
2001-03-04 23:34:53 +08:00
|
|
|
argerror(_("script disabling options may only be specified during "
|
|
|
|
"package installation and erasure"));
|
|
|
|
|
2008-12-18 15:51:37 +08:00
|
|
|
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE && bigMode != MODE_VERIFY &&
|
2001-06-09 04:45:59 +08:00
|
|
|
(ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
|
2001-03-04 23:34:53 +08:00
|
|
|
argerror(_("trigger disabling options may only be specified during "
|
|
|
|
"package installation and erasure"));
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--nodeps may only be specified during package "
|
|
|
|
"building, rebuilding, recompilation, installation,"
|
|
|
|
"erasure, and verification"));
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--test may only be specified during package installation, "
|
|
|
|
"erasure, and building"));
|
2001-01-02 07:14:47 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2002-07-28 08:41:15 +08:00
|
|
|
if (rpmcliRootDir && rpmcliRootDir[1] && (bigMode & ~MODES_FOR_ROOT))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--root (-r) may only be specified during "
|
|
|
|
"installation, erasure, querying, and "
|
|
|
|
"database rebuilds"));
|
|
|
|
|
2010-08-20 15:19:26 +08:00
|
|
|
if (rpmcliRootDir && rpmcliRootDir[0] != '/') {
|
|
|
|
argerror(_("arguments to --root (-r) must begin with a /"));
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2007-11-13 19:09:01 +08:00
|
|
|
if (quiet)
|
|
|
|
rpmSetVerbosity(RPMLOG_WARNING);
|
|
|
|
|
2010-08-20 18:47:05 +08:00
|
|
|
if (rpmcliPipeOutput && initPipe())
|
|
|
|
exit(EXIT_FAILURE);
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2002-05-17 00:55:21 +08:00
|
|
|
ts = rpmtsCreate();
|
2002-07-28 08:41:15 +08:00
|
|
|
(void) rpmtsSetRootDir(ts, rpmcliRootDir);
|
2000-05-19 05:03:14 +08:00
|
|
|
switch (bigMode) {
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
2001-06-09 04:45:59 +08:00
|
|
|
case MODE_ERASE:
|
2009-02-12 18:24:31 +08:00
|
|
|
if (ia->noDeps) ia->installInterfaceFlags |= UNINSTALL_NODEPS;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2002-02-03 06:45:41 +08:00
|
|
|
if (!poptPeekArg(optCon)) {
|
2008-03-17 17:53:27 +08:00
|
|
|
argerror(_("no packages given for erase"));
|
2002-02-03 06:45:41 +08:00
|
|
|
} else {
|
2008-04-07 17:11:16 +08:00
|
|
|
ec += rpmErase(ts, ia, (ARGV_const_t) poptGetArgs(optCon));
|
2002-02-03 06:45:41 +08:00
|
|
|
}
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
|
|
|
|
2001-06-07 03:57:12 +08:00
|
|
|
case MODE_INSTALL:
|
2001-01-21 23:43:32 +08:00
|
|
|
|
|
|
|
/* RPMTRANS_FLAG_KEEPOBSOLETE */
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (!ia->incldocs) {
|
2002-08-04 06:31:39 +08:00
|
|
|
if (ia->transFlags & RPMTRANS_FLAG_NODOCS) {
|
2001-01-21 23:43:32 +08:00
|
|
|
;
|
2002-08-04 06:31:39 +08:00
|
|
|
} else if (rpmExpandNumeric("%{_excludedocs}"))
|
2001-06-09 04:45:59 +08:00
|
|
|
ia->transFlags |= RPMTRANS_FLAG_NODOCS;
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
/* we've already ensured !(!ia->prefix && !ia->relocations) */
|
|
|
|
if (ia->prefix) {
|
|
|
|
ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
|
|
|
|
ia->relocations[0].oldPath = NULL; /* special case magic */
|
|
|
|
ia->relocations[0].newPath = ia->prefix;
|
2001-09-25 05:53:14 +08:00
|
|
|
ia->relocations[1].oldPath = NULL;
|
|
|
|
ia->relocations[1].newPath = NULL;
|
2001-06-09 04:45:59 +08:00
|
|
|
} else if (ia->relocations) {
|
|
|
|
ia->relocations = xrealloc(ia->relocations,
|
|
|
|
sizeof(*ia->relocations) * (ia->numRelocations + 1));
|
|
|
|
ia->relocations[ia->numRelocations].oldPath = NULL;
|
|
|
|
ia->relocations[ia->numRelocations].newPath = NULL;
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2002-02-03 06:45:41 +08:00
|
|
|
if (!poptPeekArg(optCon)) {
|
2008-03-17 17:53:27 +08:00
|
|
|
argerror(_("no packages given for install"));
|
2002-02-03 06:45:41 +08:00
|
|
|
} else {
|
2007-09-12 01:04:11 +08:00
|
|
|
/* FIX: ia->relocations[0].newPath undefined */
|
2008-04-07 17:11:16 +08:00
|
|
|
ec += rpmInstall(ts, ia, (ARGV_t) poptGetArgs(optCon));
|
2002-02-03 06:45:41 +08:00
|
|
|
}
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2001-07-07 04:37:42 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2001-06-07 03:57:12 +08:00
|
|
|
case MODE_QUERY:
|
2010-03-19 22:54:00 +08:00
|
|
|
if (!poptPeekArg(optCon) && !(qva->qva_source == RPMQV_ALL))
|
2001-10-24 21:48:55 +08:00
|
|
|
argerror(_("no arguments given for query"));
|
2002-12-22 10:11:05 +08:00
|
|
|
|
2008-04-07 17:11:16 +08:00
|
|
|
ec = rpmcliQuery(ts, qva, (ARGV_const_t) poptGetArgs(optCon));
|
2001-10-24 21:48:55 +08:00
|
|
|
break;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-06-07 03:57:12 +08:00
|
|
|
case MODE_VERIFY:
|
2001-10-24 21:48:55 +08:00
|
|
|
{ rpmVerifyFlags verifyFlags = VERIFY_ALL;
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
verifyFlags &= ~qva->qva_flags;
|
2001-06-12 12:10:21 +08:00
|
|
|
qva->qva_flags = (rpmQueryFlags) verifyFlags;
|
|
|
|
|
2010-03-19 22:54:00 +08:00
|
|
|
if (!poptPeekArg(optCon) && !(qva->qva_source == RPMQV_ALL))
|
2001-10-24 21:48:55 +08:00
|
|
|
argerror(_("no arguments given for verify"));
|
2008-04-07 17:11:16 +08:00
|
|
|
ec = rpmcliVerify(ts, qva, (ARGV_const_t) poptGetArgs(optCon));
|
2001-10-24 21:48:55 +08:00
|
|
|
} break;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMQV */
|
|
|
|
|
2001-06-07 03:57:12 +08:00
|
|
|
#if !defined(IAM_RPMQV)
|
|
|
|
case MODE_QUERY:
|
|
|
|
case MODE_VERIFY:
|
|
|
|
#endif
|
|
|
|
#if !defined(IAM_RPMEIU)
|
|
|
|
case MODE_INSTALL:
|
2001-06-09 04:45:59 +08:00
|
|
|
case MODE_ERASE:
|
2001-06-07 03:57:12 +08:00
|
|
|
#endif
|
|
|
|
case MODE_UNKNOWN:
|
2003-01-29 01:17:26 +08:00
|
|
|
if (poptPeekArg(optCon) != NULL || argc <= 1 || rpmIsVerbose()) {
|
2008-01-07 21:37:43 +08:00
|
|
|
printUsage(optCon, stderr, 0);
|
2003-01-29 01:17:26 +08:00
|
|
|
ec = argc;
|
|
|
|
}
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-05-17 00:55:21 +08:00
|
|
|
ts = rpmtsFree(ts);
|
2010-08-20 18:47:05 +08:00
|
|
|
finishPipe();
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2001-04-29 09:05:43 +08:00
|
|
|
qva->qva_queryFormat = _free(qva->qva_queryFormat);
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
2001-06-09 04:45:59 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
2002-07-02 21:16:50 +08:00
|
|
|
if (ia->relocations != NULL)
|
2002-06-28 21:04:38 +08:00
|
|
|
for (i = 0; i < ia->numRelocations; i++)
|
2008-03-25 04:42:34 +08:00
|
|
|
ia->relocations[i].oldPath = _free(ia->relocations[i].oldPath);
|
2001-06-09 04:45:59 +08:00
|
|
|
ia->relocations = _free(ia->relocations);
|
|
|
|
#endif
|
|
|
|
|
2010-08-20 20:17:08 +08:00
|
|
|
rpmcliFini(optCon);
|
|
|
|
|
|
|
|
return RETVAL(ec);
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|