优化国家判断方式
This commit is contained in:
@@ -27,11 +27,12 @@ TARGET="/tmp/prometheus-3.9.1.linux-amd64.tar.gz"
|
||||
is_cn=false
|
||||
|
||||
echo "Detecting geographic location..."
|
||||
COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [ "$COUNTRY" = "China" ]; then
|
||||
COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true)
|
||||
if [ "$COUNTRY" = "CN" ]; then
|
||||
is_cn=true
|
||||
fi
|
||||
|
||||
|
||||
if [ "$is_cn" = true ]; then
|
||||
echo "Geolocation: China mainland detected"
|
||||
DOWNLOAD_URL="$CN_URL"
|
||||
|
||||
@@ -24,11 +24,12 @@ TARGET=/tmp/cAdvisor
|
||||
is_cn=false
|
||||
|
||||
echo "Detecting geographic location..."
|
||||
COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [ "$COUNTRY" = "China" ]; then
|
||||
COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true)
|
||||
if [ "$COUNTRY" = "CN" ]; then
|
||||
is_cn=true
|
||||
fi
|
||||
|
||||
|
||||
if [ "$is_cn" = true ]; then
|
||||
echo "Geolocation: China mainland detected"
|
||||
DOWNLOAD_URL="$CN_URL"
|
||||
|
||||
@@ -27,11 +27,12 @@ TARGET="/tmp/mysqld_exporter-0.18.0.linux-amd64.tar.gz"
|
||||
is_cn=false
|
||||
|
||||
echo "Detecting geographic location..."
|
||||
COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [ "$COUNTRY" = "China" ]; then
|
||||
COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true)
|
||||
if [ "$COUNTRY" = "CN" ]; then
|
||||
is_cn=true
|
||||
fi
|
||||
|
||||
|
||||
if [ "$is_cn" = true ]; then
|
||||
echo "Geolocation: China mainland detected"
|
||||
DOWNLOAD_URL="$CN_URL"
|
||||
|
||||
@@ -27,11 +27,12 @@ TARGET="/tmp/node_exporter.tar.gz"
|
||||
is_cn=false
|
||||
|
||||
echo "Detecting geographic location..."
|
||||
COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [ "$COUNTRY" = "China" ]; then
|
||||
COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true)
|
||||
if [ "$COUNTRY" = "CN" ]; then
|
||||
is_cn=true
|
||||
fi
|
||||
|
||||
|
||||
if [ "$is_cn" = true ]; then
|
||||
echo "Geolocation: China mainland detected"
|
||||
DOWNLOAD_URL="$CN_URL"
|
||||
|
||||
@@ -27,11 +27,12 @@ TARGET="/tmp/node_exporter.tar.gz"
|
||||
is_cn=false
|
||||
|
||||
echo "Detecting geographic location..."
|
||||
COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [ "$COUNTRY" = "China" ]; then
|
||||
COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true)
|
||||
if [ "$COUNTRY" = "CN" ]; then
|
||||
is_cn=true
|
||||
fi
|
||||
|
||||
|
||||
if [ "$is_cn" = true ]; then
|
||||
echo "Geolocation: China mainland detected"
|
||||
DOWNLOAD_URL="$CN_URL"
|
||||
|
||||
Reference in New Issue
Block a user