2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

98_backup.pm: Patch by Johannes for filenames with space (Forum #52660)

git-svn-id: https://svn.fhem.de/fhem/trunk@11313 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-04-26 07:07:56 +00:00
parent 44b41f90d6
commit c1fa94626e

View File

@ -49,8 +49,8 @@ CommandBackup($$)
my ($cl, $param) = @_;
my $modpath = $attr{global}{modpath};
my $configfile = AttrVal("global", "configfile", undef);
my $statefile = AttrVal("global", "statefile", undef);
my $configfile = AttrVal("global", "configfile", "");
my $statefile = AttrVal("global", "statefile", "");
my $msg;
my $ret;
@ -90,7 +90,7 @@ CommandBackup($$)
push @pathname, $configfile;
Log 4, "backup include: '$configfile'";
$ret = parseConfig($configfile);
push @pathname, $statefile;
push @pathname, $statefile if($statefile);
Log 4, "backup include: '$statefile'";
}
$ret = readModpath($modpath,$backupdir);
@ -172,6 +172,8 @@ createArchiv($$)
$dateTime =~ s/ /_/g;
$dateTime =~ s/(:|-)//g;
my $pathlist = join( "\" \"", @pathname );
my $cmd="";
if (!defined($backupcmd)) {
if (lc($symlink) eq "no") {
@ -181,10 +183,10 @@ createArchiv($$)
}
# prevents tar's output of "Removing leading /" and return total bytes of archive
$cmd = "tar -$tarOpts - @pathname |gzip > $backupdir/FHEM-$dateTime.tar.gz";
$cmd = "tar -$tarOpts - \"$pathlist\" |gzip > $backupdir/FHEM-$dateTime.tar.gz";
} else {
$cmd = "$backupcmd \"@pathname\"";
$cmd = "$backupcmd \"$pathlist\"";
}
Log 2, "Backup with command: $cmd";