# and architectures at the same time. Gets only the highest version from
# all, and reports anything less than this. Good enough for now.
#
-# TODO: Get the dates from ls --full-time /var/cache/apt/archives/
-# and display next to the packages, so we can see how long they have
-# been lingering. Boldface them if older than some limit
#### Init
use strict;
my $datefilename = "aptcheck.data";
my $dateoldfilename = "aptcheck.old";
my $thisdate = "*"; # indicates really old stuff
+my $warndate; # Older than this will be boldfaced
+
if ( -f $datefilename ) {
print "Reading dates from $datefilename\n" if $debug;
open F, $datefilename or die "Could not open date file $datefilename: $!";
close F;
$thisdate = `date +%F`;
chomp($thisdate);
+ $warndate = `date +%F -d "30 days ago"` ; ;
+ chomp($warndate);
+ print "Dates: now: '$thisdate' warn: '$warndate'\n" if $debug;
} else {
print "No datefile $datefilename found, starting from scratch\n";
}
} else {
$newdates{$datekey} = $thisdate;
}
- $det .= "<td>" . $newdates{$datekey} . "</td>";
+ my $dispdate = $newdates{$datekey};
+ # if ( $dispdate lt $warndate ) {
+ if ( 0 ) { # manual packages don't need to be highlighted
+ $dispdate = "<b>$dispdate !</b>";
+ }
+ $det .= "<td>" . $dispdate . "</td>";
$det .= "</tr>\n";
my $key = "$restrname";
if ( !$summary{$key} ) {
} else {
$newdates{$datekey} = $thisdate;
}
- $det .= "<td>" . $newdates{$datekey} . "</td>";
+ my $dispdate = $newdates{$datekey};
+ if ( ( $dispdate lt $warndate ) && ( $src =~ /Security/) ) {
+ $dispdate = "<b>$dispdate !</b>";
+ }
+ $det .= "<td>" . $dispdate . "</td>";
$det .= "</tr>\n";
}
$table .= "</table>\n";
# Save the date file
-`mv -f $datefilename $dateoldfilename`;
-open F, ">$datefilename" or die "Could not open date file $datefilename for writing";
-for my $k (sort(keys(%newdates)) ) {
- print F "$k " . $newdates{$k}. "\n";
- print "date for '$k' '" . $newdates{$k}. "'\n" if $debug;
+if ( ! $debug ) {
+ `mv -f $datefilename $dateoldfilename`;
+ open F, ">$datefilename" or die "Could not open date file $datefilename for writing";
+ for my $k (sort(keys(%newdates)) ) {
+ print F "$k " . $newdates{$k}. "\n";
+ print "date for '$k' '" . $newdates{$k}. "'\n" if $debug;
+ }
+ close F
+ or die "Could not close date file $datefilename: $!";
+} else {
+ print "Not updating the date file, this is a debug run\n";
}
-close F
- or die "Could not close date file $datefilename: $!";
# Page header
my $outfile = "/tmp/aptcheck.html";