diff --git a/Zapret-Manager.sh b/Zapret-Manager.sh index c9fba72..4272d45 100644 --- a/Zapret-Manager.sh +++ b/Zapret-Manager.sh @@ -124,43 +124,37 @@ DELETE="opkg remove"; ARCH="$(opkg print-architecture | awk '{print $2}' | tail RAZ="ipk"; TMP_FILE_GO="/tmp/tg-ws-proxy.ipk"; else PKG="apk"; GO_SUF="r1"; CONFZ="/etc/apk/repositories.d/distfeeds.list"; PKG_IS_APK=1; SPL_SUF="noarch"; RELEASE_TAG="v${BYEDPI_LATEST_VER}-25.12" UPDATE="apk update"; INSTALL="apk add --allow-untrusted"; DELETE="apk del"; ARCH="$(apk --print-arch 2>/dev/null)"; RAZ="apk"; VER_SUF="r1"; SUF_MT="r"; TMP_FILE_GO="/tmp/tg-ws-proxy.apk"; fi -MIRROR="" -CURRENT_MIRROR=$(head -n1 "$CONFZ" | awk '{print $NF}' | sed 's|https://||;s|/releases/.*||') - -if grep -qE 'mirror-03\.infra\.openwrt\.org|ftp\.snt\.utwente\.nl/pub/software/openwrt|mirror\.berlin\.freifunk\.net/downloads\.openwrt|mirror\.sjtu\.edu\.cn/openwrt|ftp\.halifax\.rwth-aachen\.de/openwrt|mirror\.accum\.se/mirror/openwrt|downloads\.openwrt\.org' "$CONFZ"; then - echo -e "${CYAN}Проверяем доступность ${NC}$CURRENT_MIRROR" - - if ! wget -q --spider --timeout=2 "https://$CURRENT_MIRROR/releases/" >/dev/null 2>&1; then - echo -e "$CURRENT_MIRROR ${RED}недоступен!${NC}" - echo -e "${CYAN}Подбираем зеркало ${NC}OpenWRT" - - if wget -q --spider --timeout=3 "https://mirror-03.infra.openwrt.org" >/dev/null 2>&1; then - MIRROR="mirror-03.infra.openwrt.org" - elif wget -q --spider --timeout=3 "https://ftp.halifax.rwth-aachen.de/openwrt/releases/" >/dev/null 2>&1; then - MIRROR="ftp.halifax.rwth-aachen.de/openwrt" - elif wget -q --spider --timeout=3 "https://mirror.accum.se/mirror/openwrt.org/releases/" >/dev/null 2>&1; then - MIRROR="mirror.accum.se/mirror/openwrt.org" - - elif wget -q --spider --timeout=3 "https://ftp.snt.utwente.nl/pub/software/openwrt/releases/" >/dev/null 2>&1; then - MIRROR="ftp.snt.utwente.nl/pub/software/openwrt" - elif wget -q --spider --timeout=3 "https://mirror.berlin.freifunk.net/downloads.openwrt/releases/" >/dev/null 2>&1; then - MIRROR="mirror.berlin.freifunk.net/downloads.openwrt" - elif wget -q --spider --timeout=3 "https://mirror.sjtu.edu.cn/openwrt/releases/" >/dev/null 2>&1; then - MIRROR="mirror.sjtu.edu.cn/openwrt" - elif wget -q --spider --timeout=3 "https://downloads.openwrt.org/releases/" >/dev/null 2>&1; then - MIRROR="downloads.openwrt.org" - fi - - if [ -n "$MIRROR" ]; then - echo -e "${CYAN}Переключаемся на ${NC}$MIRROR" - sed -i "s|https://.*/releases/|https://$MIRROR/releases/|g" "$CONFZ" - else - echo -e "${RED}Резервные зеркала недоступны!${NC}" - fi - else - echo -e "$CURRENT_MIRROR ${GREEN}доступен!${NC}" - fi -fi +# MIRROR=""; CURRENT_MIRROR=$(head -n1 "$CONFZ" | awk '{print $NF}' | sed 's|https://||;s|/releases/.*||') +# if grep -qE 'mirror-03\.infra\.openwrt\.org|ftp\.snt\.utwente\.nl/pub/software/openwrt|mirror\.berlin\.freifunk\.net/downloads\.openwrt|mirror\.sjtu\.edu\.cn/openwrt|ftp\.halifax\.rwth-aachen\.de/openwrt|mirror\.accum\.se/mirror/openwrt|downloads\.openwrt\.org' "$CONFZ"; then +# echo -e "${CYAN}Проверяем доступность ${NC}$CURRENT_MIRROR" +# if ! wget -q --spider --timeout=2 "https://$CURRENT_MIRROR/releases/" >/dev/null 2>&1; then +# echo -e "$CURRENT_MIRROR ${RED}недоступен!${NC}" +# echo -e "${CYAN}Подбираем зеркало ${NC}OpenWRT" +# if wget -q --spider --timeout=3 "https://mirror-03.infra.openwrt.org" >/dev/null 2>&1; then +# MIRROR="mirror-03.infra.openwrt.org" +# elif wget -q --spider --timeout=3 "https://ftp.halifax.rwth-aachen.de/openwrt/releases/" >/dev/null 2>&1; then +# MIRROR="ftp.halifax.rwth-aachen.de/openwrt" +# elif wget -q --spider --timeout=3 "https://mirror.accum.se/mirror/openwrt.org/releases/" >/dev/null 2>&1; then +# MIRROR="mirror.accum.se/mirror/openwrt.org" +# elif wget -q --spider --timeout=3 "https://ftp.snt.utwente.nl/pub/software/openwrt/releases/" >/dev/null 2>&1; then +# MIRROR="ftp.snt.utwente.nl/pub/software/openwrt" +# elif wget -q --spider --timeout=3 "https://mirror.berlin.freifunk.net/downloads.openwrt/releases/" >/dev/null 2>&1; then +# MIRROR="mirror.berlin.freifunk.net/downloads.openwrt" +# elif wget -q --spider --timeout=3 "https://mirror.sjtu.edu.cn/openwrt/releases/" >/dev/null 2>&1; then +# MIRROR="mirror.sjtu.edu.cn/openwrt" +# elif wget -q --spider --timeout=3 "https://downloads.openwrt.org/releases/" >/dev/null 2>&1; then +# MIRROR="downloads.openwrt.org" +# fi +# if [ -n "$MIRROR" ]; then +# echo -e "${CYAN}Переключаемся на ${NC}$MIRROR" +# sed -i "s|https://.*/releases/|https://$MIRROR/releases/|g" "$CONFZ" +# else +# echo -e "${RED}Резервные зеркала недоступны!${NC}" +# fi +# else +# echo -e "$CURRENT_MIRROR ${GREEN}доступен!${NC}" +# fi +# fi update_packages(){ [ "$PACKAGES_UPDATED" = "1" ] && return 0; echo -e "${CYAN}Обновляем список пакетов${NC}"; $UPDATE >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка обновления списка пакетов!${NC}\n"; PAUSE; return 1; }; PACKAGES_UPDATED=1; }