capsman-download-packages: no download of missing package for wifiwave2

Sadly the log messages from wifiwave2 do not contain any hint what is
missing... So it's not possible to download missing files.
This commit is contained in:
Christian Hesse 2023-08-07 16:44:26 +02:00
parent 8428ba890d
commit 3cab917a61
3 changed files with 6 additions and 28 deletions

View file

@ -55,6 +55,7 @@ $WaitFullyConnected;
}
}
# NOT /interface/wifiwave2 #
:if ([ :len [ /system/logging/find where topics~"error" !(topics~"!error") \
!(topics~"!caps") action=memory !disabled !invalid ] ] < 1) do={
$LogPrintExit2 warning $0 ("Looks like error messages for 'caps' are not sent to memory. " . \
@ -81,6 +82,7 @@ $WaitFullyConnected;
}
}
# NOT /interface/wifiwave2 #
:if ($Updated = true) do={
:local Script ([ /system/script/find where source~"\n# provides: capsman-rolling-upgrade\n" ]->0);
:if ([ :len $Script ] > 0) do={

View file

@ -53,32 +53,6 @@ $WaitFullyConnected;
}
}
:if ([ :len [ /system/logging/find where topics~"error" !(topics~"!error") \
!(topics~"!caps") action=memory !disabled !invalid ] ] < 1) do={
$LogPrintExit2 warning $0 ("Looks like error messages for 'caps' are not sent to memory. " . \
"Probably can not download packages automatically.") false;
} else={
:if ($Updated = false && [ /system/resource/get uptime ] < 2m) do={
$LogPrintExit2 info $0 ("No packages downloaded, yet. Delaying for logs.") false;
:delay 2m;
}
}
:foreach Log in=[ /log/find where topics=({"caps"; "error"}) \
message~("upgrade status: failed, failed to download file '.*-" . $InstalledVersion . \
"-.*\\.npk', no such file") ] do={
:local Message [ /log/get $Log message ];
:local Package [ :pick $Message \
([ :find $Message "'" ] + 1) \
[ :find $Message ("-" . $InstalledVersion . "-") ] ];
:local Arch [ :pick $Message \
([ :find $Message ("-" . $InstalledVersion . "-") ] + 2 + [ :len $InstalledVersion ]) \
[ :find $Message ".npk" ] ];
:if ([ $DownloadPackage $Package $InstalledVersion $Arch $PackagePath ] = true) do={
:set Updated true;
}
}
:if ($Updated = true) do={
:local Script ([ /system/script/find where source~"\n# provides: capsman-rolling-upgrade\n" ]->0);
:if ([ :len $Script ] > 0) do={

View file

@ -39,8 +39,10 @@ For legacy CAPsMAN:
/system/scheduler/add name=capsman-download-packages on-event="/system/script/run capsman-download-packages.capsman;" start-time=startup;
Packages available in local storage in older version are downloaded
unconditionally. The script tries to download missing packages by guessing
from system log.
unconditionally.
If no packages are found the script tries to download missing packages for
legacy CAPsMAN by guessing from system log.
Usage and invocation
--------------------