OSDN Git Service

module-init-tools: add notices telling that this package is obsolete.
[linuxjm/jm.git] / bin / mksolinks.perl
1 #!/usr/bin/perl
2 #
3 # mksolinks.perl:
4 #   $MANROOT (想定しているのは checkout してきた JM CVS リポジトリ の
5 #   (JM/manual/) 以下にある */translation_list を見て、 */release/man?
6 #   以下に .so リンクのファイルを作るスクリプト.
7 #
8 $TRANSLIST = "translation_list";
9
10 # get arg
11 #
12 if (@ARGV < 1) {die "$0 manroot\n"};
13
14 $MANROOT = $ARGV[0];
15 unless (-d $MANROOT) {die "$MANROOT does not exist\n"};
16
17 open(RL,"cat `find $MANROOT -name $TRANSLIST` |");
18 while(<RL>){
19         chop;
20         unless (/^@/) {next};
21
22 # ※:yp-tools:2.3:1998/05/??:ypchfn:1:yppasswd:1:
23 #
24         @lf = split /:/;
25         $pkg = $lf[1];
26         $pkg =~ s/ /_/g;
27
28         $lname = $lf[4];
29         $lsec  = $lf[5];
30         $pname = $lf[6];
31         $psec  = $lf[7];
32
33         if (-d "$MANROOT/$pkg/release/man$psec") {
34                 $MANDIR = "$MANROOT/$pkg/release";
35         } elsif (-d "$MANROOT/$pkg/man$psec") {
36                 $MANDIR = "$MANROOT/$pkg";
37         } else {
38                 print "Warning no man? directories are found at $pkg/\n";
39         }
40
41         $pfile = "$MANDIR/man$psec/$pname.$psec";
42         unless (-f $pfile) {
43                 print "Warning: $pfile does not exist\n";
44                 next;
45         }
46
47         unless (-d "$MANDIR/man$lsec") {system "mkdir -p $MANDIR/man$lsec";}
48         $lfile = "$MANDIR/man$lsec/$lname.$lsec";
49         if (-f $lfile) {
50                 print "skip $lfile (already exists)\n";
51                 next;
52         } else{
53                 system "echo .so man$psec/$pname.$psec > $lfile";
54                 print "make $lfile as an .so link\n"
55         }
56 }
57