-create_initial_data('domain' => $opt_d);
-
-warn "Freeside database initialized - commiting transaction\n" if $opt_v;
+warn "Tables and indices created - commiting transaction\n" if $opt_v;
+$dbh->commit or die $dbh->errstr;
+$dbh->disconnect or die $dbh->errstr;
+warn "Database schema committed successfully\n" if $opt_v;
+
+warn "Initializing configuration\n" if $opt_v;
+$FS::UID::callback_hack = 1;
+$dbh = adminsuidsetup $opt_u;
+$FS::UID::callback_hack = 0;
+if (!scalar(qsearch('conf', {}))) {
+ my $error = FS::Conf::init_config($config_dir);
+ if ($error) {
+ $dbh->rollback or die $dbh->errstr;
+ die $error;
+ }
+}