From f127e3b7efe4c7d5dcd828218bbd44cbe04dcb47 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 14 Feb 2019 20:35:13 +0100 Subject: global-functions: detect failed package downloads --- global-functions | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index f1d9ba2..8c4d41d 100644 --- a/global-functions +++ b/global-functions @@ -178,9 +178,17 @@ / tool fetch mode=https check-certificate=yes-without-crl \ ("https://upgrade.mikrotik.com/routeros/" . $PkgVer . "/" . $PkgFile) \ dst-path=$PkgDest; - :return true; } on-error={ / file remove [ find where name=$PkgDest ]; :return false; } + + # Fetch tool in RouterOS has an issue where it truncates files on slow + # storage. Detect that... TODO: Remove when fixed. (Ticket#2019021122006199) + :if ([ / file get [ find where name=$PkgDest ] type ] != "package") do={ + / file remove [ find where name=$PkgDest ]; + :return false; + } + + :return true; } -- cgit v1.2.3-70-g09d2