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:
authornachoparker <nacho@ownyourbits.com>2021-09-28 03:21:33 +0300
committernachoparker <nacho@ownyourbits.com>2021-09-28 03:27:44 +0300
commitb0678445501a39a4fd52e98b011c709352632b7b (patch)
treea9e748db24190ecac748f38ce4feaf78cd93a547 /bin/ncp-diag
parent6ad96eddd3c2893ef9b75b6d4e0a927dab5c793f (diff)
add get_ip functionv1.39.15
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'bin/ncp-diag')
-rw-r--r--bin/ncp-diag6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ncp-diag b/bin/ncp-diag
index d19afcef..49260a70 100644
--- a/bin/ncp-diag
+++ b/bin/ncp-diag
@@ -11,6 +11,8 @@
# More at https://ownyourbits.com
#
+source /usr/local/etc/library.sh
+
# Distro, NCP version and tag
echo "NextCloudPi version|$( cat /usr/local/etc/ncp-version )"
[[ -f /usr/local/etc/ncp-baseimage ]] && echo "NextCloudPi image|$( cat /usr/local/etc/ncp-baseimage )"
@@ -67,7 +69,7 @@ function is_port_open()
{
local port=$1
local public_ip
- public_ip="$(curl -4 https://icanhazip.com 2>/dev/null)" || { echo "closed"; return 1; }
+ public_ip="$(curl -m4 -4 https://icanhazip.com 2>/dev/null)" || { echo "closed"; return 1; }
local tmp_file=$(mktemp)
local token=$(wget -T2 -t1 -qO- --keep-session-cookies --save-cookies $tmp_file https://portchecker.co | grep -oP "_csrf\" value=\"\K.*\"")
@@ -85,7 +87,7 @@ echo "port check 443|$( is_port_open 443 )"
# LAN
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
GW=$( ip r | grep "default via" | awk '{ print $3 }' | head -1 )
-IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
+IP="$(get_ip)"
echo "IP|$IP"
echo "gateway|$GW"