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;
{ }
};
+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 },
{ }
};
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,
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);