Allow DHCP client to create resolv.conf if local DNS server is disabled
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 17 May 2014 18:08:58 +0000 (14:08 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 17 May 2014 18:18:26 +0000 (14:18 -0400)
stage2/bootscripts/network
stage2/pkg/dhcp

index 11c273a..d82e9ee 100755 (executable)
@@ -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)
index 083e027..beb7ee6 100644 (file)
@@ -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