From f561bc5311fed299ff3c3de8c290bf57f08ed5b2 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Fri, 31 Oct 2025 08:42:07 +0200 Subject: [PATCH] refactor: improve Anon installation script for terms acceptance - Updated the installation process to rely on debconf preseed and file-based acceptance methods, reducing the need for interactive prompts. - Limited the number of "yes" responses piped during installation to enhance reliability and prevent infinite loops. - Streamlined the command execution for fetching and running the installation script from GitHub. --- Makefile | 2 +- pkg/cli/setup.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e36b820..5240288 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test-e2e: .PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports -VERSION := 0.52.20 +VERSION := 0.52.21 COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' diff --git a/pkg/cli/setup.go b/pkg/cli/setup.go index 5ea8175..e1a2cc8 100644 --- a/pkg/cli/setup.go +++ b/pkg/cli/setup.go @@ -469,11 +469,14 @@ func installAnon() { } // Use the official installation script from GitHub - // Pipe "yes" repeatedly to automatically accept terms prompt + // Rely on debconf preseed and file-based acceptance methods + // If prompts still appear, pipe a few "yes" responses (not infinite) installScriptURL := "https://raw.githubusercontent.com/anyone-protocol/anon-install/refs/heads/main/install.sh" - // Use yes command to pipe multiple "yes" responses if needed - cmd := exec.Command("sh", "-c", fmt.Sprintf("curl -fsSL %s | (yes yes | bash)", installScriptURL)) + // Pipe multiple "yes" responses (but limited) in case of multiple prompts + yesResponses := strings.Repeat("yes\n", 10) // 10 "yes" responses should be enough + cmd := exec.Command("sh", "-c", fmt.Sprintf("curl -fsSL %s | bash", installScriptURL)) cmd.Env = append(os.Environ(), "DEBIAN_FRONTEND=noninteractive") + cmd.Stdin = strings.NewReader(yesResponses) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr