git » kxd » commit 5159f22

cryptsetup: Only extend resolv.conf if $IPV4DNS0 is set

author Alberto Bertogli
2024-10-04 11:20:01 UTC
committer Alberto Bertogli
2024-10-04 11:20:01 UTC
parent d08f76c128de6eb0bda742764390afa89a4b4659

cryptsetup: Only extend resolv.conf if $IPV4DNS0 is set

Today we extend /etc/resolv.conf even if $IPV4DNS0 is empty, which can
result in a technically invalid config.

Thanks to Leandro Lucarella for filing the bug
(https://bugs.debian.org/1065573) and providing a patch for this.

cryptsetup/initramfs-scripts/kxc-premount-net +1 -2

diff --git a/cryptsetup/initramfs-scripts/kxc-premount-net b/cryptsetup/initramfs-scripts/kxc-premount-net
index 5032ee1..22c0e0c 100755
--- a/cryptsetup/initramfs-scripts/kxc-premount-net
+++ b/cryptsetup/initramfs-scripts/kxc-premount-net
@@ -22,8 +22,7 @@ esac
 configure_networking
 
 # Configure a basic resolv.conf based on our networking.
-if ! [ -s /etc/resolv.conf ]; then
+if ! [ -s /etc/resolv.conf ] && [ -n "$IPV4DNS0" ]; then
 	echo "nameserver $IPV4DNS0" >> /etc/resolv.conf
 fi
 
-