Handle hostnames with upper-case letters
[webmin.git] / software / rhn.cgi
1 #!/usr/local/bin/perl
2 # rhn.cgi
3 # Display a list of packages available for download from RHN
4
5 require './software-lib.pl';
6 $bgcolor = defined($gconfig{'cs_page'}) ? $gconfig{'cs_page'} : "ffffff";
7 $link = defined($gconfig{'cs_link'}) ? $gconfig{'cs_link'} : "0000ee";
8 $text = defined($gconfig{'cs_text'}) ? $gconfig{'cs_text'} : "000000";
9 &PrintHeader();
10 print <<EOF;
11 <html>
12 <head><title>$text{'rhn_title'}</title>
13 <script>
14 function sel(p)
15 {
16 window.opener.ifield.value = p;
17 window.close();
18 return false;
19 }
20 </script>
21 </head><body bgcolor=#$bgcolor link=#$link vlink=#$link text=#$text>
22 EOF
23
24 $out = `up2date -l 2>&1`;
25 if ($out =~ /Error Message:/i) {
26         print "<pre>$out</pre>\n";
27         }
28 else {
29         print "<table width=100%>\n";
30         foreach (split(/\n/, $out)) {
31                 if ($dashes && /^(\S+)\s+(\S+)\s+(\S+)/) {
32                         if (!$count++) {
33                                 print "<tr> <td><b>$text{'rhn_pack'}</b></td> ",
34                                       "<td align=right><b>",
35                                       "$text{'rhn_version'}</b></td> </tr>\n";
36                                 }
37                         print "<tr>\n";
38                         print "<td><a href='' onClick='sel(\"$1\")'>$1</a></td>\n";
39                         print "<td align=right>$2 - $3</td>\n";
40                         print "</tr>\n";
41                         }
42                 elsif (/^----/) {
43                         last if ($dashes);
44                         $dashes++;
45                         }
46                 }
47         print "</table>\n";
48         if (!$count) {
49                 print "<b>$text{'rhn_nonefound'}</b><p>\n";
50                 }
51         }
52 print "</body></html>\n";
53