diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-10 16:58:00 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-11-12 14:22:00 +0000 |
commit | 0959e8b354ca03d4e1896ea7c91aa093e26ea5b1 (patch) | |
tree | 285dd7abacb52f0c03dea64812afc150f439c56d /src/hlr_db_tool.c | |
parent | 4f3841c1533b62ff286260653e429ffc95d7cf37 (diff) |
db-tool: add command 'create'
Change-Id: Ic4997d17763e50fb63c36fc0001570230bf64a12
Diffstat (limited to 'src/hlr_db_tool.c')
-rw-r--r-- | src/hlr_db_tool.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/hlr_db_tool.c b/src/hlr_db_tool.c index eb82c92..13281f2 100644 --- a/src/hlr_db_tool.c +++ b/src/hlr_db_tool.c @@ -51,8 +51,7 @@ static struct { static void print_help() { printf("\n"); - printf("Usage: osmo-hlr-db-tool [-l <hlr.db>] import-nitb-db <nitb.db>]\n"); - printf("Call without arguments to create a new empty ./hlr.db.\n"); + printf("Usage: osmo-hlr-db-tool [-l <hlr.db>] [create|import-nitb-db <nitb.db>]\n"); printf(" -l --database db-name The OsmoHLR database to use, default '%s'.\n", cmdline_opts.db_file); printf(" -h --help This text.\n"); @@ -62,6 +61,11 @@ static void print_help() printf(" -e --log-level number Set a global loglevel.\n"); printf(" -V --version Print the version of OsmoHLR-db-tool.\n"); printf("\n"); + printf("Commands:\n"); + printf("\n"); + printf(" create Create an empty OsmoHLR database.\n"); + printf(" (All commands imply this if none exists yet.)\n"); + printf("\n"); printf(" import-nitb-db db Add OsmoNITB db's subscribers to OsmoHLR db.\n"); printf(" Be aware that the import is lossy, only the\n"); printf(" IMSI, MSISDN, nam_cs/ps and 2G auth data are set.\n"); @@ -141,7 +145,10 @@ static void handle_options(int argc, char **argv) cmd = argv[optind++]; printf("command '%s', %d extra arguments\n", cmd, argc - optind); - if (!strcmp(cmd, "import-nitb-db")) { + if (!strcmp(cmd, "create")) { + /* Nothing to do, just run the main program to open the database without running any + * action, which will bootstrap all tables. */ + } else if (!strcmp(cmd, "import-nitb-db")) { if (argc - optind < 1) { fprintf(stderr, "You must specify an input db file\n"); print_help(); @@ -387,7 +394,8 @@ int main(int argc, char **argv) goto too_many_actions; main_action = import_nitb_db; } - /* Future: add more main_actions, besides --import-nitb-db, here. */ + /* Future: add more main_actions, besides import-nitb-db, here. + * For command 'create', no action is required. */ /* Just in case any db actions need randomness */ rc = rand_init(); |