Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'etc/library.sh')
-rw-r--r--etc/library.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/etc/library.sh b/etc/library.sh
index 01677652..2e147645 100644
--- a/etc/library.sh
+++ b/etc/library.sh
@@ -382,6 +382,13 @@ function nc_version()
ncc status | grep "version:" | awk '{ print $3 }'
}
+function get_ip()
+{
+ local iface
+ iface="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
+ ip a show dev "$iface" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1
+}
+
function is_an_ip()
{
local ip_or_domain="${1}"