mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: detect failed package downloads
This commit is contained in:
parent
151435ba0c
commit
f127e3b7ef
1 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue