aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-05-26 23:33:49 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-05-26 23:33:49 +0200
commitb7172b69cee46cf9e001918333855e9b79aa15e0 (patch)
tree1d1365102ec0d48c32d600af89faaa27d1706a77
parent856c879fd8cccc2f8dc7243b60233efd1453e22d (diff)
global-functions: add $DNSIsResolving
-rw-r--r--global-functions11
1 files changed, 11 insertions, 0 deletions
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 ];