feat: automate terms acceptance in Anon configuration and installation

- Added automatic acceptance of terms in the Anon configuration file to streamline the setup process.
- Updated the installation script to pre-accept terms, eliminating interactive prompts during installation.
- Enhanced output messages to reflect the auto-accepted terms for better user awareness.
This commit is contained in:
anonpenguin23 2025-10-31 08:24:32 +02:00
parent ede253afae
commit 472b7c10bb
2 changed files with 15 additions and 0 deletions

View File

@ -528,6 +528,10 @@ func configureAnonDefaults() {
if !strings.Contains(config, "SocksPort") {
config += "SocksPort 9050\n"
}
// Auto-accept terms to avoid interactive prompts
if !strings.Contains(config, "AgreeToTerms") {
config += "AgreeToTerms 1\n"
}
// Write back
os.WriteFile(anonrcPath, []byte(config), 0644)
@ -536,6 +540,7 @@ func configureAnonDefaults() {
fmt.Printf(" ORPort: 9001 (default)\n")
fmt.Printf(" ControlPort: 9051\n")
fmt.Printf(" SOCKSPort: 9050\n")
fmt.Printf(" AgreeToTerms: 1 (auto-accepted)\n")
}
}

View File

@ -223,6 +223,10 @@ install_anon() {
# Add repository
echo "deb [signed-by=/usr/share/keyrings/anyone-archive-keyring.gpg] https://deb.anyone.io/ anyone main" | sudo tee /etc/apt/sources.list.d/anyone.list >/dev/null
# Preseed terms acceptance to avoid interactive prompt
log "Pre-accepting Anon terms and conditions..."
echo "anon anon/terms boolean true" | sudo debconf-set-selections
# Update and install
log "Installing Anon package..."
sudo apt update -qq
@ -285,10 +289,16 @@ configure_anon_defaults() {
echo "SocksPort 9050" | sudo tee -a /etc/anon/anonrc >/dev/null
fi
# Auto-accept terms in config file
if ! grep -q "^AgreeToTerms" /etc/anon/anonrc; then
echo "AgreeToTerms 1" | sudo tee -a /etc/anon/anonrc >/dev/null
fi
log " Nickname: ${HOSTNAME}"
log " ORPort: 9001 (default)"
log " ControlPort: 9051"
log " SOCKSPort: 9050"
log " AgreeToTerms: 1 (auto-accepted)"
fi
}