diff options
author | Christian Hesse <mail@eworm.de> | 2019-02-14 20:35:13 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-02-14 20:35:13 +0100 |
commit | f127e3b7efe4c7d5dcd828218bbd44cbe04dcb47 (patch) | |
tree | fca550a672325109418546ea8990156099787a75 /global-functions | |
parent | 151435ba0c0c4a1e1ea76884a35c437c8491cea7 (diff) |
global-functions: detect failed package downloads
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |