summaryrefslogtreecommitdiff
path: root/src/fill2fs_check
blob: 5373f32154b5635d7de3748a1dd641588404b8d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl -w
#
#  Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
#
# fill2fs_check:
#   Read a manifest generated by fill2fs from the command
#   line or stdin, checksum every file listed
#
#   $Id: fill2fs_check,v 1.1 2001/04/26 23:46:25 ajag Exp ajag $
#

use File::Basename;

$status = 0;

file: while (<>) {
  chomp;
  if ( ! -e $_) {
    print "$0: $_ not found\n";
    $status = 1; next file;
  }
  (undef, $expected) = split(/\./, basename $_);
  chomp($sum = `sum -r $_`);
  ($actual) = split(/\s+/, $sum);
  if ($actual != $expected) {
    print "$0: checksum is wrong for \"$_\"\n";
    $status = 1; next file;
  }
}

exit($status);