Author: pebender
Date: Sun Aug 31 12:24:45 2008
New Revision: 3685

Added:
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/mm_webpage.pm
Modified:
    trunk/gar-minimyth/html/minimyth/document-changelog.txt
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/filesystem.cgi
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/software.cgi
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/status.cgi

Log:
- Coverted CGI scripts from sh to perl.



Modified: trunk/gar-minimyth/html/minimyth/document-changelog.txt
==============================================================================
--- trunk/gar-minimyth/html/minimyth/document-changelog.txt     (original)
+++ trunk/gar-minimyth/html/minimyth/document-changelog.txt     Sun Aug 31  
12:24:45 2008
@@ -1,7 +1,7 @@
  MiniMyth Changelog

   
--------------------------------------------------------------------------------
-Changes since 57 (2008-08-30):
+Changes since 57 (2008-08-31):

  Current MythTV versions
      MythTV 0.21:  version 0.21.0,      release-0-21-fixes branch svn 18207.
@@ -13,6 +13,9 @@

  Modified image
      - Added g15daemon's g15plugin_clock to help with testing.
+
+Modified built in web pages
+    - Coverted CGI scripts from sh to perl.

  Modified init
      - Added perl init scripts.

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/filesystem.cgi
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/filesystem.cgi
       
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/filesystem.cgi
       
Sun Aug 31 12:24:45 2008
@@ -1,72 +1,33 @@
-#!/bin/sh
+#!/usr/bin/perl

-. /etc/conf
+use warnings;
+use strict;

-page_host=`/bin/hostname`
-page_date=`/bin/date +'%Y-%m-%d %H:%M:%S %Z'`
+require MiniMyth;

-server=${HTTP_HOST:-${SERVER_ADDR}}
+require "/srv/www/cgi-bin/mm_webpage.pm";

-/bin/echo "Content-Type: text/html; charset=UTF-8"
-/bin/echo
-/bin/echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"  
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\";>"
-/bin/echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\">"
-/bin/echo "  <head>"
-/bin/echo "    <meta name=\"author\" content=\"Paul Bender\" />"
-/bin/echo "    <meta name=\"copyright\" content=\"2006-2008 Paul Bender  
&amp; minimyth.org\" />"
-/bin/echo "    <meta name=\"keywords\"  
content=\"PVR,Linux,MythTV,MiniMyth\" />"
-/bin/echo "    <meta name=\"description\" content=\"\" />"
-/bin/echo "    <meta http-equiv=\"Content-Type\" content=\"text/html;  
charset=UTF-8\" />"
-/bin/echo "    <title>MiniMyth Frontend Filesystem</title>"
-/bin/echo "    <style type=\"text/css\" title=\"main-styles\">"
-/bin/echo "      @import \"../css/minimyth.css\";"
-/bin/echo "    </style>"
-/bin/echo "  </head>"
-/bin/echo "  <body>"
-/bin/echo "    <div class=\"main\">"
-/bin/echo "      <div class=\"header\">"
-/bin/echo "        <div class=\"heading\">MiniMyth from <a  
href=\"http://minimyth.org/\";>minimyth.org</a></div>"
-/bin/echo "        <div class=\"menu\">"
-/bin/echo "          <span class=\"menuItemFirst\"><a  
href=\"../index.html\">Home</a></span>"
-/bin/echo "          <span class=\"menuItem\"     >Filesystem</span>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"note\">"
-/bin/echo "          ${page_date}<br />"
-/bin/echo "          ${page_host}<br />"
-/bin/echo "          ${MM_VERSION}"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "      <div class=\"middle\">"
-/bin/echo "        <div class=\"heading\">MiniMyth Frontend  
Filesystem</div>"
-/bin/echo "        <div class=\"section\">"
-/bin/echo "          <p>"
-if /usr/bin/test "${MM_SECURITY_ENABLED}" = "no" ; then
-    /bin/echo "            You can use the URL <a  
href=\"http://${server}:8080/\";>http://${server}:8080/</a> to access your  
MiniMyth frontend's filesystem."
+my $minimyth    = new MiniMyth;
+my $server_name = $ENV{'SERVER_NAME'};
+
+my @middle = ();
+
+push(@middle,  q(<div class="section">));
+push(@middle,  q(  <p>));
+if ($minimyth->var_get('MM_SECURITY_ENABLED') eq 'no')
+{
+    push(@middle, qq(    You can use the URL <a  
href="http://$server_name:8080/";>http://$server_name:8080/</a> to access  
your MiniMyth frontend's filesystem.));
+}
  else
-    /bin/echo "            Your MiniMyth frontend has security enabled."
-    /bin/echo "            Therefore, you cannot access your MiniMyth  
frontend's filesystem."
-fi
-/bin/echo "          </p>"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "      <div class=\"footer\">"
-/bin/echo "        <hr />"
-/bin/echo "        <div class=\"valid-xhtml\">"
-/bin/echo "          <a  
href=\"http://validator.w3.org/check?uri=referer\";><img"
-/bin/echo "              src=\"/image/w3c-valid-xhtml11-blue.gif\""
-/bin/echo "              alt=\"Valid XHTML 1.1\" height=\"31\"  
width=\"88\" /></a>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"valid-css\">"
-/bin/echo "          <a  
href=\"http://jigsaw.w3.org/css-validator/check/referer\";><img"
-/bin/echo "              src=\"/image/w3c-valid-css2-blue.gif\""
-/bin/echo "              alt=\"Valid CSS!\"      height=\"31\"  
width=\"88\" /></a>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"version\">"
-/bin/echo "          Last Updated on 2008-05-17"
-/bin/echo "          <br />"
-/bin/echo "           
&lt;&nbsp;mailto&nbsp;:&nbsp;webmaster&nbsp;at&nbsp;minimyth&nbsp;dot&nbsp;org&nbsp;&gt;"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "    </div>"
-/bin/echo "  </body>"
-/bin/echo "</html>"
+{
+    push(@middle,  q(    Your MiniMyth frontend has security enabled.));
+    push(@middle,  q(    Therefore, you cannot access your MiniMyth  
frontend's filesystem.));
+}
+push(@middle,  q(  </p>));
+push(@middle,  q(</div>));
+
+my $page = mm_webpage->page($minimyth, { 'title' => 'Filesystem', 'middle'  
=> [EMAIL PROTECTED] });
+
+print $_ . "\n" foreach (@{$page});
+
+1;

Added:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/mm_webpage.pm
==============================================================================
--- (empty file)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/mm_webpage.pm
        
Sun Aug 31 12:24:45 2008
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+
+package mm_webpage;
+
+use warnings;
+use strict;
+
+require MiniMyth;
+require Sys::Hostname;
+
+sub page
+{
+    my $self     = shift;
+    my $minimyth = shift;
+    my $args     = shift;
+
+    my $style    = undef;
+    my $title    = undef;
+    my $middle   = undef;
+
+    if (defined($args))
+    {
+        if (exists($args->{'style'}))
+        {
+            $style = $args->{'style'};
+        }
+        if (exists($args->{'title'}))
+        {
+            $title = $args->{'title'};
+        }
+        if (exists($args->{'middle'}))
+        {
+            $middle = $args->{'middle'};
+        }
+    }
+
+    my $page_host  = Sys::Hostname::hostname();
+    my $page_date  = qx(/bin/date +'%Y-%m-%d %H:%M:%S %Z');
+    my $mm_version = $minimyth->var_get('MM_VERSION');
+
+    my @page = ();
+
+    push(@page,  q(Content-Type: text/html; charset=UTF-8));
+    push(@page,  q());
+    push(@page,  q(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML  
1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>));
+    push(@page,  q(<html xmlns="http://www.w3.org/1999/xhtml";  
xml:lang="en">));
+    push(@page,  q(  <head>));
+    push(@page,  q(    <meta name="author" content="Paul Bender" />));
+    push(@page,  q(    <meta name="copyright" content="2006-2008 Paul  
Bender &amp; minimyth.org" />));
+    push(@page,  q(    <meta name="keywords"  
content="PVR,Linux,MythTV,MiniMyth" />));
+    push(@page,  q(    <meta name="description" content="" />));
+    push(@page,  q(    <meta http-equiv="Content-Type" content="text/html;  
charset=UTF-8" />));
+    push(@page, qq(    <title>MiniMyth Frontend $title</title>));
+    push(@page,  q(    <style type="text/css" title="main-styles">));
+    push(@page,  q(      @import "../css/minimyth.css";));
+    if (defined($style))
+    {
+        foreach (@{$style})
+        {
+             push(@page,  q(      @import ) . qq("$_";));
+        }
+    }
+    push(@page,  q(    </style>));
+    push(@page,  q(  </head>));
+    push(@page,  q(  <body>));
+    push(@page,  q(    <div class="main">));
+    push(@page,  q(      <div class="header">));
+    push(@page,  q(        <div class="heading">MiniMyth from <a  
href="http://minimyth.org/";>minimyth.org</a></div>));
+    push(@page,  q(        <div class="menu">));
+    push(@page,  q(          <span class="menuItemFirst"><a  
href="../index.html">Home</a></span>));
+    push(@page, qq(          <span class="menuItem"     >$title</span>));
+    push(@page,  q(        </div>));
+    push(@page,  q(        <div class="note">));
+    push(@page, qq(          $page_date<br />));
+    push(@page, qq(          $page_host<br />));
+    push(@page, qq(          $mm_version));
+    push(@page,  q(        </div>));
+    push(@page,  q(      </div>));
+    push(@page,  q(      <div class="middle">));
+    push(@page, qq(      <div class="heading">MiniMyth Frontend  
$title</div>));
+    foreach (@{$middle})
+    {
+        push(@page, '        ' . $_);
+    }
+    push(@page,  q(      </div>));
+    push(@page,  q(      <div class="footer">));
+    push(@page,  q(        <hr />));
+    push(@page,  q(        <div class="valid-xhtml">));
+    push(@page,  q(          <a  
href="http://validator.w3.org/check?uri=referer";><img));
+    push(@page,  q(              src="/image/w3c-valid-xhtml11-blue.gif"));
+    push(@page,  q(              alt="Valid XHTML 1.1" height="31"  
width="88" /></a>));
+    push(@page,  q(        </div>));
+    push(@page,  q(        <div class="valid-css">));
+    push(@page,  q(          <a  
href="http://jigsaw.w3.org/css-validator/check/referer";><img));
+    push(@page,  q(              src="/image/w3c-valid-css2-blue.gif"));
+    push(@page,  q(              alt="Valid CSS!"      height="31"  
width="88" /></a>));
+    push(@page,  q(        </div>));
+    push(@page,  q(        <div class="version">));
+    push(@page,  q(          Last Updated on 2008-08-31));
+    push(@page,  q(          <br />));
+    push(@page,  q(           
&lt;&nbsp;mailto&nbsp;:&nbsp;webmaster&nbsp;at&nbsp;minimyth&nbsp;dot&nbsp;org&nbsp;&gt;));
+    push(@page,  q(        </div>));
+    push(@page,  q(      </div>));
+    push(@page,  q(    </div>));
+    push(@page,  q(  </body>));
+    push(@page,  q(</html>));
+
+    return [EMAIL PROTECTED];
+}
+
+1;

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/software.cgi
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/software.cgi
         
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/software.cgi
         
Sun Aug 31 12:24:45 2008
@@ -1,175 +1,112 @@
-#!/bin/sh
+#!/usr/bin/perl

-. /etc/conf
+use warnings;
+use strict;

-page_host=`/bin/hostname`
-page_date=`/bin/date +'%Y-%m-%d %H:%M:%S %Z'`
+require MiniMyth;

-server=${HTTP_HOST:-${SERVER_ADDR}}
+require "/srv/www/cgi-bin/mm_webpage.pm";

-/bin/echo "Content-Type: text/html; charset=UTF-8"
-/bin/echo
-/bin/echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"  
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\";>"
-/bin/echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\">"
-/bin/echo "  <head>"
-/bin/echo "    <meta name=\"author\" content=\"Paul Bender\" />"
-/bin/echo "    <meta name=\"copyright\" content=\"2006-2008 Paul Bender  
&amp; minimyth.org\" />"
-/bin/echo "    <meta name=\"keywords\"  
content=\"PVR,Linux,MythTV,MiniMyth\" />"
-/bin/echo "    <meta name=\"description\" content=\"\" />"
-/bin/echo "    <meta http-equiv=\"Content-Type\" content=\"text/html;  
charset=UTF-8\" />"
-/bin/echo "    <title>MiniMyth Frontend Software</title>"
-/bin/echo "    <style type=\"text/css\" title=\"main-styles\">"
-/bin/echo "      @import \"../css/minimyth.css\";"
-/bin/echo "    </style>"
-/bin/echo "  </head>"
-/bin/echo "  <body>"
-/bin/echo "    <div class=\"main\">"
-/bin/echo "      <div class=\"header\">"
-/bin/echo "        <div class=\"heading\">MiniMyth from <a  
href=\"http://minimyth.org/\";>minimyth.org</a></div>"
-/bin/echo "        <div class=\"menu\">"
-/bin/echo "          <span class=\"menuItemFirst\"><a  
href=\"../index.html\">Home</a></span>"
-/bin/echo "          <span class=\"menuItem\"     >Software</span>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"note\">"
-/bin/echo "          ${page_date}<br />"
-/bin/echo "          ${page_host}<br />"
-/bin/echo "          ${MM_VERSION}"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "      <div class=\"middle\">"
-/bin/echo "        <div class=\"heading\">MiniMyth Frontend Software</div>"
-/bin/echo "        <div class=\"section\">"
-/bin/echo "          <div class=\"heading\">Versions and Licenses</div>"
-/bin/echo "          <p>"
-/bin/echo "            This is a list of all the software built as part of  
the MiniMyth build process."
-/bin/echo "            Depending on the MiniMyth build system  
configuration options,"
-/bin/echo "            some of the software may not have been included in  
the MiniMyth binary image."
-/bin/echo "          </p>"
-/bin/echo "          <ul>"
-/bin/echo "            <li>"
-/bin/echo "              minimyth:"
-/bin/echo "              <ul>"
-/bin/echo "                <li>"
-/bin/echo "                  <strong>minimyth</strong>"
-/bin/echo "                  ${MM_VERSION}"
-/bin/echo "                  ;"
-/bin/echo "                  <a href=\"../license.txt\"  
type=\"text/plain\">license</a>"
-/bin/echo "                  <ul>"
-if /usr/bin/test -f /srv/www/software/gar-minimyth-${MM_VERSION}.tar.bz2 ;  
then
-    /bin/echo "                    <li><a  
href=\"../software/gar-minimyth-${MM_VERSION}.tar.bz2\"  
type=\"application/x-bzip2\">build system source  
(gar-minimyth-${MM_VERSION}.tar.bz2)</a></li>"
-fi
-if /usr/bin/test -f /srv/www/software/base/versions/minimyth.conf.mk ; then
-    /bin/echo "                    <li><a  
href=\"../software/base/versions/minimyth.conf.mk\"  
type=\"text/plain\">build system configuration (minimyth.conf.mk)</a></li>"
-fi
-/bin/echo "                  </ul>"
-/bin/echo "                </li>"
-/bin/echo "              </ul>"
-/bin/echo "            </li>"
-/bin/echo "            <li>"
-/bin/echo "            base ('/' and '/usr'):"
-if /usr/bin/test -d /srv/www/software/base/versions ; then
-    /bin/echo "            <ul>"
-    for software in `cd /srv/www/software/base/versions ; /bin/ls -1` ; do
-        if /usr/bin/test ! "${software}" = "minimyth"         &&
-           /usr/bin/test ! "${software}" = "minimyth.conf.mk" ; then
-            version=`/bin/cat /srv/www/software/base/versions/${software}`
-            if /usr/bin/test "${version}" = "none" ; then
-                version=
-            fi
-            license_list=
-            if /usr/bin/test -d  
/srv/www/software/base/licenses/${software} ; then
-                license_list=`cd  
/srv/www/software/base/licenses/${software} ; /bin/ls -1`
-            fi
-            /bin/echo "                <li>"
-            /bin/echo "                  <strong>${software}</strong>"
-            /bin/echo "                  ${version}"
-            /bin/echo "                  ;"
-            for license in ${license_list} ; do
-                /bin/echo "                  <a  
href=\"../software/base/licenses/${software}/${license}\"  
type=\"text/plain\">license</a>"
-            done
-            /bin/echo "                </li>"
-        fi
-    done
-    /bin/echo "              </ul>"
-fi
-/bin/echo "            </li>"
-/bin/echo "            <li>"
-/bin/echo "            extras ('/usr/local'):"
-if /usr/bin/test -d /srv/www/software/extras/versions ; then
-    /bin/echo "              <ul>"
-    for software in `cd /srv/www/software/extras/versions ; /bin/ls -1` ;  
do
-        if /usr/bin/test ! "${software}" = "minimyth"         &&
-           /usr/bin/test ! "${software}" = "minimyth.conf.mk" ; then
-            version=`/bin/cat  
/srv/www/software/extras/versions/${software}`
-            if /usr/bin/test "${version}" = "none" ; then
-                version=
-            fi
-            license_list=
-            if /usr/bin/test -d  
/srv/www/software/extras/licenses/${software} ; then
-                license_list=`cd  
/srv/www/software/extras/licenses/${software} ; /bin/ls -1`
-            fi
-            /bin/echo "                <li>"
-            /bin/echo "                  <strong>${software}</strong>"
-            /bin/echo "                  ${version}"
-            /bin/echo "                  ;"
-            for license in ${license_list} ; do
-                /bin/echo "                  <a  
href=\"../software/extras/licenses/${software}/${license}\"  
type=\"text/plain\">license</a>"
-            done
-            /bin/echo "                </li>"
-        fi
-    done
-    /bin/echo "              </ul>"
-fi
-/bin/echo "            </li>"
-/bin/echo "            <li>"
-/bin/echo "            build (natively compiled software used for cross  
compiling and assembling MiniMyth):"
-if /usr/bin/test -d /srv/www/software/build/versions ; then
-    /bin/echo "            <ul>"
-    for software in `cd /srv/www/software/build/versions ; /bin/ls -1` ; do
-        if /usr/bin/test ! "${software}" = "minimyth"         &&
-           /usr/bin/test ! "${software}" = "minimyth.conf.mk" ; then
-            version=`/bin/cat /srv/www/software/build/versions/${software}`
-            if /usr/bin/test "${version}" = "none" ; then
-                version=
-            fi
-            license_list=
-            if /usr/bin/test -d  
/srv/www/software/build/licenses/${software} ; then
-                license_list=`cd  
/srv/www/software/build/licenses/${software} ; /bin/ls -1`
-            fi
-            /bin/echo "                <li>"
-            /bin/echo "                  <strong>${software}</strong>"
-            /bin/echo "                  ${version}"
-            /bin/echo "                  ;"
-            for license in ${license_list} ; do
-                /bin/echo "                  <a  
href=\"../software/build/licenses/${software}/${license}\"  
type=\"text/plain\">license</a>"
-            done
-            /bin/echo "                </li>"
-        fi
-    done
-    /bin/echo "              </ul>"
-fi
-/bin/echo "            </li>"
-/bin/echo "          </ul>"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "      <div class=\"footer\">"
-/bin/echo "        <hr />"
-/bin/echo "        <div class=\"valid-xhtml\">"
-/bin/echo "          <a  
href=\"http://validator.w3.org/check?uri=referer\";><img"
-/bin/echo "              src=\"/image/w3c-valid-xhtml11-blue.gif\""
-/bin/echo "              alt=\"Valid XHTML 1.1\" height=\"31\"  
width=\"88\" /></a>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"valid-css\">"
-/bin/echo "          <a  
href=\"http://jigsaw.w3.org/css-validator/check/referer\";><img"
-/bin/echo "              src=\"/image/w3c-valid-css2-blue.gif\""
-/bin/echo "              alt=\"Valid CSS!\"      height=\"31\"  
width=\"88\" /></a>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"version\">"
-/bin/echo "          Last Updated on 2008-08-08"
-/bin/echo "          <br />"
-/bin/echo "           
&lt;&nbsp;mailto&nbsp;:&nbsp;webmaster&nbsp;at&nbsp;minimyth&nbsp;dot&nbsp;org&nbsp;&gt;"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "    </div>"
-/bin/echo "  </body>"
-/bin/echo "</html>"
+my $minimyth   = new MiniMyth;
+my $mm_version = $minimyth->var_get('MM_VERSION');
+
+my @middle = ();
+
+push(@middle,  q(<div class="section">));
+push(@middle,  q(  <div class="heading">Versions and Licenses</div>));
+push(@middle,  q(  <p>));
+push(@middle,  q(    This is a list of all the software built as part of  
the MiniMyth build process.));
+push(@middle,  q(    Depending on the MiniMyth build system configuration  
options,));
+push(@middle,  q(    some of the software may not have been included in  
the MiniMyth binary image.));
+push(@middle,  q(  </p>));
+push(@middle,  q(  <ul>));
+push(@middle,  q(    <li>));
+push(@middle,  q(      minimyth:));
+push(@middle,  q(      <ul>));
+push(@middle,  q(        <li>));
+push(@middle,  q(          <strong>minimyth</strong>));
+push(@middle, qq(          $mm_version));
+push(@middle,  q(          ;));
+push(@middle,  q(          <a href="../license.txt"  
type="text/plain">license</a>));
+push(@middle,  q(          <ul>));
+if (-f "/srv/www/software/gar-minimyth-$mm_version.tar.bz2")
+{
+    push(@middle, qq(            <li><a  
href="../software/gar-minimyth-$mm_version.tar.bz2"  
type="application/x-bzip2">build system source  
(gar-minimyth-$mm_version.tar.bz2)</a></li>));
+}
+if (-f "/srv/www/software/base/versions/minimyth.conf.mk")
+{
+    push(@middle,  q(            <li><a  
href="../software/base/versions/minimyth.conf.mk" type="text/plain">build  
system configuration (minimyth.conf.mk)</a></li>));
+}
+push(@middle,  q(          </ul>));
+push(@middle,  q(        </li>));
+push(@middle,  q(      </ul>));
+push(@middle,  q(    </li>));
+
+my @type_name   = ( 'base',
+                    'extras',
+                    'build' );
+my %type_header = ( 'base'   => q(base ('/' and '/usr'):),
+                    'extras' => q(extras ('/usr/local'):),
+                    'build'  => q(build (natively compiled software used  
for cross compiling and assembling MiniMyth):));
+
+foreach my $type (@type_name)
+{
+    push(@middle,  q(    <li>));
+    push(@middle, qq(    $type_header{$type}));
+    if (-d "/srv/www/software/$type/versions")
+    {
+        push(@middle,  q(    <ul>));
+        if (opendir(SOFTWAREDIR, "/srv/www/software/$type/versions"))
+        {
+            foreach my $software (grep((! /^\./) && (! /^minimyth$/) && (!  
/^minimyth.conf.mk$/), (readdir(SOFTWAREDIR))))
+            {
+                my $version = '';
+                if  
(open(FILE, '<', "/srv/www/software/$type/versions/$software"))
+                {
+                    while(<FILE>)
+                    {
+                        chomp;
+                        $version = $_;
+                        last;
+                    }
+                    close(FILE);
+                }
+                if ($version eq 'none')
+                {
+                    $version = '';
+                }
+                my @license_list = ();
+                if ((-d "/srv/www/software/$type/licenses/$software") && \
+                     
(opendir(LICENSEDIR, "/srv/www/software/$type/licenses/$software")))
+                {
+                    foreach (grep(! /^\./, (readdir(LICENSEDIR))))
+                    {
+                        chomp;
+                        push(@license_list, $_);
+                    }
+                    closedir(LICENSEDIR);
+                }
+                push(@middle,  q(        <li>));
+                push(@middle, qq(          <strong>$software</strong>));
+                push(@middle, qq(          $version));
+                push(@middle,  q(          ;));
+                foreach my $license (@license_list)
+                {
+                    push(@middle, qq(          <a  
href="../software/$type/licenses/$software/$license"  
type="text/plain">license</a>));
+                }
+                push(@middle,  q(        </li>));
+            }
+            closedir(SOFTWAREDIR);
+        }
+        push(@middle,  q(      </ul>));
+    }
+    push(@middle,  q(    </li>));
+}
+push(@middle,  q(  </ul>));
+push(@middle,  q(</div>));
+
+my $page = mm_webpage->page($minimyth, { 'title' => 'Software', 'middle'  
=> [EMAIL PROTECTED] });
+
+print $_ . "\n" foreach (@{$page});
+
+1;

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/status.cgi
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/status.cgi
   
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/srv/www/cgi-bin/status.cgi
   
Sun Aug 31 12:24:45 2008
@@ -1,94 +1,76 @@
-#!/bin/sh
+#!/usr/bin/perl

-. /etc/conf
+use warnings;
+use strict;

-page_host=`/bin/hostname`
-page_date=`/bin/date +'%Y-%m-%d %H:%M:%S %Z'`
+require File::Spec;
+require MiniMyth;

-server=${HTTP_HOST:-${SERVER_ADDR}}
+require "/srv/www/cgi-bin/mm_webpage.pm";
+
+my $minimyth   = new MiniMyth;
+my $mm_version = $minimyth->var_get('MM_VERSION');
+my $devnull    = File::Spec->devnull;
+
+my $status_sensors_head = q(Sensors (output of command "sensors"));
+my @status_sensors_body = ();
+if (system(qq(/usr/bin/sensors > $devnull 2>&1)) == 0)
+{
+    if (open(FILE, '-|', '/usr/bin/sensors'))
+    {
+        while (<FILE>)
+        {
+            chomp;
+            s/(\-[1-9][0-9]\.[0-9] C)/<span class="temp_cool">$1<\/span>/;
+            s/(\-[1-9]\.[0-9] C)/<span class="temp_cool">$1<\/span>/;
+            s/(\+[1-9]\.[0-9] C)/<span class="temp_cool">$1<\/span>/;
+            s/(\+[1-4][0-9]\.[0-9] C)/<span class="temp_cool">$1<\/span>/;
+            s/(\+[5-6][0-9]\.[0-9] C)/<span class="temp_warm">$1<\/span>/;
+            s/(\+[7-9][0-9]\.[0-9] C)/<span class="temp_hot">$1<\/span>/;
+            push(@status_sensors_body, $_);
+        }
+        close(FILE);
+    }
+}
+
+my $status_loads_head = q(Loads (output of file "/proc/loadavg"));
+my @status_loads_body = ();
+if (-e 'proc/loadavg')
+{
+    if (open(FILE, '<', '/proc/loadavg'))
+    {
+        while (<FILE>)
+        {
+            chomp;
+            push(@status_loads_body, $_);
+        }
+        close(FILE);
+    }
+}
+
+my @middle = ();
+
+push(@middle,  q(<div class="section">));
+push(@middle, qq(  <div class="heading">$status_sensors_head</div>));
+push(@middle,  q(  <div class="status">));
+foreach (@status_sensors_body)
+{
+    push(@middle, qq($_));
+}
+push(@middle,  q(  </div>));
+push(@middle,  q(</div>));
+push(@middle,  q(<div class="section">));
+push(@middle, qq(  <div class="heading">$status_loads_head</div>));
+push(@middle,  q(  <div class="status">));
+foreach (@status_loads_body)
+{
+    push(@middle, qq($_));
+}
+push(@middle,  q(  </div>));
+push(@middle,  q(</div>));

-status_sensors_head="Sensors (output of command \"sensors\")"
-/usr/bin/sensors > /dev/null 2>&1
-if /usr/bin/test $? -eq 0 ; then
-    status_sensors_body=` \
-        /usr/bin/sensors | \
-        /bin/sed \
-            -e 's/\(\-[1-9][0-9]\.[0-9] C\)/<span  
class="temp_cool">\1<\/span>/' \
-            -e 's/\(\-[1-9]\.[0-9] C\)/<span  
class="temp_cool">\1<\/span>/' \
-            -e 's/\(\+[1-9]\.[0-9] C\)/<span  
class="temp_cool">\1<\/span>/' \
-            -e 's/\(\+[1-4][0-9]\.[0-9] C\)/<span  
class="temp_cool">\1<\/span>/' \
-            -e 's/\(\+[5-6][0-9]\.[0-9] C\)/<span  
class="temp_warm">\1<\/span>/' \
-            -e 's/\(\+[7-9][0-9]\.[0-9] C\)/<span  
class="temp_hot">\1<\/span>/'`
-else
-    status_sensors_body=
-fi
-
-status_loads_head="Loads (output of command \"cat /proc/loadavg\")"
-status_loads_body=`/bin/cat /proc/loadavg`
-
-/bin/echo "Content-Type: text/html; charset=UTF-8"
-/bin/echo
-/bin/echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"  
\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\";>"
-/bin/echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\">"
-/bin/echo "  <head>"
-/bin/echo "    <meta name=\"author\" content=\"Paul Bender\" />"
-/bin/echo "    <meta name=\"copyright\" content=\"2006-2008 Paul Bender  
&amp; minimyth.org\" />"
-/bin/echo "    <meta name=\"keywords\"  
content=\"PVR,Linux,MythTV,MiniMyth\" />"
-/bin/echo "    <meta name=\"description\" content=\"\" />"
-/bin/echo "    <meta http-equiv=\"Content-Type\" content=\"text/html;  
charset=UTF-8\" />"
-/bin/echo "    <title>MiniMyth Frontend Status</title>"
-/bin/echo "    <style type=\"text/css\" title=\"main-styles\">"
-/bin/echo "      @import \"../css/minimyth.css\";"
-/bin/echo "      @import \"../css/status.css\";"
-/bin/echo "    </style>"
-/bin/echo "  </head>"
-/bin/echo "  <body>"
-/bin/echo "    <div class=\"main\">"
-/bin/echo "      <div class=\"header\">"
-/bin/echo "        <div class=\"heading\">MiniMyth from <a  
href=\"http://minimyth.org/\";>minimyth.org</a></div>"
-/bin/echo "        <div class=\"menu\">"
-/bin/echo "          <span class=\"menuItemFirst\"><a  
href=\"../index.html\">Home</a></span>"
-/bin/echo "          <span class=\"menuItem\"     >Status</span>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"note\">"
-/bin/echo "          ${page_date}<br />"
-/bin/echo "          ${page_host}<br />"
-/bin/echo "          ${MM_VERSION}"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "      <div class=\"middle\">"
-/bin/echo "        <div class=\"heading\">MiniMyth Frontend Status</div>"
-/bin/echo "        <div class=\"section\">"
-/bin/echo "          <div class=\"heading\">${status_sensors_head}</div>"
-/bin/echo "          <div class=\"status\">"
-/bin/echo "${status_sensors_body}"
-/bin/echo "          </div>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"section\">"
-/bin/echo "          <div class=\"heading\">${status_loads_head}</div>"
-/bin/echo "          <div class=\"status\">"
-/bin/echo "${status_loads_body}"
-/bin/echo "          </div>"
-/bin/echo "        </div>"
-/bin/echo "      </div> "
-/bin/echo "      <div class=\"footer\">"
-/bin/echo "        <hr />"
-/bin/echo "        <div class=\"valid-xhtml\">"
-/bin/echo "          <a  
href=\"http://validator.w3.org/check?uri=referer\";><img"
-/bin/echo "              src=\"/image/w3c-valid-xhtml11-blue.gif\""
-/bin/echo "              alt=\"Valid XHTML 1.1\" height=\"31\"  
width=\"88\" /></a>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"valid-css\">"
-/bin/echo "          <a  
href=\"http://jigsaw.w3.org/css-validator/check/referer\";><img"
-/bin/echo "              src=\"/image/w3c-valid-css2-blue.gif\""
-/bin/echo "              alt=\"Valid CSS!\"      height=\"31\"  
width=\"88\" /></a>"
-/bin/echo "        </div>"
-/bin/echo "        <div class=\"version\">"
-/bin/echo "          Last Updated on 2008-05-17"
-/bin/echo "          <br />"
-/bin/echo "           
&lt;&nbsp;mailto&nbsp;:&nbsp;webmaster&nbsp;at&nbsp;minimyth&nbsp;dot&nbsp;org&nbsp;&gt;"
-/bin/echo "        </div>"
-/bin/echo "      </div>"
-/bin/echo "    </div>"
-/bin/echo "  </body>"
-/bin/echo "</html>"
+my $page = mm_webpage->page($minimyth, { 'title' => 'Status', 'middle' =>  
[EMAIL PROTECTED] , 'style' => [ '../css/status.css' ] });
+
+print $_ . "\n" foreach (@{$page});
+
+1;

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"minimyth-commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/minimyth-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to