Add --initdb support for rpm wrapper.
1.1 --- a/razor-root.c Mon Jun 09 16:14:05 2008 -0400
1.2 +++ b/razor-root.c Mon Jun 09 16:38:58 2008 -0400
1.3 @@ -53,7 +53,7 @@
1.4 set = razor_set_create();
1.5 snprintf(path, sizeof path, "%s%s/%s",
1.6 root, razor_root_path, system_repo_filename);
1.7 - if (stat(root, &buf) == 0) {
1.8 + if (stat(path, &buf) == 0) {
1.9 fprintf(stderr,
1.10 "a razor install root is already initialized\n");
1.11 return -1;
2.1 --- a/rpm-razor.c Mon Jun 09 16:14:05 2008 -0400
2.2 +++ b/rpm-razor.c Mon Jun 09 16:38:58 2008 -0400
2.3 @@ -116,8 +116,10 @@
2.4 { }
2.5 };
2.6
2.7 +static int option_initdb;
2.8 +
2.9 static const struct option database_options[] = {
2.10 - { OPTION_BOOL, "initdb", 0, NULL, "initialize database", NULL },
2.11 + { OPTION_BOOL, "initdb", 0, NULL, "initialize database", &option_initdb },
2.12 { OPTION_BOOL, "rebuilddb", 0, NULL, "rebuild database inverted lists from installed package headers", NULL },
2.13 { }
2.14 };
2.15 @@ -238,6 +240,13 @@
2.16
2.17 static const char system_repo_filename[] = "system.repo";
2.18 static const char *repo_filename = system_repo_filename;
2.19 +static const char install_root[] = "install";
2.20 +
2.21 +static void
2.22 +command_initdb(int argc, const char *argv[])
2.23 +{
2.24 + razor_root_create(install_root);
2.25 +}
2.26
2.27 static struct razor_property *
2.28 add_property_packages(struct razor_set *set,
2.29 @@ -768,7 +777,9 @@
2.30 exit(0);
2.31 }
2.32
2.33 - if (option_verify) {
2.34 + if (option_initdb) {
2.35 + command_initdb(argc, argv);
2.36 + } else if (option_verify) {
2.37 command_verify(argc, argv);
2.38 } else if (option_query) {
2.39 command_query(argc, argv);