netgescon-master/scripts/Script fatti per prova e per ora sospesi/setup.sh

80 lines
2.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# setup.sh - Script di installazione e preparazione ambiente netgescon
# Crea la struttura base delle cartelle, copia gli script e il file di configurazione.
# Installa le dipendenze principali: mdbtools, python3-venv, jq.
# Autore: Pikappa2 2025-05-27
set -e
BASE="$HOME/netgescon"
DIRS=(
"$BASE/scripts"
"$BASE/mdb_input"
"$BASE/estratti"
"$BASE/estratti/hash"
"$BASE/trasmissioni"
"$BASE/log"
)
echo "[INFO] Creo la struttura cartelle..."
for DIR in "${DIRS[@]}"; do
mkdir -p "$DIR"
echo "[OK] $DIR"
done
# Copia tutti gli script dalla cartella scripts/ locale, se esiste
if [ -d "./scripts" ]; then
cp ./scripts/* "$BASE/scripts/"
chmod +x "$BASE/scripts/"*
echo "[INFO] Copiati tutti gli script nella cartella $BASE/scripts/"
fi
# Copia tutti gli script .sh e .py dalla directory corrente (se non già in ./scripts)
for f in ./*.sh ./*.py; do
[ -e "$f" ] || continue
cp "$f" "$BASE/scripts/"
chmod +x "$BASE/scripts/$(basename "$f")"
echo "[INFO] Copiato script $(basename "$f") in $BASE/scripts/"
done
# Copia agent_config.json se presente nella directory corrente nella cartella principale
if [ -f "./agent_config.json" ]; then
cp ./agent_config.json "$BASE/agent_config.json"
echo "[INFO] Copiato agent_config.json in $BASE/"
else
echo "[ATTENZIONE] agent_config.json non trovato nella directory attuale!"
fi
# Opzionale: Copia README e SPECIFICHE-AGENTE.md se presenti
if [ -f "./README.md" ]; then
cp ./README.md "$BASE/README.md"
echo "[INFO] Copiato README.md"
fi
if [ -f "./SPECIFICHE-AGENTE.md" ]; then
cp ./SPECIFICHE-AGENTE.md "$BASE/SPECIFICHE-AGENTE.md"
echo "[INFO] Copiato SPECIFICHE-AGENTE.md"
fi
# Installazione dipendenze
echo
read -p "Vuoi installare mdbtools, python3-venv e jq (richiede sudo)? [y/N] " INST
if [[ "$INST" == "y" || "$INST" == "Y" ]]; then
echo "[INFO] Aggiorno lista pacchetti..."
sudo apt-get update
echo "[INFO] Installo mdbtools, python3-venv e jq..."
sudo apt-get install -y mdbtools python3-venv jq
echo "[OK] Dipendenze installate."
else
echo "[INFO] Installazione dipendenze saltata."
echo "Assicurati di avere installato: mdbtools, python3-venv, jq"
fi
echo
echo "[SETUP COMPLETATO] Ambiente pronto in $BASE"
echo "---------------------------------------------"
echo "Cosa puoi fare ora:"
echo "- Metti i file MDB originali in: $BASE/mdb_input/"
echo "- Esegui i tuoi script da: $BASE/scripts/"
echo "- Configura agent_config.json in: $BASE/agent_config.json"
echo "- Consulta i log in: $BASE/log/"
echo "---------------------------------------------"