1 |
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 |
2 |
--- 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 |
3 |
+++ 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 |
4 |
@@ -57,10 +57,10 @@ |
5 |
<P>The workstation backup method uses a software package called <I>dar</I> |
6 |
to back up your server configuration and data files to a workstation |
7 |
on your LAN (or a local USB disk). This requires you provide a writable share |
8 |
- (cifs or nfs) on the backup workstation or an a local USB disk. You can manage |
9 |
+ (cifs or nfs) on the backup workstation or have a local USB disk. You can manage |
10 |
how many rotating sets of backup are kept on the backup share, and also make each |
11 |
set doing incremental backup upon several days. The backup is performed |
12 |
- automatically at the selected time every night. Currently |
13 |
+ automatically at the selected time every day. Currently |
14 |
configuration and data files total approximately <b>$tarsize</b> uncompressed. |
15 |
Twice the compressed data size must be available on the backup share.</P> |
16 |
|
17 |
@@ -278,7 +278,7 @@ |
18 |
</entry> |
19 |
<entry> |
20 |
<base>FILES_IN_BACKUP</base> |
21 |
- <trans>The following files are contained in the backup file:</trans> |
22 |
+ <trans>The following files are considered in the backup :</trans> |
23 |
</entry> |
24 |
<entry> |
25 |
<base>VERIFY_COMPLETE</base> |
26 |
@@ -529,7 +529,7 @@ |
27 |
</entry> |
28 |
<entry> |
29 |
<base>VERIFY_WORKSTN_BACKUP_FILE</base> |
30 |
- <trans>Verify workstation backup file</trans> |
31 |
+ <trans>Verify workstation backup</trans> |
32 |
</entry> |
33 |
<entry> |
34 |
<base>VERIFY_WORKSTN_BACKUP_DESC</base> |
35 |
@@ -539,8 +539,8 @@ |
36 |
in a previously created workstation daily backup. You |
37 |
can use this option to verify the contents of the |
38 |
backup.<b>You must choose the backup you want to verify</b></p> |
39 |
- <p>You will see all files in the selected backup.</p> |
40 |
- Backup files are verified from shared folder : |
41 |
+ <p>Only files flagged with [Saved] are contained in the backup.</p> |
42 |
+ <br/>Backup files are verified from shared folder : |
43 |
]]> |
44 |
</trans> |
45 |
</entry> |
46 |
@@ -871,4 +871,33 @@ |
47 |
<base>HOURS</base> |
48 |
<trans>hours.</trans> |
49 |
</entry> |
50 |
+ <entry> |
51 |
+ <base>ERR_NO_FULL_BACKUP</base> |
52 |
+ <trans>Aborting restore because needed full backup is missing or unreadable.</trans> |
53 |
+ </entry> |
54 |
+ <entry> |
55 |
+ <base>ERR_NO_INC_BACKUP</base> |
56 |
+ <trans>Aborting restore because the set has missing or unreadable incremental backup number</trans> |
57 |
+ </entry> |
58 |
+ <entry> |
59 |
+ <base>CHECK_TO_VERIFY_FULL_RESTORE</base> |
60 |
+ <trans>Check here to test integrity of all backups needed for a full restore with the selected backup </trans> |
61 |
+ </entry> |
62 |
+ <entry> |
63 |
+ <base>TESTING_NEEDED_BACKUPS_FOR_RESTORE</base> |
64 |
+ <trans>Testing all backups needed for a full restore with selected backup</trans> |
65 |
+ </entry> |
66 |
+ <entry> |
67 |
+ <base>TESTED_BACKUP</base> |
68 |
+ <trans>Testing integrity of backup</trans> |
69 |
+ </entry> |
70 |
+ <entry> |
71 |
+ <base>RESTORE_VERIFY_FAILED</base> |
72 |
+ <trans>Verify integrity failed</trans> |
73 |
+ </entry> |
74 |
+ <entry> |
75 |
+ <base>CHECK_INTEGRITY_WARNING</base> |
76 |
+ <trans>Warning : For large backups, checking integrity may be a long task and should be made with daily workstation backup disabled.</trans> |
77 |
+ </entry> |
78 |
</lexicon> |
79 |
+ |
80 |
\ Pas de fin de ligne à la fin du fichier. |
81 |
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 |
82 |
--- e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup.workstation_verify 2009-07-22 17:06:13.000000000 +0200 |
83 |
+++ e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup 2009-07-22 17:08:58.000000000 +0200 |
84 |
@@ -1830,6 +1830,25 @@ sub workstnVerify () |
85 |
) |
86 |
); |
87 |
|
88 |
+ print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, |
89 |
+ |
90 |
+ esmith::cgi::genWidgetRow( |
91 |
+ $q, |
92 |
+ $fm->localise('CHECK_TO_VERIFY_FULL_RESTORE'), |
93 |
+ $q->checkbox ( |
94 |
+ -name => 'verifyall', |
95 |
+ -checked=>0, |
96 |
+ -label=>'' |
97 |
+ ) |
98 |
+ ), |
99 |
+ $q->Tr( |
100 |
+ esmith::cgi::genTextRow( |
101 |
+ $q, |
102 |
+ $fm->localise('CHECK_INTEGRITY_WARNING') |
103 |
+ ) |
104 |
+ ) |
105 |
+ ),"\n"; |
106 |
+ |
107 |
print $q->table ({width => "100%", -class => "sme-noborders"}, |
108 |
esmith::cgi::genButtonRow( |
109 |
$q, |
110 |
@@ -1839,7 +1858,7 @@ sub workstnVerify () |
111 |
) |
112 |
) |
113 |
),"\n"; |
114 |
- |
115 |
+ |
116 |
print $q->hidden( |
117 |
-name => 'state', |
118 |
-override => 1, |
119 |
@@ -1867,6 +1886,7 @@ sub performWorkstnVerify |
120 |
$conf->get('SystemName')->value . "." . $conf->get('DomainName')->value; |
121 |
my $err; |
122 |
my $VFSType = $backupwkrec->prop('VFSType') || 'cifs'; |
123 |
+ my $verifyref = $q->param ('backupset'); |
124 |
|
125 |
# Mounting backup shared folder |
126 |
|
127 |
@@ -1893,62 +1913,201 @@ sub performWorkstnVerify |
128 |
return; |
129 |
} |
130 |
|
131 |
- my $backupkey = $q->param ('backupset'); |
132 |
- if ($backupkey =~ /^(.*)$/) |
133 |
- { |
134 |
- $backupkey = $1; |
135 |
- } |
136 |
- else |
137 |
+ my $fullverify = $q->param('verifyall'); |
138 |
+ |
139 |
+ if ( $fullverify eq "on" ) |
140 |
{ |
141 |
- if ($mounted) |
142 |
+ # Test all backups needed to full restore |
143 |
+ |
144 |
+ my %backupsetfiles = (); |
145 |
+ my @restorefiles; |
146 |
+ my $set = $verifyref; |
147 |
+ $set =~ s/\/[^\/]*$//; |
148 |
+ my $backupsetlist = sub { |
149 |
+ if ( $_ =~ /\.dar/ ) |
150 |
+ { |
151 |
+ my $backupref = $File::Find::name; |
152 |
+ $backupref =~ s/\.[0-9]+\.dar//; |
153 |
+ $_ =~ s/\..*\.dar//; |
154 |
+ $_ =~ s/.*-//; |
155 |
+ $backupsetfiles{$_} = $backupref; |
156 |
+ } |
157 |
+ }; |
158 |
+ |
159 |
+ # find list of available backups and verify |
160 |
+ # it contains all backups needed for full restore |
161 |
+ |
162 |
+ find { wanted => \&$backupsetlist, untaint => 1 }, $set ; |
163 |
+ |
164 |
+ my $key; |
165 |
+ my $num = 0; |
166 |
+ foreach $key (sort keys %backupsetfiles) |
167 |
{ |
168 |
- system("/bin/umount", "$mntdir") == 0 |
169 |
- or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
170 |
+ push @restorefiles, $backupsetfiles{$key}; |
171 |
+ if ( $num == 0 ) |
172 |
+ { |
173 |
+ unless ( $backupsetfiles{$key} =~ /\/full-/ ) |
174 |
+ { |
175 |
+ esmith::cgi::genHeaderNonCacheable( |
176 |
+ $q, |
177 |
+ undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE') |
178 |
+ ); |
179 |
+ esmith::cgi::genResult( |
180 |
+ $q, $fm->localise('ERR_NO_FULL_BACKUP') |
181 |
+ ); |
182 |
+ return; |
183 |
+ } |
184 |
+ } |
185 |
+ else |
186 |
+ { |
187 |
+ my $numf = sprintf("%03d", $num); |
188 |
+ unless ( $backupsetfiles{$key} =~ /\/inc-$numf-/ ) |
189 |
+ { |
190 |
+ esmith::cgi::genHeaderNonCacheable( |
191 |
+ $q, |
192 |
+ undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE') |
193 |
+ ); |
194 |
+ |
195 |
+ esmith::cgi::genResult( |
196 |
+ $q, $fm->localise('ERR_NO_INC_BACKUP') . " " . $numf |
197 |
+ ); |
198 |
+ return; |
199 |
+ } |
200 |
+ |
201 |
+ } |
202 |
+ $num++; |
203 |
+ last if ( $backupsetfiles{$key} eq $verifyref ); |
204 |
} |
205 |
- die('Unsecure data : ' . $backupkey); |
206 |
- } |
207 |
+ |
208 |
+ # and test them |
209 |
+ |
210 |
+ $| = 1; |
211 |
|
212 |
- if (open(RD, "-|")) |
213 |
- { |
214 |
- esmith::cgi::genHeaderNonCacheable ($q, |
215 |
- undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE')); |
216 |
+ if (open(RD, "-|")) |
217 |
+ { |
218 |
+ esmith::cgi::genHeaderNonCacheable ($q, undef, |
219 |
+ $fm->localise('VERIFY_WORKSTN_BACKUP_FILE')); |
220 |
|
221 |
- print $q->p($fm->localise('FILES_IN_BACKUP')); |
222 |
+ print $q->p ( |
223 |
+ $q->b ($fm->localise('TESTING_NEEDED_BACKUPS_FOR_RESTORE') ) |
224 |
+ ); |
225 |
+ print '<UL>'; |
226 |
+ |
227 |
+ while (<RD>) |
228 |
+ { |
229 |
+ print "<li>$_</li>\n"; |
230 |
+ } |
231 |
|
232 |
- print '<UL>'; |
233 |
+ print '</UL>'; |
234 |
+ my $message; |
235 |
+ if (!close RD) |
236 |
+ { |
237 |
+ print $q->p ($q->b ( $fm->localise('RESTORE_VERIFY_FAILED') )); |
238 |
+ } |
239 |
+ else |
240 |
+ { |
241 |
+ print $q->p ($q->b ( $fm->localise('VERIFY_COMPLETE') )); |
242 |
+ } |
243 |
|
244 |
- my $complete = 0; |
245 |
- while (<RD>) |
246 |
+ esmith::cgi::genFooter ($q); |
247 |
+ } |
248 |
+ else |
249 |
{ |
250 |
- $complete++ if /etc\/smbpasswd$/; |
251 |
- $complete++ if /etc\/samba\/smbpasswd$/; # >6.0 base |
252 |
- print "<li>$_</li>\n"; |
253 |
+ select(STDOUT); |
254 |
+ $| = 1; |
255 |
+ |
256 |
+ my $file; |
257 |
+ foreach $file (@restorefiles) |
258 |
+ { |
259 |
+ if ($file =~ /^(.*)$/) |
260 |
+ { |
261 |
+ $file = $1; |
262 |
+ } |
263 |
+ else |
264 |
+ { |
265 |
+ if ($mounted) |
266 |
+ { |
267 |
+ system("/bin/umount", "$mntdir") == 0 |
268 |
+ or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
269 |
+ } |
270 |
+ die('Unsecure data : ' . $file); |
271 |
+ } |
272 |
+ print $q->p($fm->localise('TESTED_BACKUP') . " " . $file); |
273 |
+ system ("/usr/bin/dar", "-Q", "--test", "$file", "--noconf"); |
274 |
+ } |
275 |
+ |
276 |
+ if ($mounted) |
277 |
+ { |
278 |
+ system("/bin/umount", "$mntdir") == 0 |
279 |
+ or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
280 |
+ } |
281 |
+ |
282 |
+ exit(0); |
283 |
} |
284 |
+ return; |
285 |
|
286 |
- print '</UL>'; |
287 |
- my $status = close RD ? |
288 |
+ } |
289 |
+ else |
290 |
+ { |
291 |
+ # verify selected backup only |
292 |
+ # and display files saved in the backup |
293 |
+ |
294 |
+ my $backupkey = $verifyref; |
295 |
+ if ($backupkey =~ /^(.*)$/) |
296 |
+ { |
297 |
+ $backupkey = $1; |
298 |
+ } |
299 |
+ else |
300 |
+ { |
301 |
+ if ($mounted) |
302 |
+ { |
303 |
+ system("/bin/umount", "$mntdir") == 0 |
304 |
+ or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
305 |
+ } |
306 |
+ die('Unsecure data : ' . $backupkey); |
307 |
+ } |
308 |
+ |
309 |
+ if (open(RD, "-|")) |
310 |
+ { |
311 |
+ esmith::cgi::genHeaderNonCacheable ($q, |
312 |
+ undef, $fm->localise('VERIFY_WORKSTN_BACKUP_FILE')); |
313 |
+ print $q->p($fm->localise('FILES_IN_BACKUP')); |
314 |
+ |
315 |
+ print '<UL>'; |
316 |
+ |
317 |
+ my $complete = 0; |
318 |
+ while (<RD>) |
319 |
+ { |
320 |
+ $complete++ if /etc\/smbpasswd$/; |
321 |
+ $complete++ if /etc\/samba\/smbpasswd$/; # >6.0 base |
322 |
+ print "<li>$_</li>\n"; |
323 |
+ } |
324 |
+ |
325 |
+ print '</UL>'; |
326 |
+ my $status = close RD ? |
327 |
($complete ? |
328 |
$fm->localise('VERIFY_COMPLETE') : |
329 |
$fm->localise('BACKUP_FILE_INCOMPLETE')) |
330 |
: ($fm->localise('ERROR_READING_FILE').' : '.$backupkey); |
331 |
- print $q->p ($q->b ($status)); |
332 |
+ print $q->p ($q->b ($status)); |
333 |
|
334 |
- esmith::cgi::genFooter ($q); |
335 |
+ esmith::cgi::genFooter ($q); |
336 |
|
337 |
- } |
338 |
- else |
339 |
- { |
340 |
- select(STDOUT); |
341 |
- $| = 1; |
342 |
+ } |
343 |
+ else |
344 |
+ { |
345 |
+ select(STDOUT); |
346 |
+ $| = 1; |
347 |
|
348 |
- system ("/usr/bin/dar", "-Q", "--list", "$backupkey", "--noconf") == 0 |
349 |
- or die ($fm->localise('ERR_EXTRACT')." : ".$!); |
350 |
+ system ("/usr/bin/dar", "-Q", "--list", "$backupkey", "--noconf") == 0 |
351 |
+ or die ($fm->localise('ERR_EXTRACT')." : ".$!); |
352 |
|
353 |
- if ($mounted) { |
354 |
- system("/bin/umount", "$mntdir") == 0 |
355 |
- or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
356 |
- } |
357 |
- exit(0); |
358 |
+ if ($mounted) { |
359 |
+ system("/bin/umount", "$mntdir") == 0 |
360 |
+ or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
361 |
+ } |
362 |
+ exit(0); |
363 |
+ } |
364 |
} |
365 |
|
366 |
return; |
367 |
@@ -1992,7 +2151,7 @@ sub workstnRestore () |
368 |
$_ =~ s/.*-//; |
369 |
@{$backupfiles{$_}}[0] = $dir; |
370 |
@{$backupfiles{$_}}[1] = $backupref; |
371 |
- } |
372 |
+ } |
373 |
}; |
374 |
|
375 |
# Mounting backup shared folder |
376 |
@@ -2173,20 +2332,58 @@ sub performWorkstnRestore |
377 |
system("/bin/umount", "$mntdir") == 0 |
378 |
or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
379 |
} |
380 |
+ esmith::cgi::genHeaderNonCacheable( |
381 |
+ $q, |
382 |
+ undef, $fm->localise('RESTORE_CANNOT_PROCEED') |
383 |
+ ); |
384 |
esmith::cgi::genResult( |
385 |
- $q, $fm->localise('ERR_NO_HOST_DIR'), $id |
386 |
+ $q, $fm->localise('ERR_NO_HOST_DIR') . $id |
387 |
); |
388 |
return; |
389 |
} |
390 |
|
391 |
# finding list of available backups |
392 |
- |
393 |
+ # and verifying all needed backup files are available |
394 |
+ |
395 |
find { wanted => \&$backupsetlist, untaint => 1 }, $set ; |
396 |
|
397 |
my $key; |
398 |
+ my $num = 0; |
399 |
foreach $key (sort keys %backupsetfiles) |
400 |
{ |
401 |
push @restorefiles, $backupsetfiles{$key}; |
402 |
+ if ( $num == 0 ) |
403 |
+ { |
404 |
+ unless ( $backupsetfiles{$key} =~ /\/full-/ ) |
405 |
+ { |
406 |
+ esmith::cgi::genHeaderNonCacheable( |
407 |
+ $q, |
408 |
+ undef, $fm->localise('RESTORE_CANNOT_PROCEED') |
409 |
+ ); |
410 |
+ esmith::cgi::genResult( |
411 |
+ $q, $fm->localise('ERR_NO_FULL_BACKUP') |
412 |
+ ); |
413 |
+ return; |
414 |
+ } |
415 |
+ } |
416 |
+ else |
417 |
+ { |
418 |
+ my $numf = sprintf("%03d", $num); |
419 |
+ unless ( $backupsetfiles{$key} =~ /\/inc-$numf-/ ) |
420 |
+ { |
421 |
+ esmith::cgi::genHeaderNonCacheable( |
422 |
+ $q, |
423 |
+ undef, $fm->localise('RESTORE_CANNOT_PROCEED') |
424 |
+ ); |
425 |
+ |
426 |
+ esmith::cgi::genResult( |
427 |
+ $q, $fm->localise('ERR_NO_INC_BACKUP') . $numf |
428 |
+ ); |
429 |
+ return; |
430 |
+ } |
431 |
+ |
432 |
+ } |
433 |
+ $num++; |
434 |
last if ( $backupsetfiles{$key} eq $restoreref ); |
435 |
} |
436 |
|
437 |
@@ -2311,7 +2508,7 @@ sub performWorkstnRestore |
438 |
else |
439 |
{ |
440 |
if ($mounted) |
441 |
- { |
442 |
+ { |
443 |
system("/bin/umount", "$mntdir") == 0 |
444 |
or die($fm->localise('ERR_WHILE_UNMOUNTING'),"\n"); |
445 |
} |