From: Kristian Høgsberg Date: Mon, 9 Jun 2008 20:38:58 +0000 (-0400) Subject: Add --initdb support for rpm wrapper. X-Git-Tag: 0.1~136 X-Git-Url: http://project.juiblex.co.uk/git/?a=commitdiff_plain;h=44c04be6610e19b96e6a171b5e132ac10fd30d3c;p=razor.git Add --initdb support for rpm wrapper. --- 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);