2000-05-19 05:03:14 +08:00
|
|
|
#include "system.h"
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#define _AUTOHELP
|
|
|
|
|
2001-04-29 09:05:43 +08:00
|
|
|
#if defined(IAM_RPM) || defined(__LCLINT__)
|
2000-05-25 01:53:35 +08:00
|
|
|
#define IAM_RPMBT
|
2000-05-27 02:51:11 +08:00
|
|
|
#define IAM_RPMDB
|
|
|
|
#define IAM_RPMEIU
|
|
|
|
#define IAM_RPMQV
|
|
|
|
#define IAM_RPMK
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
#include <rpmbuild.h>
|
|
|
|
#include <rpmurl.h>
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMBT
|
2000-05-19 05:03:14 +08:00
|
|
|
#include "build.h"
|
|
|
|
#define GETOPT_REBUILD 1003
|
|
|
|
#define GETOPT_RECOMPILE 1004
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IAM_RPMDB
|
2000-05-19 05:03:14 +08:00
|
|
|
#define GETOPT_REBUILDDB 1013
|
2000-05-25 01:53:35 +08:00
|
|
|
static int initdb = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IAM_RPMEIU
|
2000-05-19 05:03:14 +08:00
|
|
|
#define GETOPT_INSTALL 1014
|
|
|
|
#define GETOPT_RELOCATE 1016
|
|
|
|
#define GETOPT_EXCLUDEPATH 1019
|
2000-05-25 01:53:35 +08:00
|
|
|
static int incldocs = 0;
|
|
|
|
static char * prefix = NULL;
|
|
|
|
#endif /* IAM_RPMEIU */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMK
|
|
|
|
#define GETOPT_ADDSIGN 1005
|
|
|
|
#define GETOPT_RESIGN 1006
|
|
|
|
static int noGpg = 0;
|
|
|
|
static int noPgp = 0;
|
|
|
|
#endif /* IAM_RPMK */
|
|
|
|
|
|
|
|
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
|
|
|
|
#include "signature.h"
|
|
|
|
#endif
|
|
|
|
|
2000-12-13 04:03:45 +08:00
|
|
|
#include "debug.h"
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#define GETOPT_DBPATH 1010
|
|
|
|
#define GETOPT_SHOWRC 1018
|
2000-05-19 05:03:14 +08:00
|
|
|
#define GETOPT_DEFINEMACRO 1020
|
|
|
|
#define GETOPT_EVALMACRO 1021
|
2000-09-02 05:15:40 +08:00
|
|
|
#define GETOPT_RCFILE 1022
|
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),
|
|
|
|
MODE_QUERYTAGS = (1 << 9),
|
|
|
|
#define MODES_QV (MODE_QUERY | MODE_VERIFY)
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
MODE_INSTALL = (1 << 1),
|
|
|
|
MODE_UNINSTALL = (1 << 2),
|
2000-05-25 01:53:35 +08:00
|
|
|
#define MODES_IE (MODE_INSTALL | MODE_UNINSTALL)
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
MODE_BUILD = (1 << 4),
|
|
|
|
MODE_REBUILD = (1 << 5),
|
|
|
|
MODE_RECOMPILE = (1 << 8),
|
|
|
|
MODE_TARBUILD = (1 << 11),
|
|
|
|
#define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
MODE_CHECKSIG = (1 << 6),
|
|
|
|
MODE_RESIGN = (1 << 7),
|
2000-05-19 05:03:14 +08:00
|
|
|
#define MODES_K (MODE_CHECKSIG | MODES_RESIGN)
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
MODE_INITDB = (1 << 10),
|
|
|
|
MODE_REBUILDDB = (1 << 12),
|
|
|
|
#define MODES_DB (MODE_INITDB | MODE_REBUILDDB)
|
|
|
|
|
|
|
|
MODE_UNKNOWN = 0
|
|
|
|
};
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
#define MODES_FOR_DBPATH (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
|
|
|
|
#define MODES_FOR_NODEPS (MODES_BT | MODES_IE | MODE_VERIFY)
|
|
|
|
#define MODES_FOR_TEST (MODES_BT | MODES_IE)
|
|
|
|
#define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
|
|
|
|
|
|
|
|
extern int _ftp_debug;
|
|
|
|
extern int noLibio;
|
|
|
|
extern int _rpmio_debug;
|
|
|
|
extern int _url_debug;
|
|
|
|
extern int _noDirTokens;
|
|
|
|
|
|
|
|
extern const char * rpmNAME;
|
|
|
|
extern const char * rpmEVR;
|
|
|
|
extern int rpmFLAGS;
|
|
|
|
|
|
|
|
extern MacroContext rpmCLIMacroContext;
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
/* options for all executables */
|
|
|
|
|
|
|
|
static int help = 0;
|
|
|
|
static int noUsageMsg = 0;
|
|
|
|
static char * pipeOutput = NULL;
|
|
|
|
static int quiet = 0;
|
|
|
|
static char * rcfile = NULL;
|
|
|
|
static char * rootdir = "/";
|
|
|
|
static int showrc = 0;
|
|
|
|
static int showVersion = 0;
|
|
|
|
|
|
|
|
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
|
|
|
|
static int signIt = 0;
|
|
|
|
#endif /* IAM_RPMBT || IAM_RPMK */
|
|
|
|
|
|
|
|
#if defined(IAM_RPMQV) || defined(IAM_RPMK)
|
|
|
|
static int noMd5 = 0;
|
|
|
|
#endif
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#if defined(IAM_RPMEIU)
|
2000-05-25 01:53:35 +08:00
|
|
|
static int noDeps = 0;
|
|
|
|
#endif
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#if defined(IAM_RPMEIU)
|
2000-05-25 01:53:35 +08:00
|
|
|
static int force = 0;
|
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
static struct poptOption rpmAllPoptTable[] = {
|
|
|
|
{ "version", '\0', 0, &showVersion, 0,
|
|
|
|
N_("print the version of rpm being used"),
|
|
|
|
NULL },
|
|
|
|
{ "quiet", '\0', 0, &quiet, 0,
|
|
|
|
N_("provide less detailed output"), NULL},
|
|
|
|
{ "verbose", 'v', 0, 0, 'v',
|
|
|
|
N_("provide more detailed output"), NULL},
|
|
|
|
{ "define", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_DEFINEMACRO,
|
|
|
|
N_("define macro <name> with value <body>"),
|
|
|
|
N_("'<name> <body>'") },
|
|
|
|
{ "eval", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_EVALMACRO,
|
|
|
|
N_("print macro expansion of <expr>+"),
|
|
|
|
N_("<expr>+") },
|
|
|
|
{ "pipe", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &pipeOutput, 0,
|
|
|
|
N_("send stdout to <cmd>"),
|
|
|
|
N_("<cmd>") },
|
|
|
|
{ "root", 'r', POPT_ARG_STRING, &rootdir, 0,
|
|
|
|
N_("use <dir> as the top level directory"),
|
|
|
|
N_("<dir>") },
|
2000-09-02 05:15:40 +08:00
|
|
|
{ "macros", '\0', POPT_ARG_STRING, ¯ofiles, 0,
|
|
|
|
N_("read <file:...> instead of default macro file(s)"),
|
|
|
|
N_("<file:...>") },
|
2000-09-14 19:42:48 +08:00
|
|
|
#ifndef DYING
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "rcfile", '\0', POPT_ARG_STRING, &rcfile, 0,
|
|
|
|
N_("read <file:...> instead of default rpmrc file(s)"),
|
|
|
|
N_("<file:...>") },
|
2000-09-14 19:42:48 +08:00
|
|
|
#else
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "rcfile", '\0', 0, 0, GETOPT_RCFILE,
|
|
|
|
N_("read <file:...> instead of default rpmrc file(s)"),
|
|
|
|
N_("<file:...>") },
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "showrc", '\0', 0, &showrc, GETOPT_SHOWRC,
|
|
|
|
N_("display final rpmrc and macro configuration"),
|
|
|
|
NULL },
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2001-03-15 02:07:47 +08:00
|
|
|
#if HAVE_LIBIO_H && defined(_G_IO_IO_FILE_VERSION)
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "nolibio", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &noLibio, 1,
|
|
|
|
N_("disable use of libio(3) API"), NULL},
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
|
|
|
|
N_("debug protocol data stream"), NULL},
|
|
|
|
{ "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
|
|
|
|
N_("debug rpmio I/O"), NULL},
|
|
|
|
{ "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
|
|
|
|
N_("debug URL cache handling"), NULL},
|
|
|
|
|
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
#ifdef IAM_RPMDB
|
2001-01-02 07:14:47 +08:00
|
|
|
static struct poptOption rpmDatabasePoptTable[] = {
|
|
|
|
{ "initdb", '\0', 0, &initdb, 0,
|
|
|
|
N_("initialize database"), NULL},
|
|
|
|
{ "rebuilddb", '\0', 0, 0, GETOPT_REBUILDDB,
|
|
|
|
N_("rebuild database inverted lists from installed package headers"),
|
|
|
|
NULL},
|
|
|
|
{ "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1,
|
|
|
|
N_("generate headers compatible with (legacy) rpm[23] packaging"),
|
|
|
|
NULL},
|
|
|
|
{ "dirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("generate headers compatible with rpm4 packaging"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
|
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMDB */
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#ifdef IAM_RPMK
|
|
|
|
static struct poptOption rpmSignPoptTable[] = {
|
|
|
|
{ "addsign", '\0', 0, 0, GETOPT_ADDSIGN,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("add a signature to a package"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "resign", '\0', 0, 0, GETOPT_RESIGN,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("sign a package (discard current signature)"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "sign", '\0', 0, &signIt, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("generate PGP/GPG signature"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "checksig", 'K', 0, 0, 'K',
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("verify package signature"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "nogpg", '\0', 0, &noGpg, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("skip any PGP signatures"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "nopgp", '\0', 0, &noPgp, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("skip any GPG signatures"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "nomd5", '\0', 0, &noMd5, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("do not verify file md5 checksums"), NULL },
|
2001-01-02 07:14:47 +08:00
|
|
|
|
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
|
|
|
#endif /* IAM_RPMK */
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
2001-01-21 23:43:32 +08:00
|
|
|
static rpmtransFlags transFlags = RPMTRANS_FLAG_NONE;
|
|
|
|
static rpmprobFilterFlags probFilter = RPMPROB_FILTER_NONE;
|
|
|
|
static rpmInstallInterfaceFlags installInterfaceFlags = INSTALL_NONE;
|
|
|
|
static rpmEraseInterfaceFlags eraseInterfaceFlags = UNINSTALL_NONE;
|
|
|
|
|
|
|
|
#define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR)
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
static struct poptOption rpmInstallPoptTable[] = {
|
2001-01-21 23:43:32 +08:00
|
|
|
{ "allfiles", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_ALLFILES,
|
2001-01-02 07:14:47 +08:00
|
|
|
N_("install all files, even configurations which might otherwise be skipped"),
|
|
|
|
NULL},
|
2001-01-21 23:43:32 +08:00
|
|
|
{ "allmatches", '\0', _POPT_SET_BIT, &eraseInterfaceFlags, UNINSTALL_ALLMATCHES,
|
2001-01-02 07:14:47 +08:00
|
|
|
N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
|
|
|
|
NULL},
|
2001-03-04 23:34:53 +08:00
|
|
|
|
|
|
|
{ "apply", '\0', _POPT_SET_BIT, &transFlags,
|
|
|
|
(_noTransScripts|_noTransTriggers|
|
|
|
|
RPMTRANS_FLAG_APPLYONLY|RPMTRANS_FLAG_PKGCOMMIT),
|
|
|
|
N_("do not execute package scriptlet(s)"), NULL },
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
{ "badreloc", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_FORCERELOCATE,
|
|
|
|
N_("relocate files in non-relocateable package"), NULL},
|
|
|
|
{ "dirstash", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_DIRSTASH,
|
|
|
|
N_("save erased package files by renaming into sub-directory"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "erase", 'e', 0, 0, 'e',
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("erase (uninstall) package"), N_("<package>+") },
|
|
|
|
{ "excludedocs", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_NODOCS,
|
|
|
|
N_("do not install documentation"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "excludepath", '\0', POPT_ARG_STRING, 0, GETOPT_EXCLUDEPATH,
|
|
|
|
N_("skip files with leading component <path> "),
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("<path>") },
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "force", '\0', 0, &force, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("short hand for --replacepkgs --replacefiles"), NULL},
|
|
|
|
{ "freshen", 'F', _POPT_SET_BIT, &installInterfaceFlags,
|
|
|
|
(INSTALL_UPGRADE|INSTALL_FRESHEN),
|
|
|
|
N_("upgrade package(s) if already installed"),
|
2001-01-02 07:14:47 +08:00
|
|
|
N_("<packagefile>+") },
|
2001-01-21 23:43:32 +08:00
|
|
|
{ "hash", 'h', _POPT_SET_BIT, &installInterfaceFlags, INSTALL_HASH,
|
|
|
|
N_("print hash marks as package installs (good with -v)"), NULL},
|
|
|
|
{ "ignorearch", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_IGNOREARCH,
|
|
|
|
N_("don't verify package architecture"), NULL},
|
|
|
|
{ "ignoreos", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_IGNOREOS,
|
|
|
|
N_("don't verify package operating system"), NULL},
|
|
|
|
{ "ignoresize", '\0', _POPT_SET_BIT, &probFilter,
|
|
|
|
(RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
|
|
|
|
N_("don't check disk space before installing"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "includedocs", '\0', 0, &incldocs, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("install documentation"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "install", '\0', 0, 0, GETOPT_INSTALL,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("install package"), N_("<packagefile>+") },
|
|
|
|
{ "justdb", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_JUSTDB,
|
|
|
|
N_("update the database, but do not modify the filesystem"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "nodeps", '\0', 0, &noDeps, 0,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("do not verify package dependencies"), NULL },
|
|
|
|
{ "noorder", '\0', _POPT_SET_BIT, &installInterfaceFlags, INSTALL_NOORDER,
|
2001-01-02 07:14:47 +08:00
|
|
|
N_("do not reorder package installation to satisfy dependencies"),
|
|
|
|
NULL},
|
2001-03-04 23:34:53 +08:00
|
|
|
|
|
|
|
{ "noscripts", '\0', _POPT_SET_BIT, &transFlags,
|
|
|
|
(_noTransScripts|_noTransTriggers),
|
|
|
|
N_("do not execute package scriptlet(s)"), NULL },
|
|
|
|
{ "nopre", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOPRE,
|
|
|
|
N_("do not execute %%pre scriptlet (if any)"), NULL },
|
|
|
|
{ "nopost", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOPOST,
|
|
|
|
N_("do not execute %%post scriptlet (if any)"), NULL },
|
|
|
|
{ "nopreun", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOPREUN,
|
|
|
|
N_("do not execute %%preun scriptlet (if any)"), NULL },
|
|
|
|
{ "nopostun", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOPOSTUN,
|
|
|
|
N_("do not execute %%postun scriptlet (if any)"), NULL },
|
|
|
|
|
|
|
|
{ "notriggers", '\0', _POPT_SET_BIT, &transFlags,
|
|
|
|
_noTransTriggers,
|
|
|
|
N_("do not execute any scriptlet(s) triggered by this package"), NULL},
|
|
|
|
{ "notriggerprein", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOTRIGGERPREIN,
|
|
|
|
N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
|
|
|
|
{ "notriggerin", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOTRIGGERIN,
|
|
|
|
N_("do not execute any %%triggerin scriptlet(s)"), NULL},
|
|
|
|
{ "notriggerun", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOTRIGGERUN,
|
|
|
|
N_("do not execute any %%triggerun scriptlet(s)"), NULL},
|
|
|
|
{ "notriggerpostun", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
|
|
|
|
RPMTRANS_FLAG_NOTRIGGERPOSTUN,
|
|
|
|
N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
{ "oldpackage", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_OLDPACKAGE,
|
2001-01-02 07:14:47 +08:00
|
|
|
N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
|
|
|
|
NULL},
|
2001-01-21 23:43:32 +08:00
|
|
|
{ "percent", '\0', _POPT_SET_BIT, &installInterfaceFlags, INSTALL_PERCENT,
|
|
|
|
N_("print percentages as package installs"), NULL},
|
2001-01-02 07:14:47 +08:00
|
|
|
{ "prefix", '\0', POPT_ARG_STRING, &prefix, 0,
|
|
|
|
N_("relocate the package to <dir>, if relocatable"),
|
|
|
|
N_("<dir>") },
|
|
|
|
{ "relocate", '\0', POPT_ARG_STRING, 0, GETOPT_RELOCATE,
|
2001-01-21 23:43:32 +08:00
|
|
|
N_("relocate files from path <old> to <new>"),
|
|
|
|
N_("<old>=<new>") },
|
|
|
|
{ "repackage", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_REPACKAGE,
|
|
|
|
N_("save erased package files by repackaging"), NULL},
|
|
|
|
{ "replacefiles", '\0', _POPT_SET_BIT, &probFilter,
|
|
|
|
(RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
|
|
|
|
N_("install even if the package replaces installed files"), NULL},
|
|
|
|
{ "replacepkgs", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_REPLACEPKG,
|
|
|
|
N_("reinstall if the package is already present"), NULL},
|
|
|
|
{ "test", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_TEST,
|
|
|
|
N_("don't install, but tell if it would work or not"), NULL},
|
|
|
|
{ "upgrade", 'U', _POPT_SET_BIT, &installInterfaceFlags, INSTALL_UPGRADE,
|
|
|
|
N_("upgrade package(s)"),
|
2001-01-02 07:14:47 +08:00
|
|
|
N_("<packagefile>+") },
|
|
|
|
|
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
/* the structure describing the options we take and the defaults */
|
|
|
|
static struct poptOption optionsTable[] = {
|
|
|
|
#if !defined(_AUTOHELP)
|
|
|
|
{ "help", '\0', 0, &help, 0, NULL, NULL},
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* XXX colliding options */
|
|
|
|
#if defined(IAM_RPMQV) || defined(IAM_RPMEIU) || defined(IAM_RPMBT)
|
|
|
|
{ NULL, 'i', POPT_ARGFLAG_DOC_HIDDEN, 0, 'i', NULL, NULL},
|
|
|
|
#endif
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2001-01-02 07:14:47 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
|
|
|
|
N_("Query options (with -q or --query):"),
|
|
|
|
NULL },
|
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
|
|
|
|
N_("Verify options (with -V or --verify):"),
|
|
|
|
NULL },
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMQV */
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#ifdef IAM_RPMK
|
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmSignPoptTable, 0,
|
|
|
|
N_("Signature options:"),
|
|
|
|
NULL },
|
|
|
|
#endif /* IAM_RPMK */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMDB
|
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmDatabasePoptTable, 0,
|
|
|
|
N_("Database options:"),
|
|
|
|
NULL },
|
|
|
|
#endif /* IAM_RPMDB */
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMBT
|
2001-01-02 07:14:47 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
|
|
|
|
N_("Build options with [ <specfile> | <tarball> | <source package> ]:"),
|
|
|
|
NULL },
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMBT */
|
|
|
|
|
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 */
|
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmAllPoptTable, 0,
|
|
|
|
N_("Common options for all rpm modes:"),
|
|
|
|
NULL },
|
|
|
|
|
|
|
|
POPT_AUTOHELP
|
|
|
|
POPT_TABLEEND
|
2000-05-19 05:03:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __MINT__
|
|
|
|
/* MiNT cannot dynamically increase the stack. */
|
|
|
|
long _stksize = 64 * 1024L;
|
|
|
|
#endif
|
|
|
|
|
2001-04-29 09:05:43 +08:00
|
|
|
/*@exits@*/ static void argerror(const char * desc)
|
|
|
|
{
|
2000-05-19 05:03:14 +08:00
|
|
|
fprintf(stderr, _("rpm: %s\n"), desc);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void printVersion(void) {
|
|
|
|
fprintf(stdout, _("RPM version %s\n"), rpmEVR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void printBanner(void) {
|
2000-12-20 07:22:00 +08:00
|
|
|
puts(_("Copyright (C) 1998-2000 - Red Hat, Inc."));
|
|
|
|
puts(_("This program may be freely redistributed under the terms of the GNU GPL"));
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void printUsage(void) {
|
2000-05-25 01:53:35 +08:00
|
|
|
FILE * fp;
|
2000-05-19 05:03:14 +08:00
|
|
|
printVersion();
|
|
|
|
printBanner();
|
|
|
|
puts("");
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
fp = stdout;
|
|
|
|
|
|
|
|
fprintf(fp, _("Usage: %s {--help}\n"), __progname);
|
2000-06-22 06:05:30 +08:00
|
|
|
fprintf(fp, (" %s {--version}\n"), __progname);
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
#ifdef IAM_RPMEIU
|
2001-01-21 23:43:32 +08:00
|
|
|
#ifdef DYING
|
|
|
|
--dbpath all
|
|
|
|
--ftpproxy etc all
|
|
|
|
--force alias for --replacepkgs --replacefiles
|
|
|
|
--includedocs handle as option in table
|
|
|
|
--erase forbids many options
|
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMQV
|
2001-01-21 23:43:32 +08:00
|
|
|
#ifdef DYING /* XXX popt glue needing --help doco. */
|
|
|
|
--dbpath all
|
|
|
|
--ftpproxy etc all
|
|
|
|
-i,--info Q
|
|
|
|
-R,--requires Q
|
|
|
|
-P,--provides Q
|
|
|
|
--scripts Q
|
|
|
|
--triggeredby Q
|
|
|
|
--changelog Q
|
|
|
|
--triggers Q
|
|
|
|
--querytags !V
|
|
|
|
--setperms V
|
|
|
|
--setugids V
|
|
|
|
#endif /* DYING */
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMQV */
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
#ifdef DYING
|
2000-05-19 05:03:14 +08:00
|
|
|
static void printHelpLine(char * prefix, char * help) {
|
|
|
|
int indentLength = strlen(prefix) + 3;
|
|
|
|
int lineLength = 79 - indentLength;
|
|
|
|
int helpLength = strlen(help);
|
|
|
|
char * ch;
|
|
|
|
char format[10];
|
|
|
|
|
|
|
|
fprintf(stdout, "%s - ", prefix);
|
|
|
|
|
|
|
|
while (helpLength > lineLength) {
|
|
|
|
ch = help + lineLength - 1;
|
|
|
|
while (ch > help && !isspace(*ch)) ch--;
|
|
|
|
if (ch == help) break; /* give up */
|
|
|
|
while (ch > (help + 1) && isspace(*ch)) ch--;
|
|
|
|
ch++;
|
|
|
|
|
|
|
|
sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
|
|
|
|
fprintf(stdout, format, help, " ");
|
|
|
|
help = ch;
|
|
|
|
while (isspace(*help) && *help) help++;
|
|
|
|
helpLength = strlen(help);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (helpLength) puts(help);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void printHelp(void) {
|
|
|
|
printVersion();
|
|
|
|
printBanner();
|
|
|
|
puts("");
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
puts( _("Usage:"));
|
2000-05-19 05:03:14 +08:00
|
|
|
printHelpLine( " --help ",
|
|
|
|
_("print this message"));
|
|
|
|
printHelpLine( " --version ",
|
|
|
|
_("print the version of rpm being used"));
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
puts("");
|
|
|
|
puts( _(" All modes support the following options:"));
|
|
|
|
printHelpLine(_(" --define '<name> <body>'"),
|
|
|
|
_("define macro <name> with value <body>"));
|
2000-09-02 05:15:40 +08:00
|
|
|
printHelpLine(_(" --eval '<expr>+' "),
|
|
|
|
_("print the expansion of macro <expr> to stdout"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --pipe <cmd> "),
|
|
|
|
_("send stdout to <cmd>"));
|
2001-01-19 09:38:55 +08:00
|
|
|
printHelpLine(_(" --rcfile <file:...> "),
|
2000-09-02 05:15:40 +08:00
|
|
|
_("use <file:...> instead of default list of macro files"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --showrc ",
|
|
|
|
_("display final rpmrc and macro configuration"));
|
|
|
|
#if defined(IAM_RPMBT) || defined(IAM_RPMDB) || defined(IAM_RPMEIU) || defined(IAM_RPMQV)
|
|
|
|
printHelpLine(_(" --dbpath <dir> "),
|
|
|
|
_("use <dir> as the directory for the database"));
|
|
|
|
printHelpLine(_(" --root <dir> "),
|
|
|
|
_("use <dir> as the top level directory"));
|
|
|
|
#endif /* IAM_RPMBT || IAM_RPMDB || IAM_RPMEIU || IAM_RPMQV */
|
|
|
|
printHelpLine( " -v ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("be a little more verbose"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -vv ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("be incredibly verbose (for debugging)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
#if defined(IAM_RPMEIU) || defined(IAM_RPMQV)
|
|
|
|
puts("");
|
|
|
|
puts( _(" Install, upgrade and query (with -p) modes allow URL's to be used in place"));
|
|
|
|
puts( _(" of file names as well as the following options:"));
|
|
|
|
printHelpLine(_(" --ftpproxy <host> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("hostname or IP of ftp proxy"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --ftpport <port> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("port number of ftp server (or proxy)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --httpproxy <host> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("hostname or IP of http proxy"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --httpport <port> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("port number of http server (or proxy)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMEIU || IAM_RPMQV */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMQV
|
|
|
|
puts("");
|
|
|
|
puts( _(" Package specification options:"));
|
2000-07-09 23:50:39 +08:00
|
|
|
printHelpLine( " -a, --all ",
|
2000-05-25 01:53:35 +08:00
|
|
|
_("query/verify all packages"));
|
2000-07-09 23:50:39 +08:00
|
|
|
printHelpLine(_(" -f <file>+ "),
|
2000-05-25 01:53:35 +08:00
|
|
|
_("query/verify package owning <file>"));
|
2000-07-09 23:50:39 +08:00
|
|
|
printHelpLine(_(" -p <packagefile>+ "),
|
2000-05-25 01:53:35 +08:00
|
|
|
_("query/verify (uninstalled) package <packagefile>"));
|
2000-07-09 23:50:39 +08:00
|
|
|
printHelpLine(_(" --triggeredby <pkg> "),
|
2000-05-25 01:53:35 +08:00
|
|
|
_("query/verify packages triggered by <pkg>"));
|
|
|
|
printHelpLine(_(" --whatprovides <cap> "),
|
|
|
|
_("query/verify packages which provide <cap> capability"));
|
|
|
|
printHelpLine(_(" --whatrequires <cap> "),
|
|
|
|
_("query/verify packages which require <cap> capability"));
|
|
|
|
puts("");
|
|
|
|
printHelpLine( " -q, --query ",
|
|
|
|
_("query mode"));
|
|
|
|
printHelpLine(_(" --queryformat <qfmt> "),
|
|
|
|
_("use <qfmt> as the header format (implies --info)"));
|
|
|
|
puts("");
|
|
|
|
puts( _(" Information selection options:"));
|
|
|
|
printHelpLine( " -i, --info ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("display package information"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --changelog ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("display the package's change log"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -l ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("display package file list"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -s ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("show file states (implies -l)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -d ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("list only documentation files (implies -l)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -c ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("list only configuration files (implies -l)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --dump ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("show all verifiable information for each file (must be used with -l, -c, or -d)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --provides ",
|
|
|
|
_("list capabilities provided by package"));
|
|
|
|
printHelpLine( " -R, --requires ",
|
|
|
|
_("list capabilities required by package"));
|
|
|
|
printHelpLine( " --scripts ",
|
|
|
|
_("print the various [un]install scriptlets"));
|
|
|
|
printHelpLine( " --triggers ",
|
|
|
|
_("show the trigger scriptlets contained in the package"));
|
2000-05-19 05:03:14 +08:00
|
|
|
puts("");
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -V, -y, --verify ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("verify a package installation using the same same package specification options as -q"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nodeps ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not verify package dependencies"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nofiles ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not verify file attributes"));
|
2000-10-11 05:17:53 +08:00
|
|
|
printHelpLine( " --nomd5 ",
|
|
|
|
_("do not verify file md5 checksums"));
|
|
|
|
printHelpLine( " --noscripts ",
|
2001-01-02 07:14:47 +08:00
|
|
|
_("do not execute scripts (if any)"));
|
2000-05-19 05:03:14 +08:00
|
|
|
puts("");
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --querytags ",
|
|
|
|
_("list the tags that can be used in a query format"));
|
|
|
|
printHelpLine( " --setperms ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("set the file permissions to those in the package database"
|
|
|
|
" using the same package specification options as -q"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --setugids ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("set the file owner and group to those in the package "
|
|
|
|
"database using the same package specification options as "
|
|
|
|
"-q"));
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMQV */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMEIU
|
2000-05-19 05:03:14 +08:00
|
|
|
puts("");
|
2000-05-25 01:53:35 +08:00
|
|
|
puts( _(" --install <packagefile>"));
|
|
|
|
printHelpLine(_(" -i <packagefile> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("install package"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --allfiles ",
|
|
|
|
_("install all files, even configurations which might "
|
|
|
|
"otherwise be skipped"));
|
|
|
|
printHelpLine( " --badreloc ",
|
|
|
|
_("relocate files in non-relocateable package"));
|
|
|
|
printHelpLine( " --excludedocs ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not install documentation"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --excludepath <path> "),
|
|
|
|
_("skip files with leading component <path> "));
|
|
|
|
printHelpLine( " --force ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("short hand for --replacepkgs --replacefiles"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " -h, --hash ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("print hash marks as package installs (good with -v)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --ignorearch ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("don't verify package architecture"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --ignoresize ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("don't check disk space before installing"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --ignoreos ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("don't verify package operating system"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --includedocs ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("install documentation"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --justdb ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("update the database, but do not modify the filesystem"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nodeps ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not verify package dependencies"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --noorder ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not reorder package installation to satisfy dependencies"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --noscripts ",
|
|
|
|
_("don't execute any installation scriptlets"));
|
|
|
|
printHelpLine( " --notriggers ",
|
|
|
|
_("don't execute any scriptlets triggered by this package"));
|
|
|
|
printHelpLine( " --percent ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("print percentages as package installs"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --prefix <dir> "),
|
|
|
|
_("relocate the package to <dir>, if relocatable"));
|
|
|
|
printHelpLine(_(" --relocate <oldpath>=<newpath>"),
|
|
|
|
_("relocate files from <oldpath> to <newpath>"));
|
|
|
|
printHelpLine( " --replacefiles ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("install even if the package replaces installed files"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --replacepkgs ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("reinstall if the package is already present"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --test ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("don't install, but tell if it would work or not"));
|
|
|
|
puts("");
|
2000-05-25 01:53:35 +08:00
|
|
|
puts( _(" --upgrade <packagefile>"));
|
|
|
|
printHelpLine(_(" -U <packagefile> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("upgrade package (same options as --install, plus)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --oldpackage ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("upgrade to an old version of the package (--force on upgrades does this automatically)"));
|
|
|
|
puts("");
|
2000-05-25 01:53:35 +08:00
|
|
|
puts( _(" --erase <package>"));
|
2001-03-24 04:27:48 +08:00
|
|
|
printHelpLine(_(" -e <package> "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("erase (uninstall) package"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --allmatches ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --justdb ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("update the database, but do not modify the filesystem"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nodeps ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not verify package dependencies"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --noorder ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not reorder package installation to satisfy dependencies"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --noscripts ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("do not execute any package specific scripts"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --notriggers ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("don't execute any scripts triggered by this package"));
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMK
|
|
|
|
puts("");
|
|
|
|
printHelpLine(_(" --resign <pkg>+ "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("sign a package (discard current signature)"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine(_(" --addsign <pkg>+ "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("add a signature to a package"));
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
puts( _(" --checksig <pkg>+"));
|
|
|
|
printHelpLine(_(" -K <pkg>+ "),
|
2000-05-19 05:03:14 +08:00
|
|
|
_("verify package signature"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nopgp ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("skip any PGP signatures"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nogpg ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("skip any GPG signatures"));
|
2000-05-25 01:53:35 +08:00
|
|
|
printHelpLine( " --nomd5 ",
|
2000-05-19 05:03:14 +08:00
|
|
|
_("skip any MD5 signatures"));
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMK */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMDB
|
|
|
|
puts("");
|
|
|
|
printHelpLine( " --initdb ",
|
|
|
|
_("initalize database (unnecessary, legacy use)"));
|
|
|
|
printHelpLine( " --rebuilddb ",
|
|
|
|
_("rebuild database indices from existing database headers"));
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
2001-01-21 23:43:32 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
int main(int argc, const char ** argv)
|
|
|
|
{
|
|
|
|
enum modes bigMode = MODE_UNKNOWN;
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
#ifdef IAM_RPMQV
|
2000-05-19 05:03:14 +08:00
|
|
|
QVA_t *qva = &rpmQVArgs;
|
2000-06-12 03:15:27 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
|
|
|
|
#ifdef IAM_RPMBT
|
2000-06-01 12:47:42 +08:00
|
|
|
struct rpmBuildArguments *ba = &rpmBTArgs;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IAM_RPMEIU
|
2001-04-29 09:05:43 +08:00
|
|
|
/*@only@*/ rpmRelocation * relocations = NULL;
|
2000-05-25 01:53:35 +08:00
|
|
|
int numRelocations = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IAM_RPMK)
|
2000-08-30 06:04:33 +08:00
|
|
|
rpmResignFlags addSign = RESIGN_NEW_SIGNATURE;
|
|
|
|
rpmCheckSigFlags checksigFlags = CHECKSIG_NONE;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
|
2000-05-19 05:03:14 +08:00
|
|
|
char * passPhrase = "";
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
int arg;
|
|
|
|
int gotDbpath = 0;
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
const char * optArg;
|
|
|
|
pid_t pipeChild = 0;
|
|
|
|
poptContext optCon;
|
|
|
|
int ec = 0;
|
|
|
|
int status;
|
|
|
|
int p[2];
|
|
|
|
|
|
|
|
#if HAVE_MCHECK_H && HAVE_MTRACE
|
|
|
|
mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
|
|
|
|
#endif
|
|
|
|
setprogname(argv[0]); /* Retrofit glibc __progname */
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
/* XXX glibc churn sanity */
|
|
|
|
if (__progname == NULL) {
|
|
|
|
if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
|
|
|
|
else __progname = argv[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the major mode based on argv[0] */
|
|
|
|
#ifdef IAM_RPMBT
|
|
|
|
if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD;
|
|
|
|
if (!strcmp(__progname, "rpmt")) bigMode = MODE_TARBUILD;
|
2000-07-26 02:37:21 +08:00
|
|
|
if (!strcmp(__progname, "rpmbuild")) bigMode = MODE_BUILD;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
#ifdef IAM_RPMQV
|
|
|
|
if (!strcmp(__progname, "rpmq")) bigMode = MODE_QUERY;
|
|
|
|
if (!strcmp(__progname, "rpmv")) bigMode = MODE_VERIFY;
|
2000-07-26 02:37:21 +08:00
|
|
|
if (!strcmp(__progname, "rpmquery")) bigMode = MODE_QUERY;
|
|
|
|
if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
#ifdef RPMEIU
|
|
|
|
if (!strcmp(__progname, "rpme")) bigMode = MODE_UNINSTALL;
|
|
|
|
if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
|
|
|
|
if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
/* set the defaults for the various command line options */
|
|
|
|
_ftp_debug = 0;
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2001-03-15 02:07:47 +08:00
|
|
|
#if HAVE_LIBIO_H && defined(_G_IO_IO_FILE_VERSION)
|
2000-05-19 05:03:14 +08:00
|
|
|
noLibio = 0;
|
|
|
|
#else
|
|
|
|
noLibio = 1;
|
|
|
|
#endif
|
|
|
|
_rpmio_debug = 0;
|
|
|
|
_url_debug = 0;
|
|
|
|
|
|
|
|
/* XXX Eliminate query linkage loop */
|
2000-05-25 01:53:35 +08:00
|
|
|
specedit = 0;
|
2000-05-19 05:03:14 +08:00
|
|
|
parseSpecVec = parseSpec;
|
|
|
|
freeSpecVec = freeSpec;
|
|
|
|
|
|
|
|
/* set up the correct locale */
|
2001-04-29 09:05:43 +08:00
|
|
|
(void) setlocale(LC_ALL, "" );
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
#ifdef __LCLINT__
|
|
|
|
#define LOCALEDIR "/usr/share/locale"
|
|
|
|
#endif
|
|
|
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
|
|
|
textdomain(PACKAGE);
|
|
|
|
|
|
|
|
rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
|
|
|
|
|
|
|
|
/* Make a first pass through the arguments, looking for --rcfile */
|
|
|
|
/* We need to handle that before dealing with the rest of the arguments. */
|
2000-05-25 01:53:35 +08:00
|
|
|
optCon = poptGetContext(__progname, argc, argv, optionsTable, 0);
|
2000-05-19 05:03:14 +08:00
|
|
|
poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
|
|
|
|
poptReadDefaultConfig(optCon, 1);
|
|
|
|
poptSetExecPath(optCon, RPMCONFIGDIR, 1);
|
|
|
|
|
|
|
|
/* reading rcfile early makes it easy to override */
|
|
|
|
/* XXX only --rcfile (and --showrc) need this pre-parse */
|
|
|
|
|
|
|
|
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
|
|
|
switch(arg) {
|
|
|
|
case 'v':
|
|
|
|
rpmIncreaseVerbosity(); /* XXX silly use by showrc */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rpmReadConfigFiles(rcfile, NULL))
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
|
|
|
if (showrc) {
|
|
|
|
rpmShowRC(stdout);
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
|
|
|
|
|
|
|
|
poptResetContext(optCon);
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2000-12-13 04:03:45 +08:00
|
|
|
if (qva->qva_queryFormat) free((void *)qva->qva_queryFormat);
|
2000-05-19 05:03:14 +08:00
|
|
|
memset(qva, 0, sizeof(*qva));
|
2000-06-12 03:15:27 +08:00
|
|
|
qva->qva_source = RPMQV_PACKAGE;
|
2000-05-27 02:51:11 +08:00
|
|
|
qva->qva_mode = ' ';
|
|
|
|
qva->qva_char = ' ';
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IAM_RPMBT
|
2000-12-13 04:03:45 +08:00
|
|
|
if (ba->buildRootOverride) free((void *)ba->buildRootOverride);
|
2000-05-19 05:03:14 +08:00
|
|
|
if (ba->targets) free(ba->targets);
|
|
|
|
memset(ba, 0, sizeof(*ba));
|
2000-05-27 02:51:11 +08:00
|
|
|
ba->buildMode = ' ';
|
2000-05-19 05:03:14 +08:00
|
|
|
ba->buildChar = ' ';
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
|
|
|
transFlags = RPMTRANS_FLAG_NONE;
|
|
|
|
probFilter = RPMPROB_FILTER_NONE;
|
|
|
|
installInterfaceFlags = INSTALL_NONE;
|
|
|
|
eraseInterfaceFlags = UNINSTALL_NONE;
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
|
|
|
optArg = poptGetOptArg(optCon);
|
|
|
|
|
|
|
|
switch (arg) {
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
case 'v':
|
|
|
|
rpmIncreaseVerbosity();
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
|
|
|
|
2000-05-27 02:51:11 +08:00
|
|
|
#if defined(IAM_RPMQV) || defined(IAM_RPMEIU) || defined(IAM_RPMBT)
|
2000-05-25 01:53:35 +08:00
|
|
|
case 'i':
|
|
|
|
#ifdef IAM_RPMQV
|
2000-05-27 02:51:11 +08:00
|
|
|
if (bigMode == MODE_QUERY) {
|
|
|
|
const char * infoCommand[] = { "--info", NULL };
|
2000-05-25 01:53:35 +08:00
|
|
|
poptStuffArgs(optCon, infoCommand);
|
2000-05-27 02:51:11 +08:00
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
|
|
|
#ifdef IAM_RPMEIU
|
|
|
|
if (bigMode == MODE_INSTALL)
|
|
|
|
/*@-ifempty@*/ ;
|
2000-05-27 02:51:11 +08:00
|
|
|
if (bigMode == MODE_UNKNOWN) {
|
|
|
|
const char * installCommand[] = { "--install", NULL };
|
2000-05-25 01:53:35 +08:00
|
|
|
poptStuffArgs(optCon, installCommand);
|
2000-05-27 02:51:11 +08:00
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2000-05-27 02:51:11 +08:00
|
|
|
#endif /* IAM_RPMQV || IAM_RPMEIU || IAM_RPMBT */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
case 'e':
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_UNINSTALL)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
bigMode = MODE_UNINSTALL;
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
case GETOPT_INSTALL:
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
bigMode = MODE_INSTALL;
|
|
|
|
break;
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
#ifdef DYING /* XXX handled by popt */
|
2000-05-19 05:03:14 +08:00
|
|
|
case 'U':
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
bigMode = MODE_INSTALL;
|
|
|
|
break;
|
|
|
|
|
2000-06-23 08:49:43 +08:00
|
|
|
case 'F':
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
bigMode = MODE_INSTALL;
|
|
|
|
break;
|
2001-01-21 23:43:32 +08:00
|
|
|
#endif
|
2000-06-23 08:49:43 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
case GETOPT_EXCLUDEPATH:
|
|
|
|
if (*optArg != '/')
|
|
|
|
argerror(_("exclude paths must begin with a /"));
|
|
|
|
|
|
|
|
relocations = xrealloc(relocations,
|
|
|
|
sizeof(*relocations) * (numRelocations + 1));
|
|
|
|
relocations[numRelocations].oldPath = optArg;
|
|
|
|
relocations[numRelocations++].newPath = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GETOPT_RELOCATE:
|
|
|
|
{ char * errString = NULL;
|
|
|
|
if (*optArg != '/')
|
|
|
|
argerror(_("relocations must begin with a /"));
|
|
|
|
if (!(errString = strchr(optArg, '=')))
|
|
|
|
argerror(_("relocations must contain a ="));
|
|
|
|
*errString++ = '\0';
|
|
|
|
if (*errString != '/')
|
|
|
|
argerror(_("relocations must have a / following the ="));
|
|
|
|
relocations = xrealloc(relocations,
|
|
|
|
sizeof(*relocations) * (numRelocations + 1));
|
|
|
|
relocations[numRelocations].oldPath = optArg;
|
|
|
|
relocations[numRelocations++].newPath = errString;
|
|
|
|
} break;
|
|
|
|
#endif /* IAM_RPMEIU */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMDB
|
|
|
|
case GETOPT_REBUILDDB:
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_REBUILDDB)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("only one major mode may be specified"));
|
2000-05-25 01:53:35 +08:00
|
|
|
bigMode = MODE_REBUILDDB;
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMK
|
|
|
|
case 'K':
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_CHECKSIG)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("only one major mode may be specified"));
|
2000-05-25 01:53:35 +08:00
|
|
|
bigMode = MODE_CHECKSIG;
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GETOPT_RESIGN:
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_RESIGN)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
bigMode = MODE_RESIGN;
|
2000-08-30 06:04:33 +08:00
|
|
|
addSign = RESIGN_NEW_SIGNATURE;
|
2000-05-19 05:03:14 +08:00
|
|
|
signIt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GETOPT_ADDSIGN:
|
|
|
|
if (bigMode != MODE_UNKNOWN && bigMode != MODE_RESIGN)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
bigMode = MODE_RESIGN;
|
2000-08-30 06:04:33 +08:00
|
|
|
addSign = RESIGN_ADD_SIGNATURE;
|
2000-05-19 05:03:14 +08:00
|
|
|
signIt = 1;
|
|
|
|
break;
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMK */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
case GETOPT_DEFINEMACRO:
|
|
|
|
rpmDefineMacro(NULL, optArg, RMIL_CMDLINE);
|
|
|
|
rpmDefineMacro(&rpmCLIMacroContext, optArg, RMIL_CMDLINE);
|
|
|
|
noUsageMsg = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GETOPT_EVALMACRO:
|
|
|
|
{ const char *val = rpmExpand(optArg, NULL);
|
|
|
|
fprintf(stdout, "%s\n", val);
|
2000-12-13 04:03:45 +08:00
|
|
|
free((void *)val);
|
2000-05-19 05:03:14 +08:00
|
|
|
noUsageMsg = 1;
|
|
|
|
} break;
|
|
|
|
|
2000-09-02 05:15:40 +08:00
|
|
|
case GETOPT_RCFILE:
|
|
|
|
fprintf(stderr, _("The --rcfile option has been eliminated.\n"));
|
2000-12-31 02:26:10 +08:00
|
|
|
fprintf(stderr, _("Use \"--macros <file:...>\" instead.\n"));
|
2000-09-02 05:15:40 +08:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
/*@notreached@*/ break;
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
default:
|
|
|
|
fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (quiet)
|
|
|
|
rpmSetVerbosity(RPMMESS_QUIET);
|
|
|
|
|
|
|
|
if (showVersion) printVersion();
|
|
|
|
|
|
|
|
if (arg < -1) {
|
|
|
|
fprintf(stderr, "%s: %s\n",
|
|
|
|
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
|
|
|
|
poptStrerror(arg));
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMBT
|
2000-05-27 02:51:11 +08:00
|
|
|
switch (ba->buildMode) {
|
|
|
|
case 'b': bigMode = MODE_BUILD; break;
|
|
|
|
case 't': bigMode = MODE_TARBUILD; break;
|
|
|
|
case 'B': bigMode = MODE_REBUILD; break;
|
|
|
|
case 'C': bigMode = MODE_RECOMPILE; break;
|
|
|
|
}
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
if ((ba->buildAmount & RPMBUILD_RMSOURCE) && bigMode == MODE_UNKNOWN)
|
|
|
|
bigMode = MODE_BUILD;
|
|
|
|
|
|
|
|
if ((ba->buildAmount & RPMBUILD_RMSPEC) && bigMode == MODE_UNKNOWN)
|
|
|
|
bigMode = MODE_BUILD;
|
2000-05-27 02:51:11 +08:00
|
|
|
|
2000-06-01 12:47:42 +08:00
|
|
|
if (ba->buildRootOverride && bigMode != MODE_BUILD &&
|
|
|
|
bigMode != MODE_REBUILD && bigMode != MODE_TARBUILD) {
|
|
|
|
argerror("--buildroot may only be used during package builds");
|
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMBT */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMDB
|
2000-05-19 05:03:14 +08:00
|
|
|
if (initdb) {
|
|
|
|
if (bigMode != MODE_UNKNOWN)
|
|
|
|
argerror(_("only one major mode may be specified"));
|
|
|
|
else
|
|
|
|
bigMode = MODE_INITDB;
|
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMDB */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMQV
|
2000-05-27 02:51:11 +08:00
|
|
|
switch (qva->qva_mode) {
|
|
|
|
case 'q': bigMode = MODE_QUERY; break;
|
|
|
|
case 'V': bigMode = MODE_VERIFY; break;
|
|
|
|
case 'Q': bigMode = MODE_QUERYTAGS; 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"));
|
2000-06-01 12:47:42 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (gotDbpath && (bigMode & ~MODES_FOR_DBPATH))
|
|
|
|
argerror(_("--dbpath given for operation that does not use a "
|
|
|
|
"database"));
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
#if defined(IAM_RPMEIU)
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2001-01-02 07:14:47 +08:00
|
|
|
if (!( bigMode == MODE_INSTALL ) && force)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
|
2001-01-02 07:14:47 +08:00
|
|
|
#endif /* IAM_RPMEIU */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_FORCERELOCATE))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("files may only be relocated during package installation"));
|
|
|
|
|
|
|
|
if (relocations && prefix)
|
|
|
|
argerror(_("only one of --prefix or --relocate may be used"));
|
|
|
|
|
|
|
|
if (bigMode != MODE_INSTALL && relocations)
|
|
|
|
argerror(_("--relocate and --excludepath may only be used when installing new packages"));
|
|
|
|
|
|
|
|
if (bigMode != MODE_INSTALL && prefix)
|
|
|
|
argerror(_("--prefix may only be used when installing new packages"));
|
|
|
|
|
|
|
|
if (prefix && prefix[0] != '/')
|
|
|
|
argerror(_("arguments to --prefix must begin with a /"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (installInterfaceFlags & INSTALL_HASH))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--hash (-h) may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (installInterfaceFlags & INSTALL_PERCENT))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--percent may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL &&
|
|
|
|
(probFilter & (RPMPROB_FILTER_REPLACEOLDFILES|RPMPROB_FILTER_REPLACENEWFILES)))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--replacefiles may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_REPLACEPKG))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--replacepkgs may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (transFlags & RPMTRANS_FLAG_NODOCS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--excludedocs may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
|
|
|
if (bigMode != MODE_INSTALL && incldocs)
|
|
|
|
argerror(_("--includedocs may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (incldocs && (transFlags & RPMTRANS_FLAG_NODOCS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("only one of --excludedocs and --includedocs may be "
|
|
|
|
"specified"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_IGNOREARCH))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--ignorearch may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_IGNOREOS))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--ignoreos may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL &&
|
|
|
|
(probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--ignoresize may only be specified during package "
|
|
|
|
"installation"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if ((eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_UNINSTALL)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--allmatches may only be specified during package "
|
|
|
|
"erasure"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if ((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-01-21 23:43:32 +08:00
|
|
|
if ((transFlags & RPMTRANS_FLAG_JUSTDB) &&
|
|
|
|
bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL)
|
2000-05-19 05:03:14 +08:00
|
|
|
argerror(_("--justdb may only be specified during package "
|
|
|
|
"installation and erasure"));
|
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
|
|
|
#if defined(IAM_RPMEIU)
|
2001-01-21 23:43:32 +08:00
|
|
|
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
|
2001-03-04 23:34:53 +08:00
|
|
|
(transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
|
|
|
|
argerror(_("script disabling options may only be specified during "
|
|
|
|
"package installation and erasure"));
|
|
|
|
|
|
|
|
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
|
|
|
|
(transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
|
|
|
|
argerror(_("trigger disabling options may only be specified during "
|
|
|
|
"package installation and erasure"));
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
if (noDeps & (bigMode & ~MODES_FOR_NODEPS))
|
|
|
|
argerror(_("--nodeps may only be specified during package "
|
|
|
|
"building, rebuilding, recompilation, installation,"
|
|
|
|
"erasure, and verification"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if ((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
|
|
|
|
|
|
|
if (rootdir[1] && (bigMode & ~MODES_FOR_ROOT))
|
|
|
|
argerror(_("--root (-r) may only be specified during "
|
|
|
|
"installation, erasure, querying, and "
|
|
|
|
"database rebuilds"));
|
|
|
|
|
|
|
|
if (rootdir) {
|
|
|
|
switch (urlIsURL(rootdir)) {
|
|
|
|
default:
|
|
|
|
if (bigMode & MODES_FOR_ROOT)
|
|
|
|
break;
|
|
|
|
/*@fallthrough@*/
|
|
|
|
case URL_IS_UNKNOWN:
|
|
|
|
if (rootdir[0] != '/')
|
|
|
|
argerror(_("arguments to --root (-r) must begin with a /"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMK
|
2000-05-19 05:03:14 +08:00
|
|
|
if (noPgp && bigMode != MODE_CHECKSIG)
|
|
|
|
argerror(_("--nopgp may only be used during signature checking"));
|
|
|
|
|
|
|
|
if (noGpg && bigMode != MODE_CHECKSIG)
|
|
|
|
argerror(_("--nogpg may only be used during signature checking"));
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#if defined(IAM_RPMK) || defined(IAM_RPMQV)
|
2000-05-19 05:03:14 +08:00
|
|
|
if (noMd5 && bigMode != MODE_CHECKSIG && bigMode != MODE_VERIFY)
|
|
|
|
argerror(_("--nomd5 may only be used during signature checking and "
|
|
|
|
"package verification"));
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
|
2001-01-02 07:14:47 +08:00
|
|
|
#if defined(IAM_RPMBT)
|
|
|
|
signIt = ba->sign;
|
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
if (signIt) {
|
|
|
|
if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
|
|
|
|
bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD) {
|
2001-04-29 09:05:43 +08:00
|
|
|
const char ** av;
|
2000-05-19 05:03:14 +08:00
|
|
|
struct stat sb;
|
|
|
|
int errors = 0;
|
|
|
|
|
2001-04-29 09:05:43 +08:00
|
|
|
if ((av = poptGetArgs(optCon)) == NULL) {
|
2000-05-19 05:03:14 +08:00
|
|
|
fprintf(stderr, _("no files to sign\n"));
|
|
|
|
errors++;
|
|
|
|
} else
|
2001-04-29 09:05:43 +08:00
|
|
|
while (*av) {
|
|
|
|
if (stat(*av, &sb)) {
|
|
|
|
fprintf(stderr, _("cannot access file %s\n"), *av);
|
2000-05-19 05:03:14 +08:00
|
|
|
errors++;
|
|
|
|
}
|
2001-04-29 09:05:43 +08:00
|
|
|
av++;
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2001-04-29 09:05:43 +08:00
|
|
|
if (errors) {
|
|
|
|
ec = errors;
|
|
|
|
goto exit;
|
|
|
|
}
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
if (poptPeekArg(optCon)) {
|
2000-05-25 01:53:35 +08:00
|
|
|
int sigTag;
|
2000-05-19 05:03:14 +08:00
|
|
|
switch (sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) {
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case RPMSIGTAG_PGP:
|
|
|
|
if ((sigTag == RPMSIGTAG_PGP || sigTag == RPMSIGTAG_PGP5) &&
|
|
|
|
!rpmDetectPGPVersion(NULL)) {
|
|
|
|
fprintf(stderr, _("pgp not found: "));
|
2001-04-29 09:05:43 +08:00
|
|
|
ec = EXIT_FAILURE;
|
|
|
|
goto exit;
|
2000-05-19 05:03:14 +08:00
|
|
|
} /*@fallthrough@*/
|
|
|
|
case RPMSIGTAG_GPG:
|
|
|
|
passPhrase = rpmGetPassPhrase(_("Enter pass phrase: "), sigTag);
|
|
|
|
if (passPhrase == NULL) {
|
|
|
|
fprintf(stderr, _("Pass phrase check failed\n"));
|
2001-04-29 09:05:43 +08:00
|
|
|
ec = EXIT_FAILURE;
|
|
|
|
goto exit;
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
fprintf(stderr, _("Pass phrase is good.\n"));
|
|
|
|
passPhrase = xstrdup(passPhrase);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fprintf(stderr,
|
|
|
|
_("Invalid %%_signature spec in macro file.\n"));
|
2001-04-29 09:05:43 +08:00
|
|
|
ec = EXIT_FAILURE;
|
|
|
|
goto exit;
|
2000-05-19 05:03:14 +08:00
|
|
|
/*@notreached@*/ break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
argerror(_("--sign may only be used during package building"));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Make rpmLookupSignatureType() return 0 ("none") from now on */
|
|
|
|
rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE);
|
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMBT || IAM_RPMK */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
if (pipeOutput) {
|
|
|
|
pipe(p);
|
|
|
|
|
|
|
|
if (!(pipeChild = fork())) {
|
|
|
|
close(p[1]);
|
|
|
|
dup2(p[0], STDIN_FILENO);
|
|
|
|
close(p[0]);
|
|
|
|
execl("/bin/sh", "/bin/sh", "-c", pipeOutput, NULL);
|
|
|
|
fprintf(stderr, _("exec failed\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
close(p[0]);
|
|
|
|
dup2(p[1], STDOUT_FILENO);
|
|
|
|
close(p[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (bigMode) {
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMDB
|
|
|
|
case MODE_INITDB:
|
|
|
|
rpmdbInit(rootdir, 0644);
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_REBUILDDB:
|
|
|
|
ec = rpmdbRebuild(rootdir);
|
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#if !defined(__LCLINT__)
|
2000-05-25 01:53:35 +08:00
|
|
|
case MODE_QUERY:
|
|
|
|
case MODE_VERIFY:
|
2000-05-19 05:03:14 +08:00
|
|
|
case MODE_QUERYTAGS:
|
2000-05-25 01:53:35 +08:00
|
|
|
case MODE_INSTALL:
|
|
|
|
case MODE_UNINSTALL:
|
|
|
|
case MODE_BUILD:
|
|
|
|
case MODE_REBUILD:
|
|
|
|
case MODE_RECOMPILE:
|
|
|
|
case MODE_TARBUILD:
|
2000-05-19 05:03:14 +08:00
|
|
|
case MODE_CHECKSIG:
|
|
|
|
case MODE_RESIGN:
|
2000-05-25 01:53:35 +08:00
|
|
|
if (!showVersion && !help && !noUsageMsg) printUsage();
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMDB */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMBT
|
2000-05-19 05:03:14 +08:00
|
|
|
case MODE_REBUILD:
|
|
|
|
case MODE_RECOMPILE:
|
2000-05-25 01:53:35 +08:00
|
|
|
{ const char * pkg;
|
2001-02-10 04:58:37 +08:00
|
|
|
while (!rpmIsVerbose())
|
|
|
|
rpmIncreaseVerbosity();
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no packages files given for rebuild"));
|
|
|
|
|
|
|
|
ba->buildAmount = RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL;
|
|
|
|
if (bigMode == MODE_REBUILD) {
|
|
|
|
ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
|
|
|
|
ba->buildAmount |= RPMBUILD_RMSOURCE;
|
|
|
|
ba->buildAmount |= RPMBUILD_RMSPEC;
|
|
|
|
ba->buildAmount |= RPMBUILD_CLEAN;
|
|
|
|
ba->buildAmount |= RPMBUILD_RMBUILD;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((pkg = poptGetArg(optCon))) {
|
2000-05-25 01:53:35 +08:00
|
|
|
const char * specFile = NULL;
|
|
|
|
char * cookie = NULL;
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
ec = rpmInstallSource("", pkg, &specFile, &cookie);
|
|
|
|
if (ec)
|
|
|
|
break;
|
|
|
|
|
|
|
|
ba->rootdir = rootdir;
|
2001-01-02 07:14:47 +08:00
|
|
|
ec = build(specFile, ba, passPhrase, cookie, rcfile);
|
2000-05-19 05:03:14 +08:00
|
|
|
free(cookie);
|
2000-05-25 01:53:35 +08:00
|
|
|
cookie = NULL;
|
2000-12-13 04:03:45 +08:00
|
|
|
free((void *)specFile);
|
2000-05-25 01:53:35 +08:00
|
|
|
specFile = NULL;
|
|
|
|
|
|
|
|
if (ec)
|
|
|
|
break;
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
} break;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
case MODE_BUILD:
|
|
|
|
case MODE_TARBUILD:
|
2000-05-25 01:53:35 +08:00
|
|
|
{ const char * pkg;
|
2001-02-10 04:58:37 +08:00
|
|
|
while (!rpmIsVerbose())
|
|
|
|
rpmIncreaseVerbosity();
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
switch (ba->buildChar) {
|
|
|
|
case 'a':
|
|
|
|
ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
|
|
|
|
/*@fallthrough@*/
|
|
|
|
case 'b':
|
|
|
|
ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
|
|
|
|
ba->buildAmount |= RPMBUILD_CLEAN;
|
|
|
|
/*@fallthrough@*/
|
|
|
|
case 'i':
|
|
|
|
ba->buildAmount |= RPMBUILD_INSTALL;
|
|
|
|
if ((ba->buildChar == 'i') && ba->shortCircuit)
|
|
|
|
break;
|
|
|
|
/*@fallthrough@*/
|
|
|
|
case 'c':
|
|
|
|
ba->buildAmount |= RPMBUILD_BUILD;
|
|
|
|
if ((ba->buildChar == 'c') && ba->shortCircuit)
|
|
|
|
break;
|
|
|
|
/*@fallthrough@*/
|
|
|
|
case 'p':
|
|
|
|
ba->buildAmount |= RPMBUILD_PREP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'l':
|
|
|
|
ba->buildAmount |= RPMBUILD_FILECHECK;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!poptPeekArg(optCon)) {
|
|
|
|
if (bigMode == MODE_BUILD)
|
|
|
|
argerror(_("no spec files given for build"));
|
|
|
|
else
|
|
|
|
argerror(_("no tar files given for build"));
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((pkg = poptGetArg(optCon))) {
|
|
|
|
ba->rootdir = rootdir;
|
2001-01-02 07:14:47 +08:00
|
|
|
ec = build(pkg, ba, passPhrase, NULL, rcfile);
|
2000-05-19 05:03:14 +08:00
|
|
|
if (ec)
|
|
|
|
break;
|
|
|
|
rpmFreeMacros(NULL);
|
|
|
|
rpmReadConfigFiles(rcfile, NULL);
|
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
} break;
|
|
|
|
|
2001-04-29 09:05:43 +08:00
|
|
|
#if !defined(__LCLINT__)
|
2000-05-25 01:53:35 +08:00
|
|
|
case MODE_QUERY:
|
|
|
|
case MODE_VERIFY:
|
|
|
|
case MODE_QUERYTAGS:
|
|
|
|
case MODE_INSTALL:
|
|
|
|
case MODE_UNINSTALL:
|
|
|
|
case MODE_CHECKSIG:
|
|
|
|
case MODE_RESIGN:
|
|
|
|
case MODE_INITDB:
|
|
|
|
case MODE_REBUILDDB:
|
|
|
|
if (!showVersion && !help && !noUsageMsg) printUsage();
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMBT */
|
2000-05-19 05:03:14 +08:00
|
|
|
|
2000-05-25 01:53:35 +08:00
|
|
|
#ifdef IAM_RPMEIU
|
2000-05-19 05:03:14 +08:00
|
|
|
case MODE_UNINSTALL:
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no packages given for uninstall"));
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (noDeps) eraseInterfaceFlags |= UNINSTALL_NODEPS;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
ec = rpmErase(rootdir, (const char **)poptGetArgs(optCon),
|
2001-01-21 23:43:32 +08:00
|
|
|
transFlags, eraseInterfaceFlags);
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_INSTALL:
|
|
|
|
if (force) {
|
|
|
|
probFilter |= RPMPROB_FILTER_REPLACEPKG |
|
|
|
|
RPMPROB_FILTER_REPLACEOLDFILES |
|
|
|
|
RPMPROB_FILTER_REPLACENEWFILES |
|
|
|
|
RPMPROB_FILTER_OLDPACKAGE;
|
|
|
|
}
|
2001-01-21 23:43:32 +08:00
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
/* RPMTRANS_FLAG_BUILD_PROBS */
|
2001-01-21 23:43:32 +08:00
|
|
|
/* RPMTRANS_FLAG_KEEPOBSOLETE */
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
if (!incldocs) {
|
2001-01-21 23:43:32 +08:00
|
|
|
if (transFlags & RPMTRANS_FLAG_NODOCS)
|
|
|
|
;
|
2000-05-19 05:03:14 +08:00
|
|
|
else if (rpmExpandNumeric("%{_excludedocs}"))
|
2001-01-21 23:43:32 +08:00
|
|
|
transFlags |= RPMTRANS_FLAG_NODOCS;
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2001-01-21 23:43:32 +08:00
|
|
|
if (noDeps) installInterfaceFlags |= INSTALL_NODEPS;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no packages given for install"));
|
|
|
|
|
|
|
|
/* we've already ensured !(!prefix && !relocations) */
|
|
|
|
if (prefix) {
|
|
|
|
relocations = alloca(2 * sizeof(*relocations));
|
|
|
|
relocations[0].oldPath = NULL; /* special case magic */
|
|
|
|
relocations[0].newPath = prefix;
|
|
|
|
relocations[1].oldPath = relocations[1].newPath = NULL;
|
|
|
|
} else if (relocations) {
|
|
|
|
relocations = xrealloc(relocations,
|
|
|
|
sizeof(*relocations) * (numRelocations + 1));
|
|
|
|
relocations[numRelocations].oldPath = NULL;
|
|
|
|
relocations[numRelocations].newPath = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ec += rpmInstall(rootdir, (const char **)poptGetArgs(optCon),
|
2001-01-21 23:43:32 +08:00
|
|
|
transFlags, installInterfaceFlags, probFilter,
|
|
|
|
relocations);
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#if !defined(__LCLINT__)
|
2000-05-25 01:53:35 +08:00
|
|
|
case MODE_QUERY:
|
|
|
|
case MODE_VERIFY:
|
|
|
|
case MODE_QUERYTAGS:
|
|
|
|
case MODE_BUILD:
|
|
|
|
case MODE_REBUILD:
|
|
|
|
case MODE_RECOMPILE:
|
|
|
|
case MODE_TARBUILD:
|
|
|
|
case MODE_CHECKSIG:
|
|
|
|
case MODE_RESIGN:
|
|
|
|
case MODE_INITDB:
|
|
|
|
case MODE_REBUILDDB:
|
|
|
|
if (!showVersion && !help && !noUsageMsg) printUsage();
|
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#endif
|
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
|
2000-05-19 05:03:14 +08:00
|
|
|
case MODE_QUERY:
|
2000-05-25 01:53:35 +08:00
|
|
|
{ const char * pkg;
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
qva->qva_prefix = rootdir;
|
2000-06-12 03:15:27 +08:00
|
|
|
if (qva->qva_source == RPMQV_ALL) {
|
2000-05-19 05:03:14 +08:00
|
|
|
if (poptPeekArg(optCon))
|
|
|
|
argerror(_("extra arguments given for query of all packages"));
|
|
|
|
|
|
|
|
ec = rpmQuery(qva, RPMQV_ALL, NULL);
|
|
|
|
} else {
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no arguments given for query"));
|
|
|
|
while ((pkg = poptGetArg(optCon)))
|
2000-06-12 03:15:27 +08:00
|
|
|
ec += rpmQuery(qva, qva->qva_source, pkg);
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
} break;
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
case MODE_VERIFY:
|
2000-05-25 01:53:35 +08:00
|
|
|
{ const char * pkg;
|
|
|
|
int verifyFlags;
|
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
verifyFlags = (VERIFY_FILES|VERIFY_DEPS|VERIFY_SCRIPT|VERIFY_MD5);
|
|
|
|
verifyFlags &= ~qva->qva_flags;
|
|
|
|
|
|
|
|
qva->qva_prefix = rootdir;
|
|
|
|
qva->qva_flags = verifyFlags;
|
2000-06-12 03:15:27 +08:00
|
|
|
if (qva->qva_source == RPMQV_ALL) {
|
2000-05-19 05:03:14 +08:00
|
|
|
if (poptPeekArg(optCon))
|
|
|
|
argerror(_("extra arguments given for verify of all packages"));
|
|
|
|
ec = rpmVerify(qva, RPMQV_ALL, NULL);
|
|
|
|
} else {
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no arguments given for verify"));
|
|
|
|
while ((pkg = poptGetArg(optCon)))
|
2000-06-12 03:15:27 +08:00
|
|
|
ec += rpmVerify(qva, qva->qva_source, pkg);
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
2000-05-25 01:53:35 +08:00
|
|
|
} break;
|
|
|
|
|
|
|
|
case MODE_QUERYTAGS:
|
|
|
|
if (argc != 2)
|
|
|
|
argerror(_("unexpected arguments to --querytags "));
|
|
|
|
|
|
|
|
rpmDisplayQueryTags(stdout);
|
|
|
|
break;
|
|
|
|
|
2001-04-29 09:05:43 +08:00
|
|
|
#if !defined(__LCLINT__)
|
2000-05-25 01:53:35 +08:00
|
|
|
case MODE_INSTALL:
|
|
|
|
case MODE_UNINSTALL:
|
|
|
|
case MODE_BUILD:
|
|
|
|
case MODE_REBUILD:
|
|
|
|
case MODE_RECOMPILE:
|
|
|
|
case MODE_TARBUILD:
|
|
|
|
case MODE_CHECKSIG:
|
|
|
|
case MODE_RESIGN:
|
|
|
|
case MODE_INITDB:
|
|
|
|
case MODE_REBUILDDB:
|
|
|
|
if (!showVersion && !help && !noUsageMsg) printUsage();
|
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMQV */
|
|
|
|
|
|
|
|
#ifdef IAM_RPMK
|
|
|
|
case MODE_CHECKSIG:
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no packages given for signature check"));
|
|
|
|
if (!noPgp) checksigFlags |= CHECKSIG_PGP;
|
|
|
|
if (!noGpg) checksigFlags |= CHECKSIG_GPG;
|
|
|
|
if (!noMd5) checksigFlags |= CHECKSIG_MD5;
|
|
|
|
ec = rpmCheckSig(checksigFlags, (const char **)poptGetArgs(optCon));
|
|
|
|
/* XXX don't overflow single byte exit status */
|
|
|
|
if (ec > 255) ec = 255;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MODE_RESIGN:
|
|
|
|
if (!poptPeekArg(optCon))
|
|
|
|
argerror(_("no packages given for signing"));
|
|
|
|
ec = rpmReSign(addSign, passPhrase, (const char **)poptGetArgs(optCon));
|
|
|
|
/* XXX don't overflow single byte exit status */
|
|
|
|
if (ec > 255) ec = 255;
|
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#if !defined(__LCLINT__)
|
2000-05-25 01:53:35 +08:00
|
|
|
case MODE_QUERY:
|
|
|
|
case MODE_VERIFY:
|
|
|
|
case MODE_QUERYTAGS:
|
|
|
|
case MODE_INSTALL:
|
|
|
|
case MODE_UNINSTALL:
|
|
|
|
case MODE_BUILD:
|
|
|
|
case MODE_REBUILD:
|
|
|
|
case MODE_RECOMPILE:
|
|
|
|
case MODE_TARBUILD:
|
|
|
|
case MODE_INITDB:
|
|
|
|
case MODE_REBUILDDB:
|
|
|
|
if (!showVersion && !help && !noUsageMsg) printUsage();
|
|
|
|
break;
|
2001-04-29 09:05:43 +08:00
|
|
|
#endif
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif /* IAM_RPMK */
|
|
|
|
|
|
|
|
case MODE_UNKNOWN:
|
|
|
|
if (!showVersion && !help && !noUsageMsg) printUsage();
|
2000-05-19 05:03:14 +08:00
|
|
|
break;
|
2000-05-25 01:53:35 +08:00
|
|
|
|
2000-05-19 05:03:14 +08:00
|
|
|
}
|
|
|
|
|
2001-05-01 06:32:22 +08:00
|
|
|
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
|
2001-04-29 09:05:43 +08:00
|
|
|
exit:
|
2001-05-01 06:32:22 +08:00
|
|
|
#endif /* IAM_RPMBT || IAM_RPMK */
|
2000-05-19 05:03:14 +08:00
|
|
|
poptFreeContext(optCon);
|
|
|
|
rpmFreeMacros(NULL);
|
|
|
|
rpmFreeMacros(&rpmCLIMacroContext);
|
|
|
|
rpmFreeRpmrc();
|
|
|
|
|
|
|
|
if (pipeChild) {
|
|
|
|
fclose(stdout);
|
|
|
|
(void)waitpid(pipeChild, &status, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* keeps memory leak checkers quiet */
|
|
|
|
freeNames();
|
|
|
|
freeFilesystems();
|
|
|
|
urlFreeCache();
|
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
|
|
|
|
|
|
|
|
#ifdef IAM_RPMBT
|
2001-04-29 09:05:43 +08:00
|
|
|
ba->buildRootOverride = _free(ba->buildRootOverride);
|
|
|
|
ba->targets = _free(ba->targets);
|
2000-05-25 01:53:35 +08:00
|
|
|
#endif
|
2000-05-19 05:03:14 +08:00
|
|
|
|
|
|
|
#if HAVE_MCHECK_H && HAVE_MTRACE
|
|
|
|
muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
|
|
|
|
#endif
|
|
|
|
return ec;
|
|
|
|
}
|