The following patch to Backup::Snapback (Snapback.pm) allowed
Snapback2 to operate on OpenBSD properly. Perhaps this could be
integrated properly by expanding the "Cp" configuration parameter to
be customizable, for example:
Cp /usr/local/bin/gcp -al $target $destination
and for backwards compatibility assume that a simple entry, e.g.,
Cp /usr/local/bin/gcp
meant to append "-al $target $destination."
If "Cp" were this flexible then I could have customized it to work on
OpenBSD simply by configuring it as follows:
Cp cd $target && find . -depth -print | cpio -pdl $destination
This is merely a suggestion but it would be very nice to see this
included upstream, thereby making Snapback2 more portable.
Below is the patch that I used:
# diff -u Snapback.pm /usr/libdata/perl5/Backup/Snapback.pm
--- Snapback.pm Thu May 13 12:56:57 2010
+++ /usr/libdata/perl5/Backup/Snapback.pm Thu May 13 13:32:22 2010
@@ -849,8 +849,8 @@
elsif (-d "$dir.1") {
## 3.2: Hard link from the newest backup:
$self->log_debug("Hard Link newest backup: $cp -al $dir.1 $dir.0\n");
- system("$cp -al $dir.1 $dir.0") == 0
- or die "FAILED: $cp -al $dir.0 $dir.1";
+ system("cd $dir.1 && find . -depth -print | cpio -pdl $dir.0") == 0
+ or die "FAILED: cd $dir.1 && find . -depth -print | cpio -pdl $dir.0";
}
}
@@ -1219,8 +1219,8 @@
## 3.2: Hard link from the newest backup:
if (! $many_files and ! $retain and -d "$backupdir.0") {
$self->log_debug("Hard Link newest backup\n");
- system("$cp -al $backupdir.0 $backupdir.1") == 0
- or die "FAILED: $cp -al $backupdir.0 $backupdir.1";
+ system("cd $backupdir.0 && find . -depth -print | cpio -pdl $backupdir.1") == 0
+ or die "FAILED: cd $backupdir.0 && find . -depth -print | cpio -pdl $backupdir.1";
}
my $extra_ropts = '';
@@ -1339,8 +1339,8 @@
## No rsync necessary, just hard-link from the most-recent hourly.
if (-d "$yesterdays_hourly") {
- system("$cp -al $yesterdays_hourly $backupdir.0") == 0
- or die "FAILED: $cp -al $yesterdays_hourly $backupdir.0";
+ system("cd $yesterdays_hourly && find . -depth -print | cpio -pdl $backupdir.0") == 0
+ or die "FAILED: cd $yesterdays_hourly && find . -depth -print | cpio -pdl $backupdir.0";
}
}
@@ -1349,8 +1349,8 @@
$backupdir = $prefix . $weekly_dir;
$self->rotate($self->config(-Weeklies), $backupdir, $rotate_all);
if (-d "$yesterdays_hourly") {
- system("$cp -al $yesterdays_hourly $backupdir.0") == 0
- or die "FAILED: $cp -al $yesterdays_hourly $backupdir.0";
+ system("cd $yesterdays_hourly && find . -depth -print | cpio -pdl $backupdir.0") == 0
+ or die "FAILED: cd $yesterdays_hourly && find . -depth -print | cpio -pdl $backupdir.0";
}
}
@@ -1359,8 +1359,8 @@
$backupdir = $prefix . $monthly_dir;
$self->rotate($self->config(-Monthlies), $backupdir, $rotate_all);
if (-d "$yesterdays_hourly") {
- system("$cp -al $yesterdays_hourly $backupdir.0") == 0
- or die "FAILED: $cp -al $yesterdays_hourly $backupdir.0";
+ system("cd $yesterdays_hourly && find . -depth -print | cpio -pdl $backupdir.0") == 0
+ or die "FAILED: cd $yesterdays_hourly && find . -depth -print | cpio -pdl $backupdir.0";
}
}
}