From 037ca7330fe0c05e91291e155a1a647117033c2b Mon Sep 17 00:00:00 2001 From: Kuzz007 Date: Mon, 27 Jul 2026 14:33:32 +0300 Subject: [PATCH] fix(install): make AmneziaWG the default, opt-out instead of opt-in AmneziaWG is this fork's whole reason for existing, so requiring an explicit flag/prompt answer to actually get it on every fresh install, migration, or update was the wrong default -- confirmed today by a real migration where it silently stayed uninstalled (interactive default was "no", and non-interactive/unattended installs skipped it outright with nothing to answer the prompt). should_install_amneziawg now defaults to yes in both the interactive prompt and the non-interactive/unattended path; XUI_INSTALL_AMNEZIAWG still works as an explicit override in either direction (true/false), so anyone who genuinely doesn't want the DKMS module + host-wide IP forwarding can still opt out. Also fixed the printed opt-out hint to show the actual working syntax for setting the variable before a later re-run -- `VAR=val curl ... | bash` only exports VAR into curl's environment, not bash's, since they're separate processes joined by a pipe. Hit this exact gotcha live: XUI_INSTALL_AMNEZIAWG=true prefixed onto the curl command was silently ignored. Co-Authored-By: Claude Sonnet 5 --- install.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 4793bbd4c..d9a63d214 100644 --- a/install.sh +++ b/install.sh @@ -212,27 +212,28 @@ enable_tproxy_support() { # interface. Best-effort and never fatal to the overall x-ui install: the # panel works fine without it, an AmneziaWG inbound just won't start its # tunnel until the module is installed (surfaced in the panel/logs, not here). -# AmneziaWG is opt-in (see should_install_amneziawg below): installing it -# unconditionally for every user would mean building/loading a DKMS kernel -# module and enabling host-wide IPv4/IPv6 forwarding on every panel install, -# whether or not that install ever uses the protocol. +# AmneziaWG is this fork's signature feature, so it installs by default on +# every install/migration/update (see should_install_amneziawg below) -- +# opt-out, not opt-in, via XUI_INSTALL_AMNEZIAWG=false for anyone who +# specifically doesn't want the DKMS kernel module + host-wide IPv4/IPv6 +# forwarding it brings. # # should_install_amneziawg decides whether to run install_amneziawg at all. # XUI_INSTALL_AMNEZIAWG=true/false answers it outright (for non-interactive/ -# cloud-init runs); otherwise an interactive install prompts (default: no), -# and a non-interactive one defaults to skipping it -- opt-in stays opt-in -# even when nothing is there to answer the prompt. +# cloud-init runs); otherwise an interactive install prompts (default: yes), +# and a non-interactive one with nothing to answer the prompt defaults to +# installing it too. should_install_amneziawg() { case "${XUI_INSTALL_AMNEZIAWG:-}" in true | TRUE | 1 | yes | y | Y) return 0 ;; false | FALSE | 0 | no | n | N) return 1 ;; esac if [[ "$NONINTERACTIVE" == "1" ]]; then - return 1 + return 0 fi local reply - read -rp "Install native AmneziaWG support (WireGuard + DPI-resistant obfuscation)? This builds a DKMS kernel module and enables host-wide IP forwarding. (y/N): " reply - [[ "$reply" == "y" || "$reply" == "Y" ]] + read -rp "Install native AmneziaWG support (WireGuard + DPI-resistant obfuscation)? This builds a DKMS kernel module and enables host-wide IP forwarding. (Y/n): " reply + [[ -z "$reply" || "$reply" == "y" || "$reply" == "Y" ]] } # ppa:amnezia/ppa (Ubuntu/Debian/Armbian) is the primary, tested path; other @@ -1930,8 +1931,12 @@ install_base if should_install_amneziawg; then install_amneziawg else - echo -e "${yellow}Skipping AmneziaWG setup. Opt in later by re-running install.sh with XUI_INSTALL_AMNEZIAWG=true, or install it manually:${plain}" - echo -e "${yellow} https://github.com/amnezia-vpn/amneziawg-linux-kernel-module${plain}" + echo -e "${yellow}Skipping AmneziaWG setup. To install it later, re-run with the variable${plain}" + echo -e "${yellow}exported first (a piped 'VAR=val curl ... | bash' only sets it for curl,${plain}" + echo -e "${yellow}not for bash -- export it in the current shell instead):${plain}" + echo -e "${yellow} export XUI_INSTALL_AMNEZIAWG=true${plain}" + echo -e "${yellow} curl -fsSL https://raw.githubusercontent.com/Kuzz007/3x-ui/main/install.sh | bash${plain}" + echo -e "${yellow}...or install it manually: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module${plain}" fi install_x-ui $1