From 30166cc2875a9b1ca1229ee9892f37234cc43418 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 28 Dec 2018 18:50:22 +0100 Subject: capsman-download-packages: move condition to loop --- capsman-download-packages | 33 ++++++++++++++++----------------- 1 file 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={ -- cgit v1.2.3-70-g09d2