From ed28d2bff19273fac6cf03486c10919a68653e65 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sat, 22 Dec 2012 09:59:21 -0600
Subject: LinHES-config:  added support for configuing mythzmserver to 
 myth_settings_wrapper.sh.  It will add the server and port to the settings
 table for each system that has mythzoneminder installed.     Also modificed
 mv_software.py to setup zoneminder where needed and also mythzmserver

refs #887
---
 abs/core/LinHES-config/PKGBUILD                 |  6 ++---
 abs/core/LinHES-config/mv_software.py           | 29 +++++++++++++++++++++++++
 abs/core/LinHES-config/myth_settings_wrapper.sh |  7 +++++-
 3 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 885045f..9b2437c 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=199
+pkgrel=201
 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'
@@ -139,7 +139,7 @@ md5sums=('26e20dba8d1bea96a07131ef945fd2f7'
          'f73d6d6f98839e900cb6685bf5dc4eae'
          '408688e3bcb2cefe512f9a89863137c8'
          '2a7f3b34e522acfd08283b86c8926aba'
-         '157906733642835bd7a3ff4e32771c8e'
+         'b596d2e3779a434435bc0f0277b1ba3e'
          '31c01f0d5be8ded8a3c24224ee37841a'
          'b02bc06fc6623bf6473175165578e1d5'
          'a6faa20d905e2fd92ce79acab044b759'
@@ -159,7 +159,7 @@ md5sums=('26e20dba8d1bea96a07131ef945fd2f7'
          'f7f2dc11d1ba454cd25eeaa133104b62'
          '824e49d9b01fed295c704ab68908b464'
          'fe5e31b833cc6707209e9d656b6eb53c'
-         'a1dab8e26e8cbc326b8c1a0794bc25d8'
+         '3eec99951c01d1a1abf7ecfeb33f922b'
          '087a0ef743bc8af915503f8773536ce4'
          '183a11aa06d60065106472ed9f72cc4a'
          'b4900090d841d3e390cb840cf16afd85'
diff --git a/abs/core/LinHES-config/mv_software.py b/abs/core/LinHES-config/mv_software.py
index 20b355e..41ca7c7 100755
--- a/abs/core/LinHES-config/mv_software.py
+++ b/abs/core/LinHES-config/mv_software.py
@@ -1,6 +1,28 @@
 # -*- coding: utf-8 -*-
 import logging, mv_common
 import os, re
+def zoneminder_setup(systemconfig):
+    logging.info("____Start of mythzoneminder config____")
+    mv_root = systemconfig.get("MVROOT")
+    if ( systemconfig.get("SystemType") == "Standalone" or
+         systemconfig.get("SystemType") == "Master_backend" ):
+             logging.info("    Adding mythzmserver" )
+             #add zoneminder
+             mv_common.pacinstall("zoneminder")
+             mv_common.add_service("zoneminder")
+             mv_common.add_service("mythzmserver")
+
+    #now to add the settings.
+    cmd = '''%s/bin/myth_settings_wrapper.sh -c ZMCONFIG -h %s -a %s'''%(
+                                                   mv_root,
+                                                   systemconfig.get("hostname"),
+                                                   systemconfig.get("dbhost"))
+    mv_common.runcmd(cmd)
+    logging.info("____End of mythzoneminder config____")
+
+
+
+
 
 def setup_software(systemconfig, data_config):
     if  mv_common.read_config(mv_common.module_config,"software")  == False  :
@@ -24,6 +46,7 @@ def setup_software(systemconfig, data_config):
       default_installed=("mythgallery", "mythmusic")
       other_pkg=("miro", "mednafen", "romdb", "xine", "dvdcss", "webmin" , "fuppes", "foldingathome", "mythappletrailers", "mythstream", "mupen64")
     else:
+      #this is linhes section
       default_disabled = ("mytharchive",
                           "mythbrowser",
                           "mythnews",
@@ -55,8 +78,14 @@ def setup_software(systemconfig, data_config):
         try:
             if systemconfig[pkg] == "1":
                 mv_common.pacinstall(pkgname)
+                if pkgname == "mythzoneminder":
+                    zoneminder_setup(systemconfig)
             else:
                 mv_common.pacremove(pkgname)
+                if pkgname == "mythzoneminder":
+                    #should be a conditional check on system type
+                    #but not worth the effort.
+                    mv_common.remove_service("mythzmserver")
         except:
             logging.debug("  ERROR-- %s is not defined", pkg)
 
diff --git a/abs/core/LinHES-config/myth_settings_wrapper.sh b/abs/core/LinHES-config/myth_settings_wrapper.sh
index b122a78..37d5e33 100644
--- a/abs/core/LinHES-config/myth_settings_wrapper.sh
+++ b/abs/core/LinHES-config/myth_settings_wrapper.sh
@@ -218,7 +218,12 @@ case $OPERATION in
         fi
         ;;
 
-
+    ZMCONFIG)
+         define_xml ${IP_ADDRESS} $hostname settings ZoneMinderServerIP
+         load_xml $gen_xml
+         define_xml "6548" $hostname settings ZoneMinderServerPort
+         load_xml $gen_xml
+         ;;
 
     BECONFIG)
             if [ $SYSTEMTYPE = "master" ]
-- 
cgit v0.12

