X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=script%2Fpublic-inbox-init;h=5de4578158fb19412ade85ae534cab27fba1d4e6;hp=78a4d3bd75748f65110bb3e8af18c7d4fc976df8;hb=refs%2Fheads%2Fmaster;hpb=ce7053d091329b130ac107e64595d18cdbd26409 diff --git a/script/public-inbox-init b/script/public-inbox-init index 78a4d3bd..5de45781 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -36,7 +36,7 @@ PublicInbox::Admin::require_or_die('-base'); 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, @@ -47,6 +47,7 @@ my %opts = ( 'skip-docdata' => \$skip_docdata, 'help|h' => \$show_help, 'c=s@' => \@c_extra, + 'C=s@' => \@chdir, ); my $usage_cb = sub { print STDERR $help; @@ -59,6 +60,7 @@ my $inboxdir = shift @ARGV or $usage_cb->(); 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); @@ -210,6 +212,12 @@ if ($skip_docdata) { } $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; @@ -246,9 +254,3 @@ if (defined $perm) { rename $pi_config_tmp, $pi_config or die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n"; undef $auto_unlink; # trigger ->DESTROY - -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): $!"; -}