1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.14.0/root/etc/e-smith/events/actions/restore-from-disk mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/events/actions/restore-from-disk |
2 |
--- e-smith-backup-1.14.0/root/etc/e-smith/events/actions/restore-from-disk 2006-03-14 10:08:45.000000000 -0700 |
3 |
+++ mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/events/actions/restore-from-disk 2007-01-18 08:56:02.000000000 -0700 |
4 |
@@ -35,7 +35,7 @@ |
5 |
|
6 |
exit 0 unless $program eq 'CopyFromDisk'; |
7 |
|
8 |
-die("Root path to restore from must be provided\n") unless defined $path; |
9 |
+die("Root path to restore from must be provided\n") unless defined $path && -d $path; |
10 |
chdir $path or die "Could not chdir to $path: $!"; |
11 |
|
12 |
my $backup_db = new esmith::Backup or die "Couldn't create Backup object\n"; |
13 |
@@ -45,12 +45,14 @@ |
14 |
die "Can't fork: $!" unless defined(my $pid = open(STDIN, "-|")); |
15 |
if ($pid) |
16 |
{ |
17 |
- # parent - copy files from $path to / |
18 |
- exec("cpio", "-dump", "/"); |
19 |
+ # parent - extract files to / |
20 |
+ exec(qw(tar -C / -xf -)); |
21 |
} |
22 |
else |
23 |
{ |
24 |
- # generate a set of pathnames under $path which are to be restored |
25 |
- exec("find", @restore); |
26 |
+ # create archive from $path which are to be restored |
27 |
+ chroot($path) || die "Can't chroot to $path"; |
28 |
+ open(STDERR, ">/dev/null"); |
29 |
+ exec(qw(tar -C / -cf -), @restore); |
30 |
} |
31 |
|