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.
This commit is contained in:
anonpenguin23 2025-10-31 08:42:07 +02:00
parent 624f92bf11
commit f561bc5311
2 changed files with 7 additions and 4 deletions

View File

@ -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)'

View File

@ -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