#---------------------------------------------------------------------------- # /var/install/include/nm-get-dns - configuration of dns # # Creation : 2025-10-29 hbfl # Last Update: $Id$ # # Copyright (c) 2001-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # # get the dns responder # included from NetworkManager: nm-get-devices, nm-get-bonding, bind9, nm-getbrigde, etc.. # get_dns() { local filter="${1}" local dns_file=$(/usr/bin/find /etc/sysconfig/network/forwarder -maxdepth 1 -type f -printf '%f\n') case "X${dns_file}" in Xbind) . /etc/config.d/bind9 if [ ${BIND9_LISTEN_IPADDR_N:-0} -ne 0 ] && [ "${BIND9_LISTEN_LOCALHOST:-yes}" = "no" ] then localhost=false fi if "${localhost:-true}" then localhome='' delimeter='' if [ "${filter}" = "ipv4" ] then delimeter='\.' localhome='127.0.0.1;' elif [ "${filter}" = "ipv6" ] then delimeter=':' localhome='::1;' fi fi s_search='' separator='' idxb=1 while [ ${idxb} -le ${BIND9_N:-0} ] do eval zone_name='${BIND9_'${idxb}'_NAME}' s_search="${s_search}${separator}${zone_name}" separator=';' idxb=$((${idxb} + 1)) done if [ -z "${s_search}" ] then s_search="${DOMAIN_NAME}" fi echo "dns-search=${s_search:-$(hostanme -d)};" e_dns='' separator='' separator2='' for dns_server in ${DNS_SERVER} do if [ "${dns_server}" != "${localhome}" ] then if echo "${dns_server}" | grep -q "${delimeter}" then e_dns="${e_dns}${separator}${dns_server}" separator=';' separator2=';' fi fi done if [ -n "${e_dns}" ] then echo "dns=${localhome}${e_dns};" fi ;; X) if [ -n "${DOMAIN_NAME}" ] then echo "dns-search=${DOMAIN_NAME};" fi e_dns='' separator='' for dns_server in ${DNS_SERVER} do if echo "${dns_server}" | grep -q "${delimeter}" then e_dns="${e_dns}${separator}${dns_server}" separator=';' fi done if [ -n "${e_dns}" ] then echo "dns=${e_dns};" fi ;; esac }