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