+/* Used by test scripts to wait for things to get ready */
+static void wait_for_root(void) {
+ const char *password;
+
+ while(!trackdb_readable()) {
+ disorder_info("waiting for trackdb...");
+ sleep(1);
+ }
+ trackdb_init(TRACKDB_NO_RECOVER|TRACKDB_NO_UPGRADE);
+ for(;;) {
+ trackdb_open(TRACKDB_READ_ONLY);
+ password = trackdb_get_password("root");
+ trackdb_close();
+ if(password)
+ break;
+ disorder_info("waiting for root user to be created...");
+ sleep(1);
+ }
+ trackdb_deinit(NULL);
+}
+