diff --git a/sys_info.sh b/sys_info.sh index e9533a9..64f1c0a 100644 --- a/sys_info.sh +++ b/sys_info.sh @@ -3,6 +3,10 @@ GREEN="\033[1;32m" RED="\033[1;31m" NC="\033[0m" CONF="/etc/config/zapret" +if ! command -v curl >/dev/null 2>&1; then +echo -e "${CYAN}Устанавливаем ${NC}curl" +opkg update >/dev/null 2>&1 && opkg install curl >/dev/null 2>&1 +fi echo -e "\n${GREEN}===== Информация о системе =====${NC}" MODEL=$(cat /tmp/sysinfo/model) ARCH=$(sed -n "s/.*ARCH='\(.*\)'/\1/p" /etc/openwrt_release) @@ -49,14 +53,14 @@ fi out="$out | FIX: ${dpi}" echo -e "$out" echo -e "\n${GREEN}===== Проверка GitHub =====${NC}" -RATE=$(wget -qO- -s https://api.github.com/rate_limit | grep '"remaining"' | head -1 | awk '{print $2}' | tr -d ,) +RATE=$(curl -s https://api.github.com/rate_limit | grep '"remaining"' | head -1 | awk '{print $2}' | tr -d ,) [ -z "$RATE" ] && RATE_OUT="${RED}N/A${NC}" || RATE_OUT=$([ "$RATE" -eq 0 ] && echo -e "${RED}0${NC}" || echo -e "${GREEN}$RATE${NC}") echo -n "IPv4: " -wget -4 --timeout=3 --server-response --spider https://github.com >/dev/null 2>&1 && echo -ne "${GREEN}ok${NC}" || echo -ne "${RED}fail${NC}" +curl -4 -Is --connect-timeout 3 https://github.com >/dev/null 2>&1 && echo -ne "${GREEN}ok${NC}" || echo -ne "${RED}fail${NC}" echo -n " IPv6: " -wget -6 --timeout=3 --server-response --spider https://github.com >/dev/null 2>&1 && echo -e "${GREEN}ok${NC}" || echo -e "${RED}fail${NC}" +curl -6 -Is --connect-timeout 3 https://github.com >/dev/null 2>&1 && echo -e "${GREEN}ok${NC}" || echo -e "${RED}fail${NC}" echo -n "API: " -wget --timeout=3 --server-response --spider https://api.github.com >/dev/null 2>&1 \ +curl -Is --connect-timeout 3 https://api.github.com >/dev/null 2>&1 \ && echo -e "${GREEN}ok${NC} Limit: $RATE_OUT" \ || echo -e "${RED}fail${NC} Limit: $RATE_OUT" echo -e "\n${GREEN}===== Настройки Zapret =====${NC}" @@ -135,13 +139,13 @@ right_idx=$((idx + half)) right=$(echo $sites_list | cut -d' ' -f$right_idx) left_pad=$(printf "%-25s" "$left") right_pad=$(printf "%-25s" "$right") -if wget --timeout=4 --server-response --spider "https://$left" >/dev/null 2>&1; then +if curl -Is --connect-timeout 3 --max-time 4 "https://$left" >/dev/null 2>&1; then left_color="[${GREEN}OK${NC}] " else left_color="[${RED}FAIL${NC}]" fi if [ -n "$right" ]; then -if wget --timeout=4 --server-response --spider "https://$right" >/dev/null 2>&1; then +if curl -Is --connect-timeout 3 --max-time 4 "https://$right" >/dev/null 2>&1; then right_color="[${GREEN}OK${NC}] " else right_color="[${RED}FAIL${NC}]"