diff options
Diffstat (limited to 'abs/core/LinHES-config/mv_network.py')
-rwxr-xr-x | abs/core/LinHES-config/mv_network.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/abs/core/LinHES-config/mv_network.py b/abs/core/LinHES-config/mv_network.py index f25d4bc..aab1345 100755 --- a/abs/core/LinHES-config/mv_network.py +++ b/abs/core/LinHES-config/mv_network.py @@ -143,6 +143,13 @@ def kill_dhcp(basedir): def setup_nameserver(dns): logging.info(" Adding %s for DNS", dns) + lan="local" + cmd = '''grep -q %s /etc/resolv.conf''' %lan + status = mv_common.runcmd(cmd) + if not status == 0 : + cmd = ''' echo "search %s" >> /etc/resolv.conf ''' %lan + mv_common.runcmd(cmd) + cmd = '''grep -q %s /etc/resolv.conf''' %dns status = mv_common.runcmd(cmd) if not status == 0 : @@ -301,6 +308,15 @@ def setup_interface(netdev,systemconfig): logging.info(" Enabling DHCP support") cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' %s/%s/options''' %(etcnetdir, netdev) mv_common.runcmd(cmd) + #add .local .lan + local="local" + cmd = '''grep -q %s /etc/resolv.conf.head''' %local + status = mv_common.runcmd(cmd) + if not status == 0 : + cmd = ''' echo "search %s" >> /etc/resolv.conf.head ''' %local + mv_common.runcmd(cmd) + + else: logging.info(" Using static ip address of %s",netinfo["ip"]) cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=static/g' %s/%s/options''' %(etcnetdir, netdev) @@ -384,6 +400,10 @@ def find_active(systemconfig,this_is_install): mv_common.remove_file("/etc/resolv.conf") cmd = ''' echo search lan > /etc/resolv.conf ''' mv_common.runcmd(cmd) + + cmd = ''' echo search local >> /etc/resolv.conf ''' + mv_common.runcmd(cmd) + cmd = ''' echo nameserver 127.0.0.1 >> /etc/resolv.conf ''' mv_common.runcmd(cmd) @@ -487,6 +507,9 @@ def setup_network (systemconfig,this_is_install): return False logging.info("____Start of network____") logging.info(" Setting up the network") + mv_common.pacinstall("nss-mdns") + mv_common.pacinstall("avahi") + setup_nsswitch() restartfe = hostname_change_check(systemconfig) setup_hostname(systemconfig) find_active(systemconfig,this_is_install) @@ -494,12 +517,18 @@ def setup_network (systemconfig,this_is_install): logging.info("__End of network\n") return restartfe +def setup_nsswitch(): + logging.info(" Adding mdns4 to nsswitch.conf") + cmd = '''sed -i "s/hosts:.*$/hosts: files mdns4_minimal dns mdns4/" /etc/nsswitch.conf''' + mv_common.runcmd(cmd) ##this is used by the install process to start the network def install_network_setup(systemconfig): logging.info("____Start of network_install____") logging.info(" Setting up the network") + + #setup_MYTH_vars setup_hostname(systemconfig) stop_network() |