From 38ef5c7b337fca9cc00e25ae76dc9aa9409864fa Mon Sep 17 00:00:00 2001 From: yanistyle Date: Sun, 11 Oct 2026 23:15: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 | 76 +++++++----------------------------------------------- 1 file changed, 9 insertions(+), 67 deletions(-) diff --git a/install.sh b/install.sh index 6bec98d..f36f220 100644 --- a/install.sh +++ b/install.sh @@ -64,59 +64,6 @@ pkg_install() { fi } -# Установка podkop без подтягивания sing-box из репозитория OpenWrt -# (podkop зависит от sing-box, поэтому обычная установка скачает стоковый). -# Остальные зависимости ставятся отдельно через pkg_install_feed. -pkg_install_nodeps() { - local pkg_file="$1" - - if [ "$PKG_IS_APK" -eq 1 ]; then - # apk не умеет пропускать зависимости: создаём пустой пакет-заглушку - # sing-box, чтобы зависимость podkop считалась выполненной - apk_stub_singbox - apk add --allow-untrusted "$pkg_file" - else - opkg install --nodeps "$pkg_file" - fi -} - -# apk: пустой пакет "sing-box" (без файлов), чтобы apk не скачивал стоковый -# sing-box из репозитория. Сам бинарник ставится отдельным скриптом. -# Если создать заглушку не удалось, будет установлен стоковый sing-box. -apk_stub_singbox() { - if apk list --installed 2>/dev/null | grep -q "^sing-box-[0-9]"; then - return 0 - fi - - local stub_dir="/tmp/sing-box-stub" - rm -rf "$stub_dir" - mkdir -p "$stub_dir/root" - - if apk mkpkg \ - -I name:sing-box \ - -I version:1.14.0-r0 \ - -I arch:noarch \ - -I "description:Stub package, sing-box is installed manually" \ - -F "$stub_dir/root" \ - -o "$stub_dir/sing-box-stub.apk" >/dev/null 2>&1 \ - && apk add --allow-untrusted "$stub_dir/sing-box-stub.apk"; then - msg "Created sing-box stub package (stock sing-box will not be installed)" - else - msg "Could not create sing-box stub: stock sing-box will be installed as a dependency" - fi - - rm -rf "$stub_dir" -} - -# Установка пакетов из репозитория OpenWrt по имени -pkg_install_feed() { - if [ "$PKG_IS_APK" -eq 1 ]; then - apk add "$@" - else - opkg install "$@" - fi -} - update_config() { printf "\033[48;5;196m\033[1m╔══════════════════════════════════════════════════════════════════════╗\033[0m\n" printf "\033[48;5;196m\033[1m║ ! Обнаружена старая версия podkop. ║\033[0m\n" @@ -157,6 +104,13 @@ update_config() { } ask_sing_box() { + if pkg_is_installed "^sing-box"; then + msg "sing-box уже установлен, будет проверена версия и обновлён при необходимости" + msg "(sing-box is already installed, version will be checked and updated if needed)" + INSTALL_SINGBOX=1 + return + fi + msg "Установить sing-box? y/n (Install sing-box?)" while true; do read -r -p '' SINGBOX_ANSWER @@ -252,14 +206,6 @@ main() { exit 1 fi - # Если sing-box ставить не нужно (opkg): ставим зависимости podkop из - # репозитория OpenWrt вручную, а сам podkop - с --nodeps, чтобы opkg - # не скачивал стоковый sing-box как зависимость - if [ "$INSTALL_SINGBOX" -eq 0 ] && [ "$PKG_IS_APK" -eq 0 ]; then - msg "Installing podkop dependencies (without sing-box)..." - pkg_install_feed curl jq kmod-nft-tproxy coreutils-base64 bind-dig - fi - # Install podkop and luci-app-podkop for pkg in podkop luci-app-podkop; do file="" @@ -271,11 +217,7 @@ main() { done if [ -n "$file" ]; then msg "Installing $file..." - if [ "$INSTALL_SINGBOX" -eq 0 ]; then - pkg_install_nodeps "$DOWNLOAD_DIR/$file" - else - pkg_install "$DOWNLOAD_DIR/$file" - fi + pkg_install "$DOWNLOAD_DIR/$file" sleep 3 fi done @@ -426,4 +368,4 @@ sing_box() { fi } -main \ No newline at end of file +main