[rancid] ERX directory file size summary

john heasley heas at shrubbery.net
Wed Nov 12 08:38:51 UTC 2008


At some point someone complained about changes from file size changes in
the dir command.  I missed the reply from them or they didn't reply if
the following patch worked.  I don't have an ERC, could someone test it?

Index: bin/jerancid.in
===================================================================
RCS file: /home/rancid/.CVS/rancid/bin/jerancid.in,v
retrieving revision 1.46
diff -d -u -r1.46 jerancid.in
--- bin/jerancid.in	22 Apr 2008 23:43:05 -0000	1.46
+++ bin/jerancid.in	29 Apr 2008 15:07:16 -0000
@@ -293,6 +293,19 @@
 	# fail if the RP is amid the auto-sync process
 	return(-1) if (/active\/standby/i && /not sync/);
 
+	if (/(\S+:\s+)(\d+)(\s+)(\d+)(\s+)(\d+)/) {
+	    my($totlen) = length($2) - 1;
+	    my($tot) = $2 / (1024 * 1024);
+	    my($freelen) = length($4) - 1;
+	    my($free) = $4 / (1024 * 1024);
+	    my($usedlen) = length($6) - 1;
+	    my($used) = $6 / (1024 * 1024);
+	    my($fmt) = sprintf("%%-%dsK%s%%-%dsK%s%%-%dsK", $totlen, $3,
+			       $freelen, $5, $usedlen);
+
+	    ProcessHistory("FLASH","","","!Flash: $1" .
+			   sprintf($fmt, $tot, $free, $used));
+	}
 	ProcessHistory("FLASH","","","!Flash: $_");
     }
     ProcessHistory("","","","!\n");



More information about the Rancid-discuss mailing list