4 use vars qw($opt_u $opt_f $opt_v);
6 use FS::UID qw(adminsuidsetup checkeuid dbh);
8 use FS::Record qw(qsearch);
12 die "Not running uid freeside!" unless checkeuid();
15 my $dir = shift or die &usage;
17 $FS::CurrentUser::upgrade_hack = 1;
18 $FS::UID::AutoCommit = 0;
19 $FS::UID::callback_hack = 1;
20 adminsuidsetup $opt_u; #$user;
24 if (!scalar(qsearch('conf', {})) || $opt_f) {
25 my $error = FS::Conf::init_config($dir);
27 warn "CONFIGURATION INITIALIZATION FAILED\n";
28 dbh->rollback or die dbh->errstr;
33 warn "Freeside database initialized - committing transaction\n" if $opt_v;
35 dbh->commit or die dbh->errstr;
36 dbh->disconnect or die dbh->errstr;
38 warn "Configuration initialization committed successfully\n" if $opt_v;
41 die "Usage:\n freeside-init-config [ -v ] [ -f ] directory\n"
42 # [ -u user ] for devel/multi-db installs