From 02a6c67738080f06def83e5c2aad68af3ce2d56b Mon Sep 17 00:00:00 2001
From: Hugo Villeneuve <hugo@hugovil.com>
Date: Sat, 17 May 2014 14:08:58 -0400
Subject: [PATCH] Allow DHCP client to create resolv.conf if local DNS server
 is disabled

---
 stage2/bootscripts/network | 15 +++++++++++++++
 stage2/pkg/dhcp            |  9 ---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/stage2/bootscripts/network b/stage2/bootscripts/network
index 11c273a..d82e9ee 100755
--- a/stage2/bootscripts/network
+++ b/stage2/bootscripts/network
@@ -62,6 +62,21 @@ network_start()
     fi
 }
 
+if [ x"${DNS_SERVER_ENA}" == xyes ]; then
+    cat > /etc/dhclient-enter-hooks << "EOF"
+# If named is running, do not let dhclient create or modify resolv.conf
+# by specifying an empty function hook:
+make_resolv_conf(){
+	:
+}
+EOF
+    chmod u+x /etc/dhclient-enter-hooks
+else
+    if [ -f /etc/dhclient-enter-hooks ]; then
+        rm /etc/dhclient-enter-hooks
+    fi
+fi
+
 # See how we were called.
 case "$1" in
     start)
diff --git a/stage2/pkg/dhcp b/stage2/pkg/dhcp
index 083e027..beb7ee6 100644
--- a/stage2/pkg/dhcp
+++ b/stage2/pkg/dhcp
@@ -40,15 +40,6 @@ EOF
 
     sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /etc/dhclient.conf
 
-    cat > /etc/dhclient-enter-hooks << "EOF"
-# If named is running, do not let dhclient create or modify resolv.conf
-# by specifyng an empty function hook:
-make_resolv_conf(){
-	:
-}
-EOF
-    chmod u+x /etc/dhclient-enter-hooks
-
     cat > /etc/sysconfig/network/dhcp-client << "EOF"
 # dhcp-client
 # DHCP client program informations
-- 
2.20.1