diff -up e-smith-backup-2.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup.workstation_verify e-smith-backup-2.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup --- e-smith-backup-2.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup.workstation_verify 2009-07-22 17:06:13.000000000 +0200 +++ e-smith-backup-2.2.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2009-07-22 17:09:42.000000000 +0200 @@ -57,10 +57,10 @@

The workstation backup method uses a software package called dar to back up your server configuration and data files to a workstation on your LAN (or a local USB disk). This requires you provide a writable share - (cifs or nfs) on the backup workstation or an a local USB disk. You can manage + (cifs or nfs) on the backup workstation or have a local USB disk. You can manage how many rotating sets of backup are kept on the backup share, and also make each set doing incremental backup upon several days. The backup is performed - automatically at the selected time every night. Currently + automatically at the selected time every day. Currently configuration and data files total approximately $tarsize uncompressed. Twice the compressed data size must be available on the backup share.

@@ -278,7 +278,7 @@ FILES_IN_BACKUP - The following files are contained in the backup file: + The following files are considered in the backup : VERIFY_COMPLETE @@ -529,7 +529,7 @@ VERIFY_WORKSTN_BACKUP_FILE - Verify workstation backup file + Verify workstation backup VERIFY_WORKSTN_BACKUP_DESC @@ -539,8 +539,8 @@ in a previously created workstation daily backup. You can use this option to verify the contents of the backup.You must choose the backup you want to verify

-

You will see all files in the selected backup.

- Backup files are verified from shared folder : +

Only files flagged with [Saved] are contained in the backup.

+
Backup files are verified from shared folder : ]]>
@@ -871,4 +871,33 @@ HOURS hours. + + ERR_NO_FULL_BACKUP + Aborting restore because needed full backup is missing or unreadable. + + + ERR_NO_INC_BACKUP + Aborting restore because the set has missing or unreadable incremental backup number + + + CHECK_TO_VERIFY_FULL_RESTORE + Check here to test integrity of all backups needed for a full restore with the selected backup + + + TESTING_NEEDED_BACKUPS_FOR_RESTORE + Testing all backups needed for a full restore with selected backup + + + TESTED_BACKUP + Testing integrity of backup + + + RESTORE_VERIFY_FAILED + Verify integrity failed + + + CHECK_INTEGRITY_WARNING + Warning : For large backups, checking integrity may be a long task and should be made with daily workstation backup disabled. + + \ Pas de fin de ligne à la fin du fichier. diff -up e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup.workstation_verify e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup --- e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup.workstation_verify 2009-07-22 17:06:13.000000000 +0200 +++ e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup 2009-07-22 17:08:58.000000000 +0200 @@ -1830,6 +1830,25 @@ sub workstnVerify () ) ); + print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, + + esmith::cgi::genWidgetRow( + $q, + $fm->localise('CHECK_TO_VERIFY_FULL_RESTORE'), + $q->checkbox ( + -name => 'verifyall', + -checked=>0, + -label=>'' + ) + ), + $q->Tr( + esmith::cgi::genTextRow( + $q, + $fm->localise('CHECK_INTEGRITY_WARNING') + ) + ) + ),"\n"; + print $q->table ({width => "100%", -class => "sme-noborders"}, esmith::cgi::genButtonRow( $q, @@ -1839,7 +1858,7 @@ sub workstnVerify () ) ) ),"\n"; - + print $q->hidden( -name => 'state', -override => 1, @@ -1867,6 +1886,7 @@ sub performWorkstnVerify $conf->get('SystemName')->value . "." . $conf->get('DomainName')->value; my $err; my $VFSType = $backupwkrec->prop('VFSType') || 'cifs'; + my $verifyref = $q->param ('backupset'); # Mounting backup shared folder @@ -1893,62 +1913,201 @@ sub performWorkstnVerify return; } - my $backupkey = $q->param ('backupset'); - if ($backupkey =~ /^(.*)$/) - { - $backupkey = $1; - } - else + my $fullverify = $q->param('verifyall'); + + if ( $fullverify eq "on" ) { - if ($mounted) + # Test all backups needed to full restore + + my %backupsetfiles = (); + my @restorefiles; + my $set = $verifyref; + $set =~ s/\/[^\/]*$//; + my $backupsetlist = sub { + if ( $_ =~ /\.dar/ ) + { + my $backupref = $File::Find::name; + $backupref =~ s/\.[0-9]+\.dar//; + $_ =~ s/\..*\.dar//; + $_ =~ s/.*-//; + $backupsetfiles{$_} = $backupref; + } + }; + + # find list of available backups and verify + # it contains all backups needed for full restore + + find { wanted => \&$backupsetlist, untaint => 1 }, $set ; + + my $key; + my $num = 0; + foreach $key (sort keys %backupsetfiles) { - system("/bin/umount", "$mntdir") == 0 - or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); + push @restorefiles, $backupsetfiles{$key}; + if ( $num == 0 ) + { + unless ( $backupsetfiles{$key} =~ /\/full-/ ) + { + esmith::cgi::genHeaderNonCacheable( + $q, + undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE') + ); + esmith::cgi::genResult( + $q, $fm->localise('ERR_NO_FULL_BACKUP') + ); + return; + } + } + else + { + my $numf = sprintf("%03d", $num); + unless ( $backupsetfiles{$key} =~ /\/inc-$numf-/ ) + { + esmith::cgi::genHeaderNonCacheable( + $q, + undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE') + ); + + esmith::cgi::genResult( + $q, $fm->localise('ERR_NO_INC_BACKUP') . " " . $numf + ); + return; + } + + } + $num++; + last if ( $backupsetfiles{$key} eq $verifyref ); } - die('Unsecure data : ' . $backupkey); - } + + # and test them + + $| = 1; - if (open(RD, "-|")) - { - esmith::cgi::genHeaderNonCacheable ($q, - undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE')); + if (open(RD, "-|")) + { + esmith::cgi::genHeaderNonCacheable ($q, undef, + $fm->localise('VERIFY_WORKSTN_BACKUP_FILE')); - print $q->p($fm->localise('FILES_IN_BACKUP')); + print $q->p ( + $q->b ($fm->localise('TESTING_NEEDED_BACKUPS_FOR_RESTORE') ) + ); + print ''; - my $status = close RD ? + } + else + { + # verify selected backup only + # and display files saved in the backup + + my $backupkey = $verifyref; + if ($backupkey =~ /^(.*)$/) + { + $backupkey = $1; + } + else + { + if ($mounted) + { + system("/bin/umount", "$mntdir") == 0 + or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); + } + die('Unsecure data : ' . $backupkey); + } + + if (open(RD, "-|")) + { + esmith::cgi::genHeaderNonCacheable ($q, + undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE')); + print $q->p($fm->localise('FILES_IN_BACKUP')); + + print ''; + my $status = close RD ? ($complete ? $fm->localise('VERIFY_COMPLETE') : $fm->localise('BACKUP_FILE_INCOMPLETE')) : ($fm->localise('ERROR_READING_FILE').' : '.$backupkey); - print $q->p ($q->b ($status)); + print $q->p ($q->b ($status)); - esmith::cgi::genFooter ($q); + esmith::cgi::genFooter ($q); - } - else - { - select(STDOUT); - $| = 1; + } + else + { + select(STDOUT); + $| = 1; - system ("/usr/bin/dar", "-Q", "--list", "$backupkey", "--noconf") == 0 - or die ($fm->localise('ERR_EXTRACT')." : ".$!); + system ("/usr/bin/dar", "-Q", "--list", "$backupkey", "--noconf") == 0 + or die ($fm->localise('ERR_EXTRACT')." : ".$!); - if ($mounted) { - system("/bin/umount", "$mntdir") == 0 - or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); - } - exit(0); + if ($mounted) { + system("/bin/umount", "$mntdir") == 0 + or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); + } + exit(0); + } } return; @@ -1992,7 +2151,7 @@ sub workstnRestore () $_ =~ s/.*-//; @{$backupfiles{$_}}[0] = $dir; @{$backupfiles{$_}}[1] = $backupref; - } + } }; # Mounting backup shared folder @@ -2173,20 +2332,58 @@ sub performWorkstnRestore system("/bin/umount", "$mntdir") == 0 or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); } + esmith::cgi::genHeaderNonCacheable( + $q, + undef, $fm->localise('RESTORE_CANNOT_PROCEED') + ); esmith::cgi::genResult( - $q, $fm->localise('ERR_NO_HOST_DIR'), $id + $q, $fm->localise('ERR_NO_HOST_DIR') . $id ); return; } # finding list of available backups - + # and verifying all needed backup files are available + find { wanted => \&$backupsetlist, untaint => 1 }, $set ; my $key; + my $num = 0; foreach $key (sort keys %backupsetfiles) { push @restorefiles, $backupsetfiles{$key}; + if ( $num == 0 ) + { + unless ( $backupsetfiles{$key} =~ /\/full-/ ) + { + esmith::cgi::genHeaderNonCacheable( + $q, + undef, $fm->localise('RESTORE_CANNOT_PROCEED') + ); + esmith::cgi::genResult( + $q, $fm->localise('ERR_NO_FULL_BACKUP') + ); + return; + } + } + else + { + my $numf = sprintf("%03d", $num); + unless ( $backupsetfiles{$key} =~ /\/inc-$numf-/ ) + { + esmith::cgi::genHeaderNonCacheable( + $q, + undef, $fm->localise('RESTORE_CANNOT_PROCEED') + ); + + esmith::cgi::genResult( + $q, $fm->localise('ERR_NO_INC_BACKUP') . $numf + ); + return; + } + + } + $num++; last if ( $backupsetfiles{$key} eq $restoreref ); } @@ -2311,7 +2508,7 @@ sub performWorkstnRestore else { if ($mounted) - { + { system("/bin/umount", "$mntdir") == 0 or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); }