From df3c3c139d7eedad4ab8be383c66a5518322157c Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 23 Apr 2012 16:04:30 -0500
Subject: LinHES-config: updated network and hostypes to use mdns4 and make
 sure avahi is installed

---
 abs/core/LinHES-config/PKGBUILD      |  6 +++---
 abs/core/LinHES-config/mv_hostype.py |  8 ++++----
 abs/core/LinHES-config/mv_network.py | 29 +++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 2777277..85105c5 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=65
+pkgrel=66
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -130,12 +130,12 @@ md5sums=('18af4fe481e1fc2ae02050026eb5cd27'
          'b845de3e05c1734cce4b9ac5e8f1baaf'
          '03d866e4dc287d13734e35f4ebe15edb'
          '5e69839659d65ddda35b8a9982dc29e9'
-         '62b4ce94277c32f525db5c1480670acd'
+         '3afd18517bb765d1680f4fcc8d08c9cc'
          'ec6a9961e4d1b53ec1240c5979efff11'
          'fe5e31b833cc6707209e9d656b6eb53c'
          '76140f4160ebb1790a24f9b51b542a7b'
          '23d0e12b7ca1cc6ea6b993c1d7ff20b9'
-         'bce31dc826812d1b32003f77f9945ca9'
+         '0b5b9e5385c7ae77e561812e96ce8161'
          '59dd4d49fd92a35f4111aa9b77fa21b6'
          '2596460462cf6c889cf8f95485537b20'
          'a63ff9ef5250965aeabc74bfa8e43981')
diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py
index 1396dfe..59b05b6 100755
--- a/abs/core/LinHES-config/mv_hostype.py
+++ b/abs/core/LinHES-config/mv_hostype.py
@@ -272,7 +272,7 @@ def hostypeprint(systemconfig):
         run_mysqlnetwork = True
         if systemconfig.get("hostypec"):
             setup_db()
-        install_list=["mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
+        install_list=["nss-mdns", "mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
         daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
 
 
@@ -289,7 +289,7 @@ def hostypeprint(systemconfig):
         logging.info("Master backend system being configured")
         setup_ntp(False,"null")
         setup_avahi(systemconfig.get("TEMPLATES"))
-        install_list=["mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
+        install_list=["nss-mdns", "mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
         daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
         EnableNetwork = True
         run_mysqlnetwork = True
@@ -312,7 +312,7 @@ def hostypeprint(systemconfig):
 
         if systemconfig.get("hostypec"):
             setup_db()
-        install_list = ["rpcbind", "nfs-utils", "avahi", "libmysqlclient" ]
+        install_list = [ "nss-mdns", "rpcbind", "nfs-utils", "avahi", "libmysqlclient" ]
         daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "avahi" ]
 
         daemon_remove_list=["mysql", "lighttpd", "certmaster"]
@@ -335,7 +335,7 @@ def hostypeprint(systemconfig):
         install_list=["mysql-clients", "libmysqlclient",  "avahi", "rpcbind", "nfs-utils"]
         remove_list=["mysql","lighttpd"]
 
-        daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ]
+        daemon_list=["nss-mdns",  "mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ]
         daemon_remove_list=["mysql", "mythbackend","lighttpd"]
         if xymon_supported:
             install_list.append('xymonclient')
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()
-- 
cgit v0.12