]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-init
searchview: show full (&x=t) messages in ascending chronlogical order
[public-inbox.git] / script / public-inbox-init
index d66361dfed4877801033595430aff9b2dfa04291..e23d14199fda60637efd65de271a74ed35dc384b 100755 (executable)
@@ -28,6 +28,11 @@ mkpath($dir); # will croak on fatal errors
 my ($fh, $filename) = tempfile('pi-init-XXXXXXXX', DIR => $dir);
 if (-e $pi_config) {
        open(my $oh, '<', $pi_config) or die "unable to read $pi_config: $!\n";
+       my @st = stat($oh);
+       my $perm = $st[2];
+       defined $perm or die "(f)stat failed on $pi_config: $!\n";
+       chmod($perm & 07777, $fh) or
+               die "(f)chmod failed on future $pi_config: $!\n";
        my $old;
        {
                local $/;
@@ -43,10 +48,10 @@ if (-e $pi_config) {
        foreach my $addr (@address) {
                my $found = $cfg->lookup($addr);
                if ($found) {
-                       if ($found->{listname} ne $name) {
+                       if ($found->{name} ne $name) {
                                print STDERR
                                        "`$addr' already defined for ",
-                                       "`$found->{listname}',\n",
+                                       "`$found->{name}',\n",
                                        "does not match intend `$name'\n";
                                $conflict = 1;
                        } else {
@@ -63,6 +68,10 @@ my $pfx = "publicinbox.$name";
 my @x = (qw/git config/, "--file=$filename");
 $git_dir = abs_path($git_dir);
 x(qw(git init -q --bare), $git_dir);
+
+# set a reasonable default:
+x(qw/git config/, "--file=$git_dir/config", 'repack.writeBitmaps', 'true');
+
 foreach my $addr (@address) {
        next if $seen{lc($addr)};
        x(@x, "--add", "$pfx.address", $addr);