From 44c04be6610e19b96e6a171b5e132ac10fd30d3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 9 Jun 2008 16:38:58 -0400 Subject: [PATCH] Add --initdb support for rpm wrapper. --- razor-root.c | 2 +- rpm-razor.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/razor-root.c b/razor-root.c index 5330868..cfbf59b 100644 --- a/razor-root.c +++ b/razor-root.c @@ -53,7 +53,7 @@ razor_root_create(const char *root) set = razor_set_create(); snprintf(path, sizeof path, "%s%s/%s", root, razor_root_path, system_repo_filename); - if (stat(root, &buf) == 0) { + if (stat(path, &buf) == 0) { fprintf(stderr, "a razor install root is already initialized\n"); return -1; diff --git a/rpm-razor.c b/rpm-razor.c index 5012a5a..6b1e81b 100644 --- a/rpm-razor.c +++ b/rpm-razor.c @@ -116,8 +116,10 @@ static const struct option signature_options[] = { { } }; +static int option_initdb; + static const struct option database_options[] = { - { OPTION_BOOL, "initdb", 0, NULL, "initialize database", NULL }, + { OPTION_BOOL, "initdb", 0, NULL, "initialize database", &option_initdb }, { OPTION_BOOL, "rebuilddb", 0, NULL, "rebuild database inverted lists from installed package headers", NULL }, { } }; @@ -238,6 +240,13 @@ static const struct option rpm_options[] = { static const char system_repo_filename[] = "system.repo"; static const char *repo_filename = system_repo_filename; +static const char install_root[] = "install"; + +static void +command_initdb(int argc, const char *argv[]) +{ + razor_root_create(install_root); +} static struct razor_property * add_property_packages(struct razor_set *set, @@ -768,7 +777,9 @@ main(int argc, const char *argv[]) exit(0); } - if (option_verify) { + if (option_initdb) { + command_initdb(argc, argv); + } else if (option_verify) { command_verify(argc, argv); } else if (option_query) { command_query(argc, argv); -- 1.7.1