From: Hugo Villeneuve Date: Sat, 17 May 2014 18:08:58 +0000 (-0400) Subject: Allow DHCP client to create resolv.conf if local DNS server is disabled X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=02a6c67738080f06def83e5c2aad68af3ce2d56b;p=hvlinux.git Allow DHCP client to create resolv.conf if local DNS server is disabled --- 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