From b7172b69cee46cf9e001918333855e9b79aa15e0 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 26 May 2020 23:33:49 +0200 Subject: global-functions: add $DNSIsResolving --- global-functions | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/global-functions b/global-functions index 2ff1f43..d7ee6b8 100644 --- a/global-functions +++ b/global-functions @@ -24,6 +24,7 @@ :global CleanFilePath; :global DefaultRouteIsReachable; :global DeviceInfo; +:global DNSIsResolving; :global DownloadPackage; :global GetMacVendor; :global GetRandom; @@ -218,6 +219,16 @@ :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 :set DownloadPackage do={ :local PkgName [ :tostr $1 ]; -- cgit v1.2.3-54-g00ecf