Răsfoiți Sursa

fix(details): catch error should ifconfig.co fail (#2704)

Daniel Gibbs 6 ani în urmă
părinte
comite
0af1f5ed47
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      lgsm/functions/info_distro.sh

+ 9 - 1
lgsm/functions/info_distro.sh

@@ -232,7 +232,15 @@ if [ -z "${extip}" ]; then
 	exitcode=$?
 	# Should ifconfig.co return an error will use last known IP.
 	if [ ${exitcode} -eq 0 ]; then
-		echo -e "${extip}" > "${tmpdir}/extip.txt"
+		if [[ "${extip}" != *"DOCTYPE"* ]]; then
+			echo -e "${extip}" > "${tmpdir}/extip.txt"
+		else
+			if [ -f "${tmpdir}/extip.txt" ]; then
+				extip=$(cat "${tmpdir}/extip.txt")
+			else
+				echo -e "x.x.x.x"
+			fi
+		fi
 	else
 		if [ -f "${tmpdir}/extip.txt" ]; then
 			extip=$(cat "${tmpdir}/extip.txt")