git » kxd » commit bf5a15c

cryptsetup: Don't touch resolv.conf if it's already present

author Alberto Bertogli
2014-05-01 09:14:04 UTC
committer Alberto Bertogli
2014-05-01 09:25:32 UTC
parent 4cb568e0e61fd25507e979a82ce02fb8f0971595

cryptsetup: Don't touch resolv.conf if it's already present

If some other script already created/populated resolv.conf for us, we should
not need to change it.

This patch also renames the script to "kxc-premount-net", to make it more
obvious where it comes from.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

Makefile +1 -1
cryptsetup/initramfs-scripts/{premount-net => kxc-premount-net} +3 -1

diff --git a/Makefile b/Makefile
index 22b86ac..7b0f602 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ install-initramfs: install-kxc
 	$(INSTALL) -m 0755 cryptsetup/initramfs-hooks/kxc \
 		$(PREFIX)/share/initramfs-tools/hooks/
 	$(INSTALL) -d $(PREFIX)/share/initramfs-tools/scripts/init-premount
-	$(INSTALL) -m 0755 cryptsetup/initramfs-scripts/premount-net \
+	$(INSTALL) -m 0755 cryptsetup/initramfs-scripts/kxc-premount-net \
 		$(PREFIX)/share/initramfs-tools/scripts/init-premount/
 
 
diff --git a/cryptsetup/initramfs-scripts/premount-net b/cryptsetup/initramfs-scripts/kxc-premount-net
similarity index 76%
rename from cryptsetup/initramfs-scripts/premount-net
rename to cryptsetup/initramfs-scripts/kxc-premount-net
index b131058..5032ee1 100755
--- a/cryptsetup/initramfs-scripts/premount-net
+++ b/cryptsetup/initramfs-scripts/kxc-premount-net
@@ -22,6 +22,8 @@ esac
 configure_networking
 
 # Configure a basic resolv.conf based on our networking.
-echo "nameserver $IPV4DNS0" >> /etc/resolv.conf
+if ! [ -s /etc/resolv.conf ]; then
+	echo "nameserver $IPV4DNS0" >> /etc/resolv.conf
+fi