chiark / gitweb /
Merge Peter Maydell's changes.
[chiark-utils.git] / backup / checkallused
index fd613f3181b75d91c5fc603c70f510ad40ee2337..8fb446831687dca891a236d3519ab70d5e72e9c4 100755 (executable)
@@ -1,5 +1,9 @@
 #!/usr/bin/perl
 
+# Read all the configuration files and check that all filesystems
+# are either backed up in both full and incremental dumps or 
+# listed as exceptions.
+
 BEGIN {
     $etc= '/etc/backup';
     require "$etc/settings.pl";
@@ -83,20 +87,34 @@ for $pfx ('', sort keys %prefix) {
        }
     }
     print "\n";
-    $!=0; close(X); $? and die "$cmd $? $!";
+    $!=0; close(X); $? and die "$? $!";
 }
 
 foreach $fsg (keys %usedkb) {
     print "filesystem group $fsg: $usedkb{$fsg} 1K-blocks$unkkb{$fsg}\n";
 }
 
+# We check that all mounted filesystems are dumped and all
+# filesystems to be dumped are mounted. The expected-diffs
+# config file allows us to make exceptions.
+# eg: 
+# #expect disk2 to be mounted but not dumped
+# !/disk2
+# # CD may or may not be mounted but should not be dumped in either case
+# ?/cdrom
+
 open Z,"$etc/expected-diffs" or die $!;
 for (;;) {
     $_= <Z> or die; chomp; s/\s*$//;
     last if m/^end$/;
     next unless m/^\S/;
     next if m/^\#/;
-    if (s/^\!//) {
+    if (s/^\?//) {
+        print "non-permanent filesystem expected not to be dumped: $_\n";
+        if (defined($mounted{$_})) {
+            delete $mounted{$_};
+        }
+    } elsif (s/^\!//) {
        &e("expected not to be dumped, but not a mount point: $_")
            unless defined($mounted{$_});
         print "filesystem expected not to be dumped: $_\n";