chiark / gitweb /
actually check in the script
[chiark-utils.git] / scripts / cvsweb-list
1 #!/usr/bin/perl
2 # cvsweb-list
3 # This little program produces a web page listing the cvs repositories
4 # available by ucgi cvsweb.  It doesn't really separate code and
5 # configuration, so it's not installed by default with chiark-utils.
6
7 # This file is part of chiark-utils, a collection of useful programs
8 # used on chiark.greenend.org.uk.
9 #
10 # This file is:
11 #  Copyright (C) 2001 Ian Jackson <ian@chiark.greenend.org.uk>
12 #
13 # This is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2, or (at your option) any later version.
16 #
17 # This is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
20 # details.
21 #
22 # You should have received a copy of the GNU General Public License along
23 # with this program; if not, write to the Free Software Foundation, Inc.,
24 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26
27 print <<END or die $!;
28 Content-Type: text/html
29
30 <head>
31 <title>chiark public CVS</title>
32 <link rev="made" href="mailto:webmaster\@chiark.greenend.org.uk">
33 </head>
34 <body>
35 <h1><img src="/chiark/icon90.gif" border="0" width="128" height="64"
36 alt=""> chiark users' public CVS</h1>
37 <ul>
38 END
39
40 open UL, "/etc/userlist" or die $!;
41 while (<UL>) {
42     next if m/^\#/ or !m/\S/;
43     chomp($user= $_);
44     next unless readlink "/home/$user/public-cgi/cvsweb"
45         eq '/usr/local/lib/cvsweb';
46     $hd= 0;
47     $pc= "/home/$user/public-CVS/";
48     next unless opendir D, $pc;
49     while (defined($mod= readdir D)) {
50         next unless -d "$pc/$mod";
51         next if $mod =~ m/^\./;
52         if (!$hd) {
53             print "<li><A href=\"/ucgi/~$user/cvsweb\">$user</A>" or die $!;
54             print " (<A href=\"/~$user/\">homepage</A>)" or die $!
55                 if -d "/home/$user/public-html";
56             print ":" or die $!;
57             $hd= 1;
58         } else {
59             print "," or die $!;
60         }
61         print " <A href=\"/ucgi/~$user/cvsweb/$mod/\">$mod</A>" or die $!;
62     }
63     next unless $hd;
64     print "</li>\n" or die $!;
65 }
66
67 close UL or die $!;
68
69 print <<END or die $!;
70 </ul>
71 <hr>
72 <ADDRESS>
73   maintained by
74   <A HREF="mailto:$ENV{SERVER_ADMIN}">$ENV{SERVER_ADMIN}</A>;
75   <A href="/">chiark home page</A>
76 </ADDRESS>
77 </body>
78 END
79
80 exit 0