aboutsummaryrefslogtreecommitdiffstats
path: root/capsman-download-packages.wifi.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'capsman-download-packages.wifi.rsc')
-rw-r--r--capsman-download-packages.wifi.rsc19
1 files changed, 10 insertions, 9 deletions
diff --git a/capsman-download-packages.wifi.rsc b/capsman-download-packages.wifi.rsc
index 901bb0a..03fd9e7 100644
--- a/capsman-download-packages.wifi.rsc
+++ b/capsman-download-packages.wifi.rsc
@@ -11,15 +11,16 @@
#
# !! Do not edit this file, it is generated from template!
-:global GlobalFunctionsReady;
-:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-
:local ExitOK false;
-:do {
+:onerror Err {
+ :global GlobalConfigReady; :global GlobalFunctionsReady;
+ :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
+ do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
:local ScriptName [ :jobname ];
:global CleanFilePath;
:global DownloadPackage;
+ :global FileGet;
:global LogPrint;
:global MkDir;
:global RmFile;
@@ -42,7 +43,7 @@
:error false;
}
- :if ([ :len [ /file/find where name=$PackagePath type="directory" ] ] = 0) do={
+ :if ([ $FileGet $PackagePath ] = false) do={
:if ([ $MkDir $PackagePath ] = false) do={
$LogPrint warning $ScriptName ("Creating directory at CAPsMAN package path (" . \
$PackagePath . ") failed!");
@@ -53,7 +54,7 @@
"). Please place your packages!");
}
- :foreach Package in=[ /file/find where type=package \
+ :foreach Package in=[ /file/find where type="package" \
package-version!=$InstalledVersion name~("^" . $PackagePath) ] do={
:local File [ /file/get $Package ];
:if ($File->"package-architecture" = "mips") do={
@@ -66,7 +67,7 @@
}
}
- :if ([ :len [ /file/find where type=package name~("^" . $PackagePath) ] ] = 0) do={
+ :if ([ :len [ /file/find where type="package" name~("^" . $PackagePath) ] ] = 0) do={
$LogPrint info $ScriptName ("No packages available, downloading default set.");
:foreach Arch in={ "arm"; "arm64" } do={
:local Packages { "arm"={ "routeros"; "wifi-qcom"; "wifi-qcom-ac" };
@@ -89,6 +90,6 @@
/interface/wifi/capsman/remote-cap/upgrade [ find where version!=$InstalledVersion ];
}
}
-} on-error={
- :global ExitError; $ExitError $ExitOK [ :jobname ];
+} do={
+ :global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
}