Handle non vanilla unbound installs

For example wiht local-dns-installer we don't have an include
This commit is contained in:
angristan 2018-09-15 20:20:31 +02:00
parent de4a5f4d16
commit a8310fd686

View file

@ -189,9 +189,19 @@ private-address: ::ffff:0:0/96" >> /etc/unbound/unbound.conf
if [ -d "/etc/unbound/conf.d" ]; then if [ -d "/etc/unbound/conf.d" ]; then
# Debian / Ubuntu # Debian / Ubuntu
UNBOUND_CONF_D="/etc/unbound/conf.d" UNBOUND_CONF_D="/etc/unbound/conf.d"
if ! grep -qs "^include: \"/etc/unbound/unbound.conf.d/\*.conf\"" /etc/unbound/unbound.conf; then
echo 'include: "/etc/unbound/unbound.conf.d/*.conf"' >> /etc/unbound/unbound.conf
fi
elif [ -d "/etc/unbound/unbound.conf.d" ]; then elif [ -d "/etc/unbound/unbound.conf.d" ]; then
# CentOS / Fedora # CentOS / Fedora
UNBOUND_CONF_D="/etc/unbound/unbound.conf.d" UNBOUND_CONF_D="/etc/unbound/unbound.conf.d"
if ! grep -qs "^include: /etc/unbound/conf.d/\*.conf" /etc/unbound/unbound.conf; then
echo 'include: /etc/unbound/conf.d/*.conf' >> /etc/unbound/unbound.conf
fi
else
UNBOUND_CONF_D="/etc/unbound/conf.d"
mkdir -p $UNBOUND_CONF_D
echo 'include: "/etc/unbound/unbound.conf.d/*.conf"' >> /etc/unbound/unbound.conf
fi fi
# Add OpenVPN integration # Add OpenVPN integration
@ -346,11 +356,11 @@ if [[ -e /etc/openvpn/server.conf ]]; then
if [[ -e /etc/unbound/unbound.conf ]]; then if [[ -e /etc/unbound/unbound.conf ]]; then
if [ -d "/etc/unbound/conf.d" ]; then if [ -d "/etc/unbound/conf.d" ]; then
# Debian / Ubuntu
UNBOUND_CONF_D="/etc/unbound/conf.d" UNBOUND_CONF_D="/etc/unbound/conf.d"
sed -i 's|include: \/etc\/unbound\/conf.d\/\*.conf||' /etc/unbound/unbound.conf
elif [ -d "/etc/unbound/unbound.conf.d" ]; then elif [ -d "/etc/unbound/unbound.conf.d" ]; then
# CentOS / Fedora
UNBOUND_CONF_D="/etc/unbound/unbound.conf.d" UNBOUND_CONF_D="/etc/unbound/unbound.conf.d"
sed -i 's|include: "\/etc\/unbound\/unbound.conf.d\/\*.conf"||' /etc/unbound/unbound.conf
fi fi
rm ${UNBOUND_CONF_D}/openvpn.conf rm ${UNBOUND_CONF_D}/openvpn.conf