2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-25 09:55:38 +00:00

98_update.pm: go in background for single-file (Forum #137382)

git-svn-id: https://svn.fhem.de/fhem/trunk@28624 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2024-03-09 09:21:17 +00:00
parent 969da5958e
commit 621ea4cfe7

View File

@ -49,6 +49,9 @@ CommandUpdate($$)
my ($cl,$param) = @_;
my @args = split(/ +/,$param);
return "An update is already running" if($upd_running);
$upd_running = 1;
my $err = upd_metainit(0);
return $err if($err);
@ -73,13 +76,14 @@ CommandUpdate($$)
my $ret = eval { "Hello" =~ m/$arg/ };
return "first argument must be a valid regexp, all, force, check or checktime"
if($arg =~ m/^[-\?\*]/ || $ret);
$arg = lc($arg) if($arg =~ m/^(check|checktime|all|force)$/i);
$updateInBackground = AttrVal("global","updateInBackground",1);
$updateInBackground = 0 if($arg ne "all");
if($arg =~ m/^(check|checktime|all|force)$/i) {
$arg = lc($arg);
$updateInBackground = 0;
}
$updArg = $arg;
return "An update is already running" if($upd_running);
$upd_running = 1;
if($updateInBackground) {
CallFn($cl->{NAME}, "ActivateInformFn", $cl, "log") if($cl);
sub updDone(@) { $upd_running=0 }