diff --git a/wre/lib/WRE/File.pm b/wre/lib/WRE/File.pm index e468082..9022a16 100644 --- a/wre/lib/WRE/File.pm +++ b/wre/lib/WRE/File.pm @@ -437,6 +437,9 @@ sub tar { if ($options{gzip}) { $args .= " --gzip"; } + if ($options{absPath}) { + $args .= " -P"; + } if (exists $options{exclude}) { my $exFile = file($options{exclude}); if (-e $exFile) { diff --git a/wre/sbin/backup.pl b/wre/sbin/backup.pl index 3c23f32..4b78625 100755 --- a/wre/sbin/backup.pl +++ b/wre/sbin/backup.pl @@ -37,11 +37,40 @@ backupDomains($config); backupWebgui($config); backupWre($config); +backupCustom($config); runExternalScripts($config); compressBackups($config); copyToRemote($config); removeBackupFiles($config); +#------------------------------------------------------------------- +sub backupCustom { + my $config = shift; + + return undef unless $config->get("backup/items/custom"); + + my $backupDir = dir($config->get("backup/path")); + my $customFile = $config->getWebguiRoot("/sbin/preload.custom"); + open FILE, $customFile or die $!; + my @lines = ; + my @customDirs; + foreach my $line (@lines) { + if ($line =~ /^\//) { + my $backupFile = join("",map { ucfirst($_) } split /\//, $line); + chomp $backupFile; + + eval { $util->tar( + file => $backupDir->file($backupFile.".tar")->stringify, + stuff => [$line], + absPath => 1, + )}; + print $@."\n" if ($@); + } + else { + next; + } + } +} #------------------------------------------------------------------- sub backupDomains { diff --git a/wre/var/setupfiles/wre.conf b/wre/var/setupfiles/wre.conf index 671a529..deeae6c 100644 --- a/wre/var/setupfiles/wre.conf +++ b/wre/var/setupfiles/wre.conf @@ -95,7 +95,8 @@ "fullWre" : 0, "smallWre" : 1, "domainsFolder" : 1, - "webgui" : 1 + "webgui" : 1, + "custom" : 1, }, "externalScripts" : [], "ftp" : {