diff options
author | default <nobody@localhost> | 2022-11-25 10:53:16 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-11-25 10:53:16 +0100 |
commit | 45be9a1cb1971786c72f82f8d236edbdfd662b84 (patch) | |
tree | de1d978eadb79ec87f27fa3538784e5cf5d4384b /main.c | |
parent | 8a71e2e557af62c9d3c89b519c4e98dd26dbc859 (diff) |
New command-line command 'upgrade'.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -16,6 +16,7 @@ int usage(void) printf("Commands:\n"); printf("\n"); printf("init [{basedir}] Initializes the database\n"); + printf("upgrade {basedir} Upgrade to a new version\n"); printf("adduser {basedir} [{uid}] Adds a new user\n"); printf("httpd {basedir} Starts the HTTPD daemon\n"); printf("purge {basedir} Purges old data\n"); @@ -76,6 +77,19 @@ int main(int argc, char *argv[]) return initdb(basedir); } + if (strcmp(cmd, "upgrade") == 0) { + int ret; + + /* database upgrade */ + if ((basedir = GET_ARGV()) == NULL) + return usage(); + + if ((ret = srv_open(basedir, 1)) == 1) + srv_log(xs_dup("OK")); + + return ret; + } + if (strcmp(cmd, "markdown") == 0) { /* undocumented, for testing only */ xs *c = xs_readall(stdin); @@ -88,7 +102,7 @@ int main(int argc, char *argv[]) if ((basedir = GET_ARGV()) == NULL) return usage(); - if (!srv_open(basedir)) { + if (!srv_open(basedir, 0)) { srv_log(xs_fmt("error opening database at %s", basedir)); return 1; } |