From e4840158643b9d3dd848fce7587d788870813438 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 14 Oct 2012 14:42:57 -0500
Subject: LinHES-config:  added some logic to account for when the hostname
 changes via the service menu. - restart func (this will work itself out if
 left alone) - restart xymon - run mythutils to change hostname - reload
 systemsettings with new hostname

---
 abs/core/LinHES-config/PKGBUILD                 | 12 ++++++------
 abs/core/LinHES-config/mv_network.py            | 17 ++++++++++++++++-
 abs/core/LinHES-config/myth_settings_wrapper.sh | 12 ++++++++++--
 abs/core/LinHES-config/systemconfig.py          |  4 ++++
 4 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 4764868..37ec708 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=171
+pkgrel=173
 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'
@@ -75,7 +75,7 @@ build() {
     install -m 0755 xconfig.sh  $MVDIR/bin/xconfig.sh
     install -m 0755 install_db_chroot.sh $MVDIR/bin/install_db_chroot.sh
     install -m 0755 restore_km_db_chroot.sh $MVDIR/bin/restore_km_db_chroot.sh
-    install -m 0755 restore_default_settings.sh $MVDIR/bin/restore_default_settings.sh
+#    install -m 0755 restore_default_settings.sh $MVDIR/bin/restore_default_settings.sh
     install -m 0755 myth_settings_wrapper.sh $MVDIR/bin/myth_settings_wrapper.sh
     install -m 0755 soundconfig.sh $MVDIR/bin/soundconfig.sh
     install -m 0755 networkconfig.sh $MVDIR/bin/networkconfig.sh
@@ -135,9 +135,9 @@ md5sums=('59e18e35359bebcd9d639c5e5b5d290d'
          'f73d6d6f98839e900cb6685bf5dc4eae'
          '408688e3bcb2cefe512f9a89863137c8'
          '2a7f3b34e522acfd08283b86c8926aba'
-         '36f5017e25c200354a954b17819aa1b2'
+         'c8812fc1dd0451361fc248d39de90c60'
          '689b01f7636e09b2f9657c6ce6006ee7'
-         'fbaf92ebba3f4ef266d078c7cca08045'
+         'b02bc06fc6623bf6473175165578e1d5'
          'a6faa20d905e2fd92ce79acab044b759'
          '8ba06c2ce6129371548cc360ccca27f8'
          '5f890ea9bda6aef652d2560ca19dac07'
@@ -152,7 +152,7 @@ md5sums=('59e18e35359bebcd9d639c5e5b5d290d'
          'b845de3e05c1734cce4b9ac5e8f1baaf'
          'a971121bc0b447d3b525778e73985c40'
          '8b7dce4a3a0a281fa6656aa8781a648e'
-         '2934fd80277e4598856f3171ccef9bfd'
+         'f7f2dc11d1ba454cd25eeaa133104b62'
          '824e49d9b01fed295c704ab68908b464'
          'fe5e31b833cc6707209e9d656b6eb53c'
          'ecb52b9b7a9ac0c8988093c1dfdda635'
@@ -161,7 +161,7 @@ md5sums=('59e18e35359bebcd9d639c5e5b5d290d'
          'b4900090d841d3e390cb840cf16afd85'
          '6dd202ec664ede468e42edf600f7913d'
          'c9c9390ac12145169dfe9a76896db328'
-         'f49d9ff1e6c3e484c9679079c74ad048'
+         'f48b04d714c93146d8711531c266800a'
          '2596460462cf6c889cf8f95485537b20'
          '4cba2bb55c6b8e27c57a6171f42d0455'
          '4804aa93aaad3dfcfff08cd9ffd68836'
diff --git a/abs/core/LinHES-config/mv_network.py b/abs/core/LinHES-config/mv_network.py
index d0fa16c..f011970 100755
--- a/abs/core/LinHES-config/mv_network.py
+++ b/abs/core/LinHES-config/mv_network.py
@@ -503,7 +503,7 @@ def hostname_change_check(systemconfig):
     logging.debug("    New hostname: %s", newhostname)
     if oldhostname != newhostname :
         logging.info("    Changing hostname in database to match new hostname")
-        cmd ="%s/bin/restore_default_settings.sh -cuhostname -o -h%s" %(mv_root, oldhostname)
+        cmd ="%s/bin/myth_settings_wrapper.sh -cuhostname  -j %s -n %s " %(mv_root, oldhostname, newhostname)
         mv_common.runcmd(cmd)
         logging.info("    Changing hostname to %s", newhostname)
         cmd = "hostname %s" %newhostname
@@ -513,6 +513,21 @@ def hostname_change_check(systemconfig):
             mv_common.stop_service("mythbackend")
             mv_common.start_service("mythbackend")
             restartfe = True
+        mv_common.stop_service("avahi")
+        mv_common.start_service("avahi")
+
+
+        mv_common.stop_service("xymon-client")
+        mv_common.start_service("xymon-client")
+
+        mv_common.stop_service("funcd")
+        mv_common.start_service("funcd")
+
+
+
+
+
+
     else:
         logging.debug("    old and new hostnames matched, leaving things along")
     logging.debug("  __End of hostname_change_check")
diff --git a/abs/core/LinHES-config/myth_settings_wrapper.sh b/abs/core/LinHES-config/myth_settings_wrapper.sh
index 6ceec7f..a1fbffc 100644
--- a/abs/core/LinHES-config/myth_settings_wrapper.sh
+++ b/abs/core/LinHES-config/myth_settings_wrapper.sh
@@ -9,7 +9,7 @@ TEMPLATES="$TEMPLATES/settings"
 TABLES="settings keybindings jumppoints"
 MYTHDBUSER=mythtv
 MYTHTVPASSWD=mythtv
-declare -r OPTSTRING="c:e:t:d:h:s:a:z:Ho"
+declare -r OPTSTRING="c:e:t:d:h:s:a:z:Ho:n:j:"
 Thistemplate=""
 declare -i OVERRIDE=0
 declare -i EVERYTHING=0
@@ -152,6 +152,13 @@ do
                 ARG_ERR
                 ZIPCODE=$OPTARG
                     ;;
+            n) echo "$SWITCH"  "$OPTARG"
+                  newhostname=$OPTARG
+                ;;
+
+            j) echo "$SWITCH"  "$OPTARG"
+                oldhostname=$OPTARG
+                ;;
         o)  OVERRIDE=1
                 ;;
 
@@ -268,7 +275,8 @@ case $OPERATION in
         #used when the hostname is changed.
         #
         #call myth_util  $oldhostname $hostname
-
+        mythutil --change-hostname --new-host $newhostname  --old-host $oldhostname
+        mythutil --import-settings --infile $TEMPLATES/$Thistemplate/syssettings.xml --hostname $newhostname
             ;;
     USERJOBALLOW)
         echo "UserJOBALLOW callremoved"
diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py
index d65a1c6..baaab4f 100755
--- a/abs/core/LinHES-config/systemconfig.py
+++ b/abs/core/LinHES-config/systemconfig.py
@@ -176,6 +176,10 @@ def main(argv):
         systemconfig["hostypec"] = True
         #cmdmodule["smolt"] = True
 
+    if cmdmodule["hostypec"] == True :
+        cmdmodule["fileshare"] = True
+        cmdmodule["hostype"] = True
+
     systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig)
     systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig)
     systemconfig["mythgw"] = mv_network.setup_MYTH_DHCP(systemconfig)
-- 
cgit v0.12

