Comparing MD5 hashes used to be important for this script, because in the project I developed it for, it was a globally included header (by something akin to AppHdr.h). Preventing it from changing was pretty important. But it doesn't matter now, since we only make it a dependency of version.cc, and the makefile regenerates it on every build (which is handy).
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
3C3PY6QL46UM4OB7LCUF5PE5FJY3AMOBM66WN42VUWESMPH3GI4AC use Digest::MD5;my $ctx = Digest::MD5->new;my $md5old = ""; my $md5new = "";if (-e $outfile) {open OUT, "$outfile" or die $!;$ctx->addfile(*OUT);$md5old = $ctx->hexdigest;close OUT}open OUT, "$outfile.tmp" or die $!;$ctx->addfile(*OUT);$md5new = $ctx->hexdigest;close OUT;use File::Copy;if ($md5old ne $md5new) {if (-e $outfile) {unlink($outfile) or die $!;}move "$outfile.tmp", $outfile or die $!;} else {unlink ("$outfile.tmp");}