|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
#include "system.h"
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
#include <popt.h>
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
#include <rpm/rpmcli.h>
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
#include <rpm/rpmdb.h>
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
#include "cliutils.h"
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
#include "debug.h"
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
enum modes {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
MODE_INITDB = (1 << 0),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
MODE_REBUILDDB = (1 << 1),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
MODE_VERIFYDB = (1 << 2),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
MODE_EXPORTDB = (1 << 3),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
MODE_IMPORTDB = (1 << 4),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
};
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
static int mode = 0;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
static struct poptOption dbOptsTable[] = {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ "initdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_INITDB,
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
N_("initialize database"), NULL},
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ "rebuilddb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_REBUILDDB,
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
N_("rebuild database inverted lists from installed package headers"),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
NULL},
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
&mode, MODE_VERIFYDB, N_("verify database files"), NULL},
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ "exportdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_EXPORTDB,
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
N_("export database to stdout header list"),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
NULL},
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ "importdb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_IMPORTDB,
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
N_("import database from stdin header list"),
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
NULL},
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
POPT_TABLEEND
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
};
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
static struct poptOption optionsTable[] = {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, dbOptsTable, 0,
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
N_("Database options:"), NULL },
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
N_("Common options for all rpm modes and executables:"), NULL },
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
POPT_AUTOALIAS
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
POPT_AUTOHELP
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
POPT_TABLEEND
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
};
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
static int exportDB(rpmts ts)
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
FD_t fd = fdDup(STDOUT_FILENO);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtxn txn = rpmtxnBegin(ts, RPMTXN_READ);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
int rc = 0;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
if (txn && fd) {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
Header h;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmdbMatchIterator mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, NULL, 0);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
while ((h = rpmdbNextIterator(mi))) {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rc += headerWrite(fd, h, HEADER_MAGIC_YES);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmdbFreeIterator(mi);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
} else {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rc = -1;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
Fclose(fd);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtxnEnd(txn);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
return rc;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
/* XXX: only allow this on empty db? */
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
static int importDB(rpmts ts)
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
FD_t fd = fdDup(STDIN_FILENO);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtxn txn = rpmtxnBegin(ts, RPMTXN_WRITE);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
int rc = 0;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
if (txn && fd) {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
Header h;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
while ((h = headerRead(fd, HEADER_MAGIC_YES))) {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rc += rpmtsImportHeader(txn, h, 0);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
} else {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rc = -1;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtxnEnd(txn);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
Fclose(fd);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
return rc;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
int main(int argc, char *argv[])
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
int ec = EXIT_FAILURE;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
poptContext optCon = NULL;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmts ts = NULL;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
xsetprogname(argv[0]); /* Portability call -- see system.h */
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
optCon = rpmcliInit(argc, argv, optionsTable);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
if (argc < 2 || poptPeekArg(optCon)) {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
printUsage(optCon, stderr, 0);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
goto exit;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
ts = rpmtsCreate();
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtsSetRootDir(ts, rpmcliRootDir);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
switch (mode) {
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
case MODE_INITDB:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
ec = rpmtsInitDB(ts, 0644);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
break;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
case MODE_REBUILDDB:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
{ rpmVSFlags vsflags = rpmExpandNumeric("%{_vsflags_rebuilddb}");
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmVSFlags ovsflags = rpmtsSetVSFlags(ts, vsflags);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
ec = rpmtsRebuildDB(ts);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtsSetVSFlags(ts, ovsflags);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
} break;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
case MODE_VERIFYDB:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
ec = rpmtsVerifyDB(ts);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
break;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
case MODE_EXPORTDB:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
ec = exportDB(ts);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
break;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
case MODE_IMPORTDB:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
ec = importDB(ts);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
break;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
default:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
argerror(_("only one major mode may be specified"));
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
exit:
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmtsFree(ts);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
rpmcliFini(optCon);
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
return ec;
|
|
![](https://seccdn.libravatar.org/avatar/7eafec293cdc84ccc79910e3192915e78e6e34e812c9116c61cc64bf13dc271a?s=16&d=retro) |
2ff057 |
}
|