my ($version, $indexlevel, $skip_epoch, $skip_artnum, $jobs, $show_help);
my $skip_docdata;
my $ng = '';
-my @c_extra;
+my (@c_extra, @chdir);
my %opts = (
'V|version=i' => \$version,
'L|index-level|indexlevel=s' => \$indexlevel,
'skip-docdata' => \$skip_docdata,
'help|h' => \$show_help,
'c=s@' => \@c_extra,
+ 'C=s@' => \@chdir,
);
my $usage_cb = sub {
print STDERR $help;
my $http_url = shift @ARGV or $usage_cb->();
my (@address) = @ARGV;
@address or $usage_cb->();
++PublicInbox::Admin::do_chdir(\@chdir);
@c_extra = map {
my ($k, $v) = split(/=/, $_, 2);
require PublicInbox::Config;
my $pi_config = PublicInbox::Config->default_file;
-require File::Basename;
-my $dir = File::Basename::dirname($pi_config);
+my ($dir) = ($pi_config =~ m!(.*?/)[^/]+\z!);
require File::Path;
File::Path::mkpath($dir); # will croak on fatal errors
}
$ibx->init_inbox(0, $skip_epoch, $skip_artnum);
+my $f = "$inboxdir/description";
+if (sysopen $fh, $f, O_CREAT|O_EXCL|O_WRONLY) {
+ print $fh "public inbox for $address[0]\n" or die "print($f): $!";
+ close $fh or die "close($f): $!";
+}
+
# needed for git prior to v2.1.0
umask(0077) if defined $perm;