fix определения акрхитектуры
This commit is contained in:
1 parent
db4ad2bc98
commit
f771f0adcb
1 file changed
+8
-8
+8
-8
@@ -535,18 +535,18 @@ echo -en "\n${YELLOW}Выберите зеркало: ${NC}"; read -r z; case "$
|
||||
# ==========================================
|
||||
# TG WS Proxy Go
|
||||
# ==========================================
|
||||
get_arch() { if command -v opkg >/dev/null 2>&1; then ARCH="$(opkg print-architecture | awk '{print $2}' | tail -n1)"; elif command -v apk >/dev/null 2>&1; then ARCH="$(apk --print-arch 2>/dev/null)"; fi; case "$ARCH" in aarch64) echo "tg-ws-proxy-openwrt-aarch64";;
|
||||
armv7*|armhf|armv7l) echo "tg-ws-proxy-openwrt-armv7";; mipsel_24kc|mipsel) echo "tg-ws-proxy-openwrt-mipsel_24kc";; mips_24kc|mips) echo "tg-ws-proxy-openwrt-mips_24kc";; x86_64) echo "tg-ws-proxy-openwrt-x86_64";; *) echo "Неизвестная архитектура: $ARCH"; return 1;; esac; }
|
||||
get_arch() { if command -v opkg >/dev/null 2>&1; then ARCH="$(opkg print-architecture | awk '{print $2}' | tail -n1)"; elif command -v apk >/dev/null 2>&1; then ARCH="$(apk --print-arch 2>/dev/null)"; fi; case "$ARCH" in aarch64*) echo "tg-ws-proxy-openwrt-aarch64";;
|
||||
armv7*|armhf|armv7l) echo "tg-ws-proxy-openwrt-armv7";; mipsel_24kc|mipsel*) echo "tg-ws-proxy-openwrt-mipsel_24kc";; mips_24kc|mips*) echo "tg-ws-proxy-openwrt-mips_24kc";; x86_64) echo "tg-ws-proxy-openwrt-x86_64";; *) echo "Неизвестная архитектура: $ARCH"; return 1;; esac; }
|
||||
remove_TG() { echo -e "\n${MAGENTA}Удаляем TG WS Proxy Go${NC}"; /etc/init.d/tg-ws-proxy-go stop >/dev/null 2>&1; /etc/init.d/tg-ws-proxy-go disable >/dev/null 2>&1; rm -f "$BIN_PATH"; rm -f "$INIT_PATH"; echo -e "TG WS Proxy Go ${GREEN}удалён!\n${NC}"; }
|
||||
install_TG() { echo -e "\n${MAGENTA}Установка TG WS Proxy Go${NC}"; ARCH_FILE="$(get_arch)" || { echo -e "\n${RED}Неизвестная архитектура:${NC} $(uname -m)"; exit 1; }; echo -e "${CYAN}Скачиваем и устанавливаем${NC} $ARCH_FILE";
|
||||
LATEST_TAG="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com/d0mhate/-tg-ws-proxy-Manager-go/releases/latest | sed 's#.*/tag/##')"; DOWNLOAD_URL="https://github.com/d0mhate/-tg-ws-proxy-Manager-go/releases/download/$LATEST_TAG/$ARCH_FILE";
|
||||
curl -L --fail -o "$BIN_PATH" "$DOWNLOAD_URL" >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка скачивания${NC}"; exit 1; }; chmod +x "$BIN_PATH"
|
||||
install_TG() { echo -e "\n${MAGENTA}Установка TG WS Proxy Go${NC}"; ARCH_FILE="$(get_arch)" || { echo -e "\n${RED}Архитектура не поддерживается:${NC} $(uname -m)"; PAUSE; return 1; };
|
||||
if ! command -v curl >/dev/null 2>&1; then echo -e "${CYAN}Устанавливаем ${NC}curl"; if command -v opkg >/dev/null 2>&1; then opkg update >/dev/null 2>&1 && opkg install curl >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка установки curl${NC}"; PAUSE; return 1; }
|
||||
elif command -v apk >/dev/null 2>&1; then apk update >/dev/null 2>&1 && apk add curl >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка установки curl${NC}"; PAUSE; return 1; }; fi; fi; echo -e "${CYAN}Скачиваем и устанавливаем${NC} $ARCH_FILE";
|
||||
LATEST_TAG="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com/d0mhate/-tg-ws-proxy-Manager-go/releases/latest | sed 's#.*/tag/##')"; [ -z "$LATEST_TAG" ] && { echo -e "\n${RED}Не удалось получить версию${NC} TG WS Proxy Go"; PAUSE; return 1; }
|
||||
DOWNLOAD_URL="https://github.com/d0mhate/-tg-ws-proxy-Manager-go/releases/download/$LATEST_TAG/$ARCH_FILE"; curl -L --fail -o "$BIN_PATH" "$DOWNLOAD_URL" >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка скачивания${NC}"; PAUSE; return 1; }; chmod +x "$BIN_PATH"
|
||||
printf '%s\n' '#!/bin/sh /etc/rc.common' 'START=99' 'USE_PROCD=1' 'start_service() { procd_open_instance; procd_set_param command /usr/bin/tg-ws-proxy-go --host 0.0.0.0 --port 1080; procd_set_param respawn; procd_set_param stdout /dev/null; procd_set_param stderr /dev/null; procd_close_instance; }' > "$INIT_PATH"
|
||||
chmod +x "$INIT_PATH"; /etc/init.d/tg-ws-proxy-go enable; /etc/init.d/tg-ws-proxy-go start; if pidof tg-ws-proxy-go >/dev/null 2>&1; then echo -e "${GREEN}Сервис ${NC}TG WS Proxy Go${GREEN} запущен!${NC}"
|
||||
echo -e "\n${YELLOW}Настройки SOCKS5 в TG:${NC} ${NC}${LAN_IP}:1080\n"; else echo -e "\n${RED}Сервис TG WS Proxy Go не запущен!${NC}\n"; fi; }
|
||||
tg_GO() { if [ "$(df -m /root 2>/dev/null | awk 'NR==2 {print $4+0}')" -lt 5 ]; then echo -e "\n${RED}Недостаточно свободного места!${NC}"; PAUSE; return 1; fi
|
||||
if ! command -v curl >/dev/null 2>&1; then echo -e "${CYAN}Устанавливаем ${NC}curl"; if command -v opkg >/dev/null 2>&1; then opkg update >/dev/null 2>&1 && opkg install curl >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка установки curl${NC}"; exit 1; }
|
||||
elif command -v apk >/dev/null 2>&1; then apk update >/dev/null 2>&1 && apk add curl >/dev/null 2>&1 || { echo -e "\n${RED}Ошибка установки curl${NC}"; exit 1; }; fi; fi; if [ -f "$BIN_PATH" ] || [ -f "$INIT_PATH" ]; then remove_TG; PAUSE; else install_TG; PAUSE; fi; }
|
||||
tg_GO() { if [ "$(df -m /root 2>/dev/null | awk 'NR==2 {print $4+0}')" -lt 5 ]; then echo -e "\n${RED}Недостаточно свободного места!${NC}"; PAUSE; return 1; fi; if [ -f "$BIN_PATH" ] && [ -f "$INIT_PATH" ]; then remove_TG; PAUSE; else install_TG; PAUSE; fi; }
|
||||
# ==========================================
|
||||
# Главное меню
|
||||
# ==========================================
|
||||
|
||||
Reference in new issue
Block a user