mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
update.pm: handle non-standard fhem.pl location (Forum 27451)
git-svn-id: https://svn.fhem.de/fhem/trunk@6736 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8245d3b1f2
commit
be1b528df9
@ -19,6 +19,7 @@ my $updateInBackground;
|
||||
my $updRet;
|
||||
my %updDirs;
|
||||
my $updArg;
|
||||
my $mainPgm = "/fhem.pl\$";
|
||||
|
||||
|
||||
########################################
|
||||
@ -331,8 +332,10 @@ upd_writeFile($$$$)
|
||||
|
||||
my $rest = ($restoreDir ? "trying to restore the previous version and ":"").
|
||||
"aborting the update";
|
||||
if(!open(FD, ">$root/$fName")) {
|
||||
uLog 1, "open $root/$fName failed: $!, $rest";
|
||||
my $fPath = "$root/$fName";
|
||||
$fPath = $0 if($fPath =~ m/$mainPgm/);
|
||||
if(!open(FD, ">$fPath")) {
|
||||
uLog 1, "open $fPath failed: $!, $rest";
|
||||
mv "$root/$restoreDir/$fName", "$root/$fName" if($restoreDir);
|
||||
return 0;
|
||||
}
|
||||
@ -340,14 +343,14 @@ upd_writeFile($$$$)
|
||||
print FD $content;
|
||||
close(FD);
|
||||
|
||||
my $written = -s "$root/$fName";
|
||||
my $written = -s "$fPath";
|
||||
if($written != length($content)) {
|
||||
uLog 1, "writing $root/$fName failed: $!, $rest";
|
||||
mv "$root/$restoreDir/$fName", "$root/$fName" if($restoreDir);
|
||||
uLog 1, "writing $fPath failed: $!, $rest";
|
||||
mv "$root/$restoreDir/$fName", "$fPath" if($restoreDir);
|
||||
return;
|
||||
}
|
||||
|
||||
cfgDB_FileUpdate("$root/$fName") if(configDBUsed());
|
||||
cfgDB_FileUpdate("$fPath") if(configDBUsed());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user