Files
PFVCluster/netinfra/gather-configs.sh
T
mrcharles 0fa0692c37 chore: enforce shellcheck across the repo
Establish shellcheck as a mandatory pre-commit quality gate and bring all 93
shell scripts to a clean state.

- tests/shellcheck.sh: wrapper that runs koalaman/shellcheck:stable via Docker
  (no native binary needed), skips vendored + upstream librenms-agent scripts.
- .shellcheckrc: documents intentional codebase-wide disables (dynamic source
  paths SC1090/SC1091, client-side ssh expansion SC2029).
- AGENTS.md: new Git Policy rule mandating clean shellcheck for every shell
  script before commit.

Fixes applied (real bugs + quality): missing quote in netinfra/gather-configs.sh
(caused cascading parse errors), unquoted expansions, declare-and-assign masking,
egrep -> grep -E, $FUNCNAME array indexing, unused variable removal, cd || exit.
Intentional patterns (sourced config, sysfs/ps diagnostics, ssh heredocs that
expand local config) get justified targeted disables.

💘 Generated with Crush

Assisted-by: Crush:glm-5.2
2026-07-30 08:56:31 -05:00

55 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# gather-configs.sh — READ-ONLY. Pull Technitium configs, pihole.toml, gravity.db
# contents, and chrony NTP details from pfv-netboot for replication.
set -u
hdr() { printf '\n=== %s ===\n' "$1"; }
hdr "TECHNITIUM dns.config"
sudo cat /var/lib/docker/volumes/dns_tsys-dns-config/_data/dns.config 2>&1
hdr "TECHNITIUM auth.config"
sudo cat /var/lib/docker/volumes/dns_tsys-dns-config/_data/auth.config 2>&1
hdr "TECHNITIUM log.config"
sudo cat /var/lib/docker/volumes/dns_tsys-dns-config/_data/log.config 2>&1
hdr "TECHNITIUM scopes/Default.scope"
sudo cat /var/lib/docker/volumes/dns_tsys-dns-config/_data/scopes/Default.scope 2>&1
hdr "TECHNITIUM zone: knel.net.zone"
sudo cat /var/lib/docker/volumes/dns_tsys-dns-config/_data/zones/knel.net.zone 2>&1
hdr "TECHNITIUM all zone files listing + sizes"
sudo ls -la /var/lib/docker/volumes/dns_tsys-dns-config/_data/zones/ 2>&1
hdr "TECHNITIUM reverse zones (one sample)"
sudo cat /var/lib/docker/volumes/dns_tsys-dns-config/_data/zones/199.86.100.in-addr.arpa.zone 2>&1
hdr "TECHNITIUM top-level listing"
sudo ls -la /var/lib/docker/volumes/dns_tsys-dns-config/_data/ 2>&1
hdr "PI-HOLE pihole.toml (v6 config) from host bind mount"
cat /root/pihole/etc-pihole/pihole.toml 2>&1
hdr "PI-HOLE dnsmasq.conf"
cat /root/pihole/etc-pihole/dnsmasq.conf 2>&1
hdr "PI-HOLE versions file"
cat /root/pihole/etc-pihole/versions 2>&1
hdr "GRAVITY.DB contents (host sqlite3 if present)"
if command -v sqlite3 >/dev/null 2>&1; then
G=/root/pihole/etc-pihole/gravity.db
echo "-- adlist --"; sqlite3 -readonly "$G" "SELECT address,enabled,comment,DATE(date_added,'unixepoch'),DATE(date_updated,'unixepoch') FROM adlist;" 2>&1
echo "-- adlist count --"; sqlite3 -readonly "$G" "SELECT COUNT(*) FROM adlist;" 2>&1
echo "-- domainlist count by type --"; sqlite3 -readonly "$G" "SELECT type,COUNT(*) FROM domainlist GROUP BY type;" 2>&1
echo "-- domainlist (allow=0/allow_exact, deny=1/deny_exact, etc.) first 80 --"; sqlite3 -readonly "$G" "SELECT type,domain,enabled,comment FROM domainlist LIMIT 80;" 2>&1
echo "-- client --"; sqlite3 -readonly "$G" "SELECT ip,comment FROM client;" 2>&1
echo "-- group --"; sqlite3 -readonly "$G" "SELECT id,name,enabled,comment FROM 'group';" 2>&1
echo "-- info --"; sqlite3 -readonly "$G" "SELECT * FROM info;" 2>&1
else
echo "(sqlite3 not on host PATH)"
fi
hdr "DONE"