2001-11-14 03:04:33 +08:00
|
|
|
#include "system.h"
|
|
|
|
#include "rpmcli.h"
|
|
|
|
#include "misc.h"
|
2007-08-09 16:22:40 +08:00
|
|
|
#include "rpmts.h"
|
2001-11-14 03:04:33 +08:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#define UP2DATEGLOB "/var/spool/up2date/*.rpm"
|
|
|
|
|
|
|
|
static struct poptOption optionsTable[] = {
|
|
|
|
{ "verbose", 'v', 0, 0, 'v',
|
|
|
|
N_("provide more detailed output"), NULL},
|
2002-01-28 23:51:06 +08:00
|
|
|
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmInstallPoptTable, 0,
|
2001-11-14 03:04:33 +08:00
|
|
|
N_("Install/Upgrade/Erase options:"),
|
|
|
|
NULL },
|
|
|
|
POPT_AUTOHELP
|
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, const char *argv[])
|
|
|
|
{
|
|
|
|
poptContext optCon;
|
|
|
|
struct rpmInstallArguments_s * ia = &rpmIArgs;
|
|
|
|
int arg;
|
|
|
|
int ec = 0;
|
2007-08-09 16:22:40 +08:00
|
|
|
rpmts ts;
|
2001-11-14 03:04:33 +08:00
|
|
|
|
|
|
|
#if HAVE_MCHECK_H && HAVE_MTRACE
|
|
|
|
mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
|
|
|
|
#endif
|
|
|
|
setprogname(argv[0]); /* Retrofit glibc __progname */
|
|
|
|
|
|
|
|
/* set up the correct locale */
|
|
|
|
(void) setlocale(LC_ALL, "" );
|
|
|
|
|
|
|
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
|
|
|
textdomain(PACKAGE);
|
|
|
|
|
|
|
|
rpmSetVerbosity(RPMMESS_NORMAL);
|
|
|
|
|
|
|
|
optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
|
|
|
|
(void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
|
|
|
|
(void) poptReadDefaultConfig(optCon, 1);
|
|
|
|
poptSetExecPath(optCon, RPMCONFIGDIR, 1);
|
|
|
|
|
|
|
|
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
|
|
|
switch(arg) {
|
|
|
|
case 'v':
|
|
|
|
rpmIncreaseVerbosity();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-28 23:51:06 +08:00
|
|
|
if (ia->rbtid == 0) {
|
|
|
|
fprintf(stderr, "--rollback <timestamp> is required\n");
|
2001-11-14 03:04:33 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2002-01-28 23:51:06 +08:00
|
|
|
if (rpmReadConfigFiles(NULL, NULL))
|
|
|
|
exit(1);
|
2001-11-14 03:04:33 +08:00
|
|
|
|
2007-08-09 16:22:40 +08:00
|
|
|
ts = rpmtsCreate();
|
|
|
|
ec = rpmRollback(ts, ia, NULL);
|
|
|
|
ts = rpmtsFree(ts);
|
2001-11-14 03:04:33 +08:00
|
|
|
|
|
|
|
optCon = poptFreeContext(optCon);
|
|
|
|
rpmFreeMacros(NULL);
|
|
|
|
|
|
|
|
#if HAVE_MCHECK_H && HAVE_MTRACE
|
|
|
|
muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ec;
|
|
|
|
}
|