aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-12-28 18:50:22 +0100
committerGravatar Christian Hesse <mail@eworm.de>2018-12-28 18:50:22 +0100
commit30166cc2875a9b1ca1229ee9892f37234cc43418 (patch)
tree3fbfa58955609b80bda068d1e773ab6d56afa014
parent58d105da00460daf8d75c0a639a9faced1324b4d (diff)
capsman-download-packages: move condition to loop
-rw-r--r--capsman-download-packages33
1 files changed, 16 insertions, 17 deletions
diff --git a/capsman-download-packages b/capsman-download-packages
index dc68486..8b31574 100644
--- a/capsman-download-packages
+++ b/capsman-download-packages
@@ -16,24 +16,23 @@
:local "installed-version" [ / system package update get installed-version ];
:local updated false;
-:foreach package in=[ / file find where type=package name~("^" . $"package-path") ] do={
- :if ([ / file get $package package-version ] != $"installed-version") do={
- :local "package-name" [ / file get $package package-name ];
- :local "package-architecture" [ / file get $package package-architecture ];
- :if ($"package-architecture" = "mips") do={
- :set "package-architecture" "mipsbe";
- }
- :if ($"package-name" = "wireless@") do={
- :set "package-name" "wireless";
- }
- :local "package-file" ($"package-name" . "-" . $"installed-version" . "-" . $"package-architecture" . ".npk");
- $CertificateAvailable "Let's Encrypt Authority X3" "letsencrypt";
- / tool fetch mode=https check-certificate=yes-without-crl \
- ("https://upgrade.mikrotik.com/routeros/" . $"installed-version" . "/" . $"package-file") \
- dst-path=($"package-path" . "/" . $"package-file");
- :set updated true;
- / file remove $package;
+:foreach package in=[ / file find where type=package \
+ package-version!=$"installed-version" name~("^" . $"package-path") ] do={
+ :local "package-name" [ / file get $package package-name ];
+ :local "package-architecture" [ / file get $package package-architecture ];
+ :if ($"package-architecture" = "mips") do={
+ :set "package-architecture" "mipsbe";
}
+ :if ($"package-name" = "wireless@") do={
+ :set "package-name" "wireless";
+ }
+ :local "package-file" ($"package-name" . "-" . $"installed-version" . "-" . $"package-architecture" . ".npk");
+ $CertificateAvailable "Let's Encrypt Authority X3" "letsencrypt";
+ / tool fetch mode=https check-certificate=yes-without-crl \
+ ("https://upgrade.mikrotik.com/routeros/" . $"installed-version" . "/" . $"package-file") \
+ dst-path=($"package-path" . "/" . $"package-file");
+ :set updated true;
+ / file remove $package;
}
:if ($updated = true) do={