This commit is contained in:
Halbe Bruno
2025-12-05 19:40:39 -03:00
commit f37bc712e6
4312 changed files with 359196 additions and 0 deletions

47
agent/build.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
# Exit on error
set -e
echo "Iniciando processo de build do DNSBlock Agent..."
# Ensure we are in the agent directory
cd "$(dirname "$0")"
# Check if python3-venv is installed
if ! dpkg -s python3-venv >/dev/null 2>&1; then
echo "Instalando python3-venv..."
sudo apt-get update && sudo apt-get install -y python3-venv
fi
# Create/Activate Build Venv
if [ ! -d "build_venv" ]; then
echo "Criando ambiente virtual de build..."
python3 -m venv build_venv
fi
source build_venv/bin/activate
# Install dependencies
echo "Instalando dependências..."
pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
# Build
echo "Compilando binário..."
# --onefile: Create a single executable file
# --name: Name of the executable
# --clean: Clean PyInstaller cache
pyinstaller --onefile --name dnsblock-agent --clean main.py
# Organize Output
echo "Organizando saída..."
mkdir -p dist/
# PyInstaller puts the binary in dist/ by default, but let's ensure structure
# We might want to copy config.json.example there too for distribution
cp config.json.example dist/ 2>/dev/null || echo "Nota: config.json.example não encontrado para copiar."
echo "Build concluído com sucesso!"
echo "O binário está disponível em: agent/dist/dnsblock-agent"
echo "Para distribuir, compacte a pasta 'dist'."