Fix for Ubuntu 22.04 - Bind additional-from-cache option 'additional-from-cache' no longer exists

This commit is contained in:
earnolmartin 2022-10-24 10:15:49 -06:00
parent 8f42070647
commit fb9dac63ac
2 changed files with 16 additions and 10 deletions

View file

@ -264,11 +264,14 @@ function disableRecursiveBIND(){ # by earnolmartin@gmail.com
fi
# Add additional-from-cache no
RecursiveCacheCheck=$( cat "$bindOptionsFile" | grep -o "^additional-from-cache .*" | grep -o " .*$" | grep -o "[^ ].*" )
if [ -z "$RecursiveCacheCheck" ]; then
sed -i '$i \additional-from-cache no;' "$bindOptionsFile"
else
sed -i 's/^additional-from-cache .*/additional-from-cache no;/g' "$bindOptionsFile"
# No longer needed for Ubuntu 22.04+
if [[ "$distro" == "ubuntu" && "$yrelease" -le "20" ]] || [[ "$distro" == "debian" && "$yrelease" -le "11" ]]; then
RecursiveCacheCheck=$( cat "$bindOptionsFile" | grep -o "^additional-from-cache .*" | grep -o " .*$" | grep -o "[^ ].*" )
if [ -z "$RecursiveCacheCheck" ]; then
sed -i '$i \additional-from-cache no;' "$bindOptionsFile"
else
sed -i 's/^additional-from-cache .*/additional-from-cache no;/g' "$bindOptionsFile"
fi
fi
fi

View file

@ -1046,11 +1046,14 @@ function disableRecursiveBIND(){ # by earnolmartin@gmail.com
fi
# Add additional-from-cache no
RecursiveCacheCheck=$( cat "$bindOptionsFile" | grep -o "^additional-from-cache .*" | grep -o " .*$" | grep -o "[^ ].*" )
if [ -z "$RecursiveCacheCheck" ]; then
sed -i '$i \additional-from-cache no;' "$bindOptionsFile"
else
sed -i 's/^additional-from-cache .*/additional-from-cache no;/g' "$bindOptionsFile"
# No longer needed for Ubuntu 22.04+
if [[ "$distro" == "ubuntu" && "$yrelease" -le "20" ]] || [[ "$distro" == "debian" && "$yrelease" -le "11" ]]; then
RecursiveCacheCheck=$( cat "$bindOptionsFile" | grep -o "^additional-from-cache .*" | grep -o " .*$" | grep -o "[^ ].*" )
if [ -z "$RecursiveCacheCheck" ]; then
sed -i '$i \additional-from-cache no;' "$bindOptionsFile"
else
sed -i 's/^additional-from-cache .*/additional-from-cache no;/g' "$bindOptionsFile"
fi
fi
fi