From 9dfb6b410fc9e05446085171117f538e22774728 Mon Sep 17 00:00:00 2001 From: yanistyle Date: Mon, 22 Sep 2025 13:17:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20install.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 88 +++++++++++++++++------------------------------------- 1 file changed, 27 insertions(+), 61 deletions(-) diff --git a/install.sh b/install.sh index d963958..72f9473 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/sh -REPO_API="https://git.ownsrv.ru/api/v1/repos/yanistyle/podkop/releases" +REPO="https://git.ownsrv.ru/yanistyle/podkop/releases/latest" DOWNLOAD_DIR="/tmp/podkop" COUNT=3 @@ -25,33 +25,28 @@ main() { msg "Installed podkop..." fi - # --- Получаем последний релиз из Gitea --- - LATEST_TAG=$(curl -s "$REPO_API" | jq -r '.[0].tag_name') - if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then - msg "Не удалось получить последний релиз" - exit 1 - fi - msg "Последний релиз: $LATEST_TAG" - - # --- Получаем список всех assets --- - ASSETS=$(curl -s "$REPO_API" | jq -r '.[0].assets[].name') - download_success=0 - for filename in $ASSETS; do + + # Берём страницу latest release и вытаскиваем все ссылки на .ipk + wget -qO- "$REPO" | grep -o 'https://[^"]*\.ipk' | while read -r url; do + filename=$(basename "$url") filepath="$DOWNLOAD_DIR/$filename" + attempt=0 while [ $attempt -lt $COUNT ]; do - msg "Download $filename (count $((attempt+1)))..." - wget -q -O "$filepath" "https://git.ownsrv.ru/yanistyle/podkop/releases/download/$LATEST_TAG/$filename" - if [ -s "$filepath" ]; then - msg "$filename successfully downloaded" - download_success=1 - break + msg "Download $filename (attempt $((attempt+1)))..." + if wget -q -O "$filepath" "$url"; then + if [ -s "$filepath" ]; then + msg "$filename successfully downloaded" + download_success=1 + break + fi fi msg "Download error $filename. Retry..." rm -f "$filepath" attempt=$((attempt+1)) done + if [ $attempt -eq $COUNT ]; then msg "Failed to download $filename after $COUNT attempts" fi @@ -62,7 +57,7 @@ main() { exit 1 fi - # --- Установка пакетов --- + # Установка пакетов for pkg in podkop luci-app-podkop; do file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1) if [ -n "$file" ]; then @@ -72,6 +67,7 @@ main() { fi done + # Русский перевод ru=$(ls "$DOWNLOAD_DIR" | grep "luci-i18n-podkop-ru" | head -n 1) if [ -n "$ru" ]; then if opkg list-installed | grep -q luci-i18n-podkop-ru; then @@ -79,84 +75,54 @@ main() { opkg remove luci-i18n-podkop* opkg install "$DOWNLOAD_DIR/$ru" else - msg "Русский язык интерфейса ставим? y/n (Need a Russian translation?)" - while true; do - read -r -p '' RUS - case $RUS in - y) - opkg remove luci-i18n-podkop* - opkg install "$DOWNLOAD_DIR/$ru" - break - ;; - n) - break - ;; - *) - echo "Введите y или n" - ;; - esac - done + msg "Installing Russian translation..." + opkg install "$DOWNLOAD_DIR/$ru" fi fi + # Очистка временной папки find "$DOWNLOAD_DIR" -type f -name '*podkop*' -exec rm {} \; } -# --- Проверка системы --- check_system() { + # Проверка модели роутера MODEL=$(cat /tmp/sysinfo/model) msg "Router model: $MODEL" + # Проверка версии OpenWrt openwrt_version=$(cat /etc/openwrt_release | grep DISTRIB_RELEASE | cut -d"'" -f2 | cut -d'.' -f1) if [ "$openwrt_version" = "23" ]; then msg "OpenWrt 23.05 не поддерживается начиная с podkop 0.5.0" exit 1 fi + # Проверка места AVAILABLE_SPACE=$(df /overlay | awk 'NR==2 {print $4}') REQUIRED_SPACE=15360 if [ "$AVAILABLE_SPACE" -lt "$REQUIRED_SPACE" ]; then - msg "Error: Insufficient space in flash" - msg "Available: $((AVAILABLE_SPACE/1024))MB" - msg "Required: $((REQUIRED_SPACE/1024))MB" + msg "Insufficient space in flash" exit 1 fi + # Проверка DNS if ! nslookup google.com >/dev/null 2>&1; then msg "DNS not working" exit 1 fi - - if opkg list-installed | grep -q https-dns-proxy; then - msg "Сonflicting package detected: https-dns-proxy. Remove?" - while true; do - read -r -p '' DNSPROXY - case $DNSPROXY in - yes|y|Y|yes) - opkg remove --force-depends luci-app-https-dns-proxy https-dns-proxy luci-i18n-https-dns-proxy* - break - ;; - *) - msg "Exit" - exit 1 - ;; - esac - done - fi } sing_box() { if ! opkg list-installed | grep -q "^sing-box"; then return fi + sing_box_version=$(sing-box version | head -n 1 | awk '{print $3}') required_version="1.12.4" + if [ "$(echo -e "$sing_box_version\n$required_version" | sort -V | head -n 1)" != "$required_version" ]; then - msg "sing-box version $sing_box_version is older than required $required_version" - msg "Removing old version..." + msg "Removing old sing-box version $sing_box_version..." opkg remove sing-box fi } main -