From 4d9ec44455166f5f53fc3e4f3bb18221a8a7cf5a Mon Sep 17 00:00:00 2001 From: Laan Tungir Date: Sun, 3 May 2026 11:21:46 -0400 Subject: [PATCH] Require dnsmasq service unit for DNS forwarding setup --- update_and_deploy_fips.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/update_and_deploy_fips.sh b/update_and_deploy_fips.sh index a46b43c..7ad1b7d 100755 --- a/update_and_deploy_fips.sh +++ b/update_and_deploy_fips.sh @@ -240,11 +240,23 @@ restart_unit_with_diagnostics() { } ensure_dnsmasq_package() { + local has_dnsmasq_cmd="no" + local has_dnsmasq_unit="no" + if command -v dnsmasq >/dev/null 2>&1; then + has_dnsmasq_cmd="yes" + fi + if sudo systemctl list-unit-files dnsmasq.service --no-legend 2>/dev/null | grep -q '^dnsmasq\.service'; then + has_dnsmasq_unit="yes" + fi + + # Some systems ship dnsmasq binary without the dnsmasq.service unit. + # In that case we still need to install the full service package. + if [[ "${has_dnsmasq_cmd}" == "yes" && "${has_dnsmasq_unit}" == "yes" ]]; then return fi - echo "==> dnsmasq not found; installing" + echo "==> Installing/repairing dnsmasq package for service support" if command -v apt-get >/dev/null 2>&1; then install_system_packages dnsmasq elif command -v dnf >/dev/null 2>&1 || command -v yum >/dev/null 2>&1; then @@ -264,6 +276,11 @@ ensure_dnsmasq_package() { echo "Warning: dnsmasq command is still unavailable after package install." >&2 return 1 fi + + if ! sudo systemctl list-unit-files dnsmasq.service --no-legend 2>/dev/null | grep -q '^dnsmasq\.service'; then + echo "Warning: dnsmasq.service unit still missing after package install." >&2 + return 1 + fi } configure_dnsmasq_fips_dns() {