File:  [LON-CAPA] / loncom / build / Attic / loncapaverifybasepackage
Revision 1.1: download - view: text, annotated - select for diffs
Wed Oct 25 23:50:47 2000 UTC (23 years, 7 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
script to look at file diffs in LON-CAPA-base RPM.

#!/usr/bin/perl

# loncapaverifybasepackage

# This tool helps with system verification.  It looks at the
# RPM packages on the system.  It downloads the base
# RPM (LON-CAPA-base) from install.lon-capa.org (into /tmp
# directory).  It compares file differences and generates a
# pretty HTML report.

# This is an adapted shell script I wrote a while ago.  I need
# to perlify many of the commands.

# Scott Harrison, 10/25/2000

use strict;

`/bin/rm -Rf /home/httpd/html/dev`;
`/bin/mkdir -m 0755 /home/httpd/html/dev`;
`/usr/bin/lynx -source http://install.lon-capa.org/3.1/loncapafiles/LON-CAPA-base-3.1-1.i386.rpm > /tmp/LON-CAPA-base-3.1-1.i386.rpm`;
`/bin/rpm -Vp /tmp/LON-CAPA-base-3.1-1.i386.rpm > /home/httpd/html/dev/index.txt`;
`/bin/echo "<H1>File Check: " > /home/httpd/html/dev/index.html`;
`/bin/cat /etc/HOSTNAME >> /home/httpd/html/dev/index.html`;
`/bin/echo "</H1><BR>DATE OF CHECK: " >> /home/httpd/html/dev/index.html`;
`/bin/date >> /home/httpd/html/dev/index.html`;
`/bin/echo "<BR>DATE OF MOST RECENT LON-CAPA RPM: " >> /home/httpd/html/dev/index.html`;
`/bin/rpm -qp --queryformat '%{BUILDTIME}' /tmp/LON-CAPA-base-3.1-1.i386.rpm | /usr/bin/perl -e '\$t=<>; chop; print scalar localtime(\$t);' >> /home/httpd/html/dev/index.html`;
`/bin/echo "<P>Inconsistencies with most recent LON-CAPA RPM (<B>bold</B> indicates the way it should be):<BR><HR>" >> /home/httpd/html/dev/index.html`;
my @verifications=`/bin/rpm -Vp /tmp/LON-CAPA-base-3.1-1.i386.rpm | grep -v '\\.\\.\\.\\.\\.\\.\\.' | cut -b13-`;
my @reports=();
foreach (@verifications) {
    chop;
    my $a=$_;
    my $d=`cd /tmp; rm -Rf /tmp/uncpio;mkdir uncpio;cd uncpio; rpm2cpio ../LON-CAPA-base-3.1-1.i386.rpm | cpio -iumd --quiet $a;diff $a /$a 2>&1;`;
    $d=~s/\</\&lt;/g;
    $d=~s/\>/\&gt;/g;
    push @reports,(split(/\n/,"<P><B>$a</B><BR><TABLE BGCOLOR=\"#80FF80\"><TR><TD><PRE>$d</PRE></TD></TR></TABLE>")); 
    `rm -Rf /tmp/uncpio`;
} 
open (OUT,">>/home/httpd/html/dev/index.html");
foreach (@reports) {
    my $a=$_;
    $a="<B>$a</B>" if /^\&lt;/;
    print OUT "$a\n";
}
close OUT;
`/bin/rm -f /tmp/LON-CAPA-base-3.1-1.i386.rpm`;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>