global-functions: add $DNSIsResolving

This commit is contained in:
Christian Hesse 2020-05-26 23:33:49 +02:00
parent 856c879fd8
commit b7172b69ce

View file

@ -24,6 +24,7 @@
:global CleanFilePath; :global CleanFilePath;
:global DefaultRouteIsReachable; :global DefaultRouteIsReachable;
:global DeviceInfo; :global DeviceInfo;
:global DNSIsResolving;
:global DownloadPackage; :global DownloadPackage;
:global GetMacVendor; :global GetMacVendor;
:global GetRandom; :global GetRandom;
@ -218,6 +219,16 @@
:return $Info; :return $Info;
} }
# check if DNS is resolving
:set DNSIsResolving do={
:do {
:resolve mikrotik.com;
:return true;
} on-error={
:return false;
}
}
# download package from upgrade server # download package from upgrade server
:set DownloadPackage do={ :set DownloadPackage do={
:local PkgName [ :tostr $1 ]; :local PkgName [ :tostr $1 ];