Files
computer-playbook/scripts/system/network/dns/setup/linux.sh
T
kevinveenbirkenbachandClaude Opus 5 f2fedfc677 Merge branch 'main' into feature/store-i18n
Fourteen real conflicts plus the 66 generated READMEs.

utils/cache/files.py and its test: both sides added a skip-dir rule, resolved
as a union so the root `build/` prune and the per-root walk key coexist.

plugins/lookup/database.py and postgres_libraries.py: main's added lookups kept,
with get_entity_name renamed to entity_name as this branch renamed it.

roles/web-app-{mailu,matrix}/meta/services.yml: main's `covers: [email]` and its
MAIL_PROVIDER-gated email entry, plus this branch's gitlab/jira/n8n/jitsi
consumers, which the merge base carried on neither side.

group_vars/all/17_resource.yml: this branch's lookup('resource', ...) refactor;
main's single added literal is already covered by _POSTGRES_MAX_LOCKS_PER_TRANSACTION.

docs/requirements/035-mcp-proxy-expansion.md: this branch moved the design into
ADR 0003, so the requirement keeps only the user story and the criteria. Main's
delta inside the moved block was two new roles, carried into the ADR audit:
web-app-stalwart as adapter_candidate, svc-net-tor-smtp as privileged_control_plane.
The no_surface total said 99 while its own subcategories summed to 112.

inventories/development/default.yml: biber keeps no explicit email. Both sides fixed
the same CI failure; this branch fixed it in _apply_account_defaults, which renders
biber@{{ DOMAIN_PRIMARY }} (utils/cache/users/__init__.py:68) — byte-identical to
the address main hardcoded, so the inventory line is a second copy of one fact.

roles/web-app-{gitlab,keycloak}/files/playwright/playwright.spec.js and
roles/web-app-gitlab/templates/playwright.env.j2: union of both import sets, with
requireDotenvValue kept over decodeDotenvQuotedValue for CANONICAL_DOMAIN because
an empty value must fail rather than match every substring.

The 66 role READMEs take this side: aceb5295ef moved Cosmos, Quick Setup and
Credits to the documentation build, and test_readme.py now rejects them in a
committed README. Main's prose edits inside them are carried over by hand (the
Mailu deprecation banner, Mailu -> Stalwart in erpnext and zammad), and the two
READMEs main added fresh are stripped of the three generated sections.
roles/web-app-sphinx/README.md stays deleted; 6eb9a59d14 merged that role into
web-app-docs. The root README's generated role table was regenerated from the
merged metadata.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-04 01:57:17 +02:00

118 lines
3.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=scripts/system/network/dns/common.sh
source "${SCRIPT_DIR}/../common.sh"
echo ">>> Setting up local DNS for *.${DNS_DOMAIN} -> 127.0.0.1"
configure_via_hosts_file() {
echo ">>> Non-systemd environment detected -> configuring /etc/hosts fallback"
echo ">>> Hosts file: ${DNS_HOSTS_FILE}"
echo ">>> Host entries:"
dns_read_hosts_fallback_entries | sed 's/^/ /'
dns_write_hosts_fallback
dns_test_resolution
echo
echo ">>> Local DNS fallback configured for:"
dns_read_hosts_fallback_entries | sed 's/^/ /'
}
install_dnsmasq_if_missing() {
if command -v dnsmasq >/dev/null 2>&1; then
return 0
fi
echo ">>> dnsmasq not found -> installing"
if command -v pacman >/dev/null 2>&1; then
sudo pacman -S --noconfirm --needed dnsmasq
elif command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y dnsmasq
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y dnsmasq
else
echo "ERROR: Unsupported distro/package manager. Install dnsmasq manually."
exit 1
fi
}
if ! dns_systemd_is_operational; then
echo ">>> Skipping local DNS setup via systemd services: systemd service management is unavailable in this environment."
configure_via_hosts_file
exit 0
fi
configure_via_networkmanager_dnsmasq() {
echo ">>> Detected NetworkManager -> configuring NM dnsmasq plugin (recommended)"
install_dnsmasq_if_missing
if systemctl is-enabled --quiet dnsmasq 2>/dev/null || systemctl is-active --quiet dnsmasq 2>/dev/null; then
echo ">>> Disabling system dnsmasq to avoid conflicts with NetworkManager dnsmasq"
sudo systemctl disable --now dnsmasq || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
fi
echo ">>> Writing NetworkManager dnsmasq config: ${DNS_NM_CONF}"
sudo mkdir -p "$(dirname "${DNS_NM_CONF}")"
cat <<EOF | sudo tee "${DNS_NM_CONF}" >/dev/null
[main]
dns=dnsmasq
EOF
echo ">>> Writing dnsmasq snippet for NetworkManager: ${DNS_NM_DNSMASQ_CONF}"
sudo mkdir -p "${DNS_NM_DNSMASQ_DIR}"
dns_dnsmasq_config | sudo tee "${DNS_NM_DNSMASQ_CONF}" >/dev/null
echo ">>> Restarting NetworkManager"
sudo systemctl restart NetworkManager
echo ">>> Resolver status"
cat /etc/resolv.conf || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
}
configure_via_system_dnsmasq() {
echo ">>> NetworkManager not active -> configuring system dnsmasq (fallback)"
install_dnsmasq_if_missing
echo ">>> Writing system dnsmasq config: ${DNS_SYS_DNSMASQ_CONF}"
sudo mkdir -p /etc/dnsmasq.d
dns_dnsmasq_config | sudo tee "${DNS_SYS_DNSMASQ_CONF}" >/dev/null
echo ">>> Enabling and restarting dnsmasq service"
sudo systemctl enable dnsmasq --now
sudo systemctl restart dnsmasq
if systemctl is-active --quiet systemd-resolved 2>/dev/null; then
echo ">>> Routing ${DNS_DOMAIN} to dnsmasq via systemd-resolved drop-in: ${DNS_RESOLVED_DROPIN}"
sudo mkdir -p "$(dirname "${DNS_RESOLVED_DROPIN}")"
cat <<EOF | sudo tee "${DNS_RESOLVED_DROPIN}" >/dev/null
# Attention: managed by infinito-nexus — routes ${DNS_DOMAIN} to local dnsmasq.
# Edits are overwritten; remove it with \`make network-dns-remove\`.
[Resolve]
DNS=127.0.0.1
Domains=~${DNS_DOMAIN}
EOF
sudo systemctl restart systemd-resolved
else
echo ">>> systemd-resolved not active -> skipping resolved integration"
echo ">>> NOTE: Ensure your system resolver uses 127.0.0.1 to query dnsmasq."
fi
}
if systemctl is-active --quiet NetworkManager 2>/dev/null; then
configure_via_networkmanager_dnsmasq
else
configure_via_system_dnsmasq
fi
dns_test_resolution
echo
echo ">>> Local DNS configured for:"
echo " *.${DNS_DOMAIN} -> 127.0.0.1"
dns_stacks | awk '{ printf " *.%s -> %s\n", $1, $2 }'