fab0a90
diff -pruN man-pages-ja-20120515.orig/script/configure.perl man-pages-ja-20120515/script/configure.perl
fab0a90
--- man-pages-ja-20120515.orig/script/configure.perl	2010-11-10 03:14:23.000000000 +0900
fab0a90
+++ man-pages-ja-20120515/script/configure.perl	2012-05-18 18:49:00.000000000 +0900
f8e7339
@@ -1,4 +1,5 @@
f8e7339
 #!/usr/bin/perl
f8e7339
+use IO::Handle;
f8e7339
 use Env qw (PATH LANG);
f8e7339
 use strict 'vars';
254bc66
 use Encode qw (decode);
254bc66
@@ -13,6 +14,13 @@ my ($MANROOT, $PACK, $OWNER, $GROUP,
f8e7339
 my $PKGLIST = "script/pkgs.list";
f8e7339
 my @pack_method = ("none", "gzip", "bzip2", "compress");
f8e7339
 my $podsec = "1";
f8e7339
+my @stdin;
f8e7339
+my $pipeflag = 0;
f8e7339
+
f8e7339
+if ( -p STDIN ) {
f8e7339
+    $pipeflag = 1;
f8e7339
+    @stdin = STDIN->getlines;
f8e7339
+}
f8e7339
 
f8e7339
 #
254bc66
 # インストール情報
254bc66
@@ -23,7 +31,7 @@ print "(just Return if you accept defaul
f8e7339
 do{
f8e7339
     $MANROOT = "/usr/share/man/$LANG";
f8e7339
     print "   Install directory   [$MANROOT] ?: ";
f8e7339
-    $ans = <STDIN>; chomp $ans;
f8e7339
+    $ans = &get_from_stdin; chomp $ans;
f8e7339
     if ($ans ne "") {$MANROOT = $ans;}
f8e7339
 
f8e7339
     print "   compress manual with..\n";
254bc66
@@ -31,19 +39,19 @@ do{
f8e7339
 	print "      $i: $pack_method[$i]\n";
f8e7339
     }
f8e7339
     print "   select [0..$#pack_method] : ";
f8e7339
-    $ans = <STDIN>; chomp $ans;
f8e7339
+    $ans = &get_from_stdin; chomp $ans;
f8e7339
     if  ($ans eq "") {$ans = 0;}
f8e7339
     if ($ans < 0 || $ans > $#pack_method) {$PACK = $pack_method[0]}
f8e7339
     else {$PACK = $pack_method[$ans]}
f8e7339
 
f8e7339
     $OWNER = "root";
f8e7339
     print "   uname of page owner [$OWNER] ?: ";
f8e7339
-    $ans = <STDIN>; chomp $ans;
f8e7339
+    $ans = &get_from_stdin; chomp $ans;
f8e7339
     if ($ans ne "") {$OWNER = $ans;}
f8e7339
 
f8e7339
     $GROUP = "root";
f8e7339
     print "   group of page owner [$GROUP] ?: ";
f8e7339
-    $ans = <STDIN>; chomp $ans;
f8e7339
+    $ans = &get_from_stdin; chomp $ans;
f8e7339
     if ($ans ne "") {$GROUP = $ans;}
f8e7339
 
f8e7339
     print "\n";
254bc66
@@ -53,7 +61,7 @@ do{
f8e7339
     print "\n";
f8e7339
     do {
f8e7339
 	print "All OK? (Yes, [C]ontinue / No, [R]eselect) : ";
f8e7339
-	$ans = <STDIN>; chomp $ans;
f8e7339
+	$ans = &get_from_stdin; chomp $ans;
f8e7339
     } until ($ans =~ /^[yYnNcCrR]/);
f8e7339
 
f8e7339
 } until ($ans =~ /^[yYcC]/);
254bc66
@@ -93,14 +101,14 @@ do{
f8e7339
     for $i (0 .. $#pl){
f8e7339
 	my $qstr = ($main::pw{$pl[$i]} > -1) ? "[Y/n]" : "[y/N]";
f8e7339
 	printf "   [%2d/%2d] %-15s %s ?: ", $i, $#pl, $pl[$i], $qstr;
f8e7339
-	$ans = <STDIN>; chomp $ans;
f8e7339
+	$ans = &get_from_stdin; chomp $ans;
f8e7339
 	if ($ans =~ /[Yy].*/) { $main::pw{$pl[$i]} = $i;}
f8e7339
 	if ($ans =~ /[Nn].*/) { $main::pw{$pl[$i]} = -1;}
f8e7339
     }
f8e7339
 
f8e7339
     do {
f8e7339
 	print "All OK? (Yes, [C]ontinue / No, [R]eselect) : ";
f8e7339
-	$ans = <STDIN>; chomp $ans;
f8e7339
+	$ans = &get_from_stdin; chomp $ans;
f8e7339
     } until ($ans =~ /[yYnNcCrR].*/);
f8e7339
 
f8e7339
 } until ($ans =~ /^[yYcC]/);
fab0a90
@@ -113,8 +121,10 @@ while(<TL>) {
fab0a90
     $_ = decode('utf-8', $_);
fab0a90
     if (/^×/ || /^▲/ || /^△/ || /^●/ || /^※/ || /^$/) { next; }
12e10dc
     chomp;
fab0a90
+    if (/^$/) { next; }
12e10dc
     my @l = split /:/;
12e10dc
     $l[1] =~ s/ /_/e;
fab0a90
+    unless (exists $main::pw{$l[1]} && defined $main::pw{$l[1]}) {die "Missing `$l[1]'($_) in pkg.list";}
12e10dc
     if ($main::pw{$l[1]} == -1) {next;}
12e10dc
     (my $sec, my $osec) =  split /=>/, $l[5];
12e10dc
     if ($sec eq "pod"){$sec = $podsec;}
fab0a90
@@ -165,7 +175,7 @@ do{
f8e7339
 	}
f8e7339
 	print "   Which to install? (0..$cf) : ";
f8e7339
 
f8e7339
-	$ans = <STDIN>; chomp $ans;
f8e7339
+	$ans = &get_from_stdin; chomp $ans;
f8e7339
 	if ($ans eq "") {$ans = 0};
f8e7339
 	if ($ans < 0 || $ans > $cf) { $ans = 0 };
f8e7339
 
fab0a90
@@ -180,7 +190,7 @@ do{
f8e7339
 
f8e7339
     do {
f8e7339
 	print "All OK? (Yes, [C]ontinue / No, [R]eselect) : ";
f8e7339
-	$ans = <STDIN>; chomp $ans;
f8e7339
+	$ans = &get_from_stdin; chomp $ans;
f8e7339
     } until ($ans =~ /^[yYnNcCrR]/);
f8e7339
 
f8e7339
 } until ($ans =~ /^[yYcC]/);
fab0a90
@@ -195,10 +205,8 @@ open (ISS, ">installman.sh") || die "can
12e10dc
 print ISS "#!/bin/sh\n";
12e10dc
 
12e10dc
 print ISS "mkdir -p $MANROOT;";
12e10dc
-print ISS "chown $OWNER.$GROUP $MANROOT\n";
12e10dc
 for $i (1..9){
12e10dc
     print ISS "mkdir -p $MANROOT/man$i;";
12e10dc
-    print ISS "chown $OWNER.$GROUP $MANROOT/man$i\n";
12e10dc
 }
12e10dc
 print ISS "\n";
12e10dc
 
fab0a90
@@ -209,7 +217,7 @@ foreach my $key (sort keys %ppage) {
12e10dc
     my $mandst = "$MANROOT/man$sec";
12e10dc
 
12e10dc
     print ISS "echo -n install $pkg: $name.$sec .. \n";
12e10dc
-    print ISS "install -o $OWNER -g $GROUP -m 644 $mansrc $mandst\n";
12e10dc
+    print ISS "install -p -m 644 $mansrc $mandst\n";
12e10dc
 
12e10dc
     if ($PACK ne "none"){
12e10dc
 	print ISS "echo -n $PACK .. \n";
fab0a90
@@ -235,3 +243,14 @@ sub by_sec_name {
f8e7339
 	($af[2] <=> $bf[2]) || ($af[1] cmp $bf[1]);
f8e7339
 }
f8e7339
 
f8e7339
+sub get_from_stdin {
f8e7339
+    my $retval;
f8e7339
+
f8e7339
+    if ( $pipeflag ) {
f8e7339
+        $retval = shift (@stdin);
f8e7339
+    } else {
f8e7339
+        $retval = scalar (<STDIN>);
f8e7339
+    }
f8e7339
+    return $retval;
f8e7339
+}
f8e7339
+