From ef93372c8ce35aa6ca16c065cc3a64ae4f08d6d6 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 4 Sep 2012 16:36:05 -0500
Subject: LinHES-system: misc_status_config.py: add SystemType check and only
 update db for Standalone and masterbackend

---
 abs/core/LinHES-system/PKGBUILD              |  4 +--
 abs/core/LinHES-system/misc_status_config.py | 37 +++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 20a2c67..b5f6ab3 100644
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=56
+pkgrel=57
 arch=('i686')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -84,7 +84,7 @@ md5sums=('d1a5963c5a440a608031c6d750232633'
          'b798ee0796d1b760a2998f90eb8ce9cc'
          '4a3cd8f9b33b2b86fdba47a8f1fa2859'
          '06a628469051237943b7c874f2e29b8a'
-         '0512f859cd5ea1d9eb972840caef2f0e'
+         '54ebcc024db2e0ebe8121305d8926767'
          '45f46d1f9193c8dde18e56369ec29a1e'
          'a8edbe7bc37e9932e8749d9f5f89c16f'
          '14cea9e87654441b766a97576233ba5a'
diff --git a/abs/core/LinHES-system/misc_status_config.py b/abs/core/LinHES-system/misc_status_config.py
index 0a0ba6c..cc82534 100755
--- a/abs/core/LinHES-system/misc_status_config.py
+++ b/abs/core/LinHES-system/misc_status_config.py
@@ -7,9 +7,34 @@ from MythTV import MythDB
 mythdb = MythDB()
 localhostname = gethostname()
 
-# mythtv-setup
-if mythdb.settings[localhostname].MiscStatusScript == u'':
-    mythdb.settings[localhostname].MiscStatusScript = u'/usr/LH/bin/misc_status_info.sh'
-    print 'The MythTV database setting MiscStatusScript was updated to /usr/LH/bin/misc_status_info.sh.'
-else:
-    print 'The MythTV database setting MiscStatusScript is already set and will not be updated.'
+# Function to set db setting.  This setting is set in mythtv-setup.
+def dbSettingChange():
+    if mythdb.settings[localhostname].MiscStatusScript == u'':
+        mythdb.settings[localhostname].MiscStatusScript = u'/usr/LH/bin/misc_status_info.sh'
+        print 'The MythTV database setting MiscStatusScript was updated to /usr/LH/bin/misc_status_info.sh.'
+    else:
+        print 'The MythTV database setting MiscStatusScript is already set and will not be updated.'
+    return
+
+#taken from systemconfig.py
+#this is how you populate the dict
+systemconfig = {}
+file_name = "/etc/systemconfig"
+try:
+    config_file = open(file_name)
+except:
+    logging.critical("%s could not be opened", file_name)
+    sys.exit(1)
+
+for line in config_file:
+    line = line.strip()
+    if line and line[0] is not "#" and line[-1] is not "=":
+        var, val = line.rsplit("=", 1)
+        val = val.strip('"')
+        systemconfig[var.strip()] = val.strip()
+
+#this is how you reference a value from mv_hostype.py
+if (systemconfig.get("SystemType") == "Standalone"):
+    dbSettingChange()
+elif systemconfig.get("SystemType") == "Master_backend":
+    dbSettingChange()
-- 
cgit v0.12

