summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_network.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-04-23 21:04:30 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-04-23 21:04:30 (GMT)
commitdf3c3c139d7eedad4ab8be383c66a5518322157c (patch)
treecc2f30241a0f381e4ca7533d3188e5368bb08978 /abs/core/LinHES-config/mv_network.py
parent9cd55b71136e4b2b7b296549e39b23d02adc1817 (diff)
downloadlinhes_pkgbuild-df3c3c139d7eedad4ab8be383c66a5518322157c.zip
linhes_pkgbuild-df3c3c139d7eedad4ab8be383c66a5518322157c.tar.gz
linhes_pkgbuild-df3c3c139d7eedad4ab8be383c66a5518322157c.tar.bz2
LinHES-config: updated network and hostypes to use mdns4 and make sure avahi is installed
Diffstat (limited to 'abs/core/LinHES-config/mv_network.py')
-rwxr-xr-xabs/core/LinHES-config/mv_network.py29
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()