mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
98_backup.pm: avoid double fhem.cfg (Forum #54826)
git-svn-id: https://svn.fhem.de/fhem/trunk@11706 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
50c3263170
commit
bf38f25392
@ -38,7 +38,7 @@ sub
|
|||||||
backup_Initialize($$)
|
backup_Initialize($$)
|
||||||
{
|
{
|
||||||
my %hash = ( Fn => "CommandBackup",
|
my %hash = ( Fn => "CommandBackup",
|
||||||
Hlp => ",create a backup of fhem configuration, state and modpath" );
|
Hlp => ",create a backup of fhem configuration, state and modpath" );
|
||||||
$cmds{backup} = \%hash;
|
$cmds{backup} = \%hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,9 +48,13 @@ CommandBackup($$)
|
|||||||
{
|
{
|
||||||
my ($cl, $param) = @_;
|
my ($cl, $param) = @_;
|
||||||
|
|
||||||
my $modpath = $attr{global}{modpath};
|
my $modpath = AttrVal("global", "modpath","");
|
||||||
my $configfile = AttrVal("global", "configfile", "");
|
my $configfile = AttrVal("global", "configfile", "");
|
||||||
my $statefile = AttrVal("global", "statefile", "");
|
my $statefile = AttrVal("global", "statefile", "");
|
||||||
|
|
||||||
|
# prevent duplicate entries in backup list for default config, forum #54826
|
||||||
|
$configfile = '' if ($configfile eq 'fhem.cfg' || configDBUsed());
|
||||||
|
$statefile = '' if ($statefile eq "./log/fhem.save");
|
||||||
my $msg;
|
my $msg;
|
||||||
my $ret;
|
my $ret;
|
||||||
|
|
||||||
@ -87,7 +91,7 @@ CommandBackup($$)
|
|||||||
Log 4, "backup include: 'configDB.conf'";
|
Log 4, "backup include: 'configDB.conf'";
|
||||||
} else {
|
} else {
|
||||||
# get pathnames to archiv
|
# get pathnames to archiv
|
||||||
push @pathname, $configfile;
|
push @pathname, $configfile if($configfile);
|
||||||
Log 4, "backup include: '$configfile'";
|
Log 4, "backup include: '$configfile'";
|
||||||
$ret = parseConfig($configfile);
|
$ret = parseConfig($configfile);
|
||||||
push @pathname, $statefile if($statefile);
|
push @pathname, $statefile if($statefile);
|
||||||
@ -108,6 +112,8 @@ sub
|
|||||||
parseConfig($)
|
parseConfig($)
|
||||||
{
|
{
|
||||||
my $configfile = shift;
|
my $configfile = shift;
|
||||||
|
# we need default value to read included files
|
||||||
|
$configfile = $configfile ? $configfile : 'fhem.cfg';
|
||||||
my $fh;
|
my $fh;
|
||||||
my $msg;
|
my $msg;
|
||||||
my $ret;
|
my $ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user