From c9041c8753b14ad9616c8dc3deb0e0426d94fd5f Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 4 Jun 2013 14:51:22 -0500
Subject: LinHES-config:  mv_ir.py  add support for custom xbmc lirc mapping.  
 If a remote definition has a xbmc.xml file it will be symlinked for xbmc
 usage.

refs #910
---
 abs/core/LinHES-config/PKGBUILD |  4 ++--
 abs/core/LinHES-config/mv_ir.py | 42 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 131efd9..9f1584c 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=8.0
-pkgrel=4
+pkgrel=5
 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'
@@ -159,7 +159,7 @@ md5sums=('c832059cd635359d39a2ac3166ff463c'
          'c0549457750c4f8e8038d904a0f3012a'
          '3d1e3c7315881a109fb089a540d2262c'
          'b845de3e05c1734cce4b9ac5e8f1baaf'
-         'f9b38f3d8e6d25b7c67b4c33cdee58db'
+         '31ad5416bf2ab1909338a16035941127'
          '8b7dce4a3a0a281fa6656aa8781a648e'
          'f7f2dc11d1ba454cd25eeaa133104b62'
          '824e49d9b01fed295c704ab68908b464'
diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py
index d77f64f..f481fa4 100755
--- a/abs/core/LinHES-config/mv_ir.py
+++ b/abs/core/LinHES-config/mv_ir.py
@@ -136,6 +136,48 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
             cmd = "cp %s /etc/remote.run" %filename
             mv_common.runcmd(cmd)
 
+        #if remote has a special xbmc file, use it.
+        xbmcfile= remote_path + "/xbmc.xml"
+        userxmbcfile = mythhome+"/.xbmc/userdata/Lircmap.xml"
+        
+        if os.path.exists(xbmcfile):
+            logging.debug("     XBMC lirc file present")
+            logging.info("    Setting up lirc for xbmc")
+            if not os.path.exists(mythhome+"/.xbmc/userdata"):
+                logging.debug("    Creating %s/.xbmc",mythhome)
+                try:
+                    os.mkdir(mythhome+"/.xbmc")
+                except:
+                    logging.debug("   Couldn't create .xbmc/ ")
+                try:
+                    os.mkdir(mythhome+"/.xbmc/userdata/")
+                except:
+                    logging.debug("   Couldn't create .xbmc/userdata ")
+                    
+                try:
+                    cmd = ''' chown -R mythtv %s/.xbmc''' %mythhome
+                    mv_common.runcmd(cmd)
+                    cmd = ''' chgrp -R mythtv %s/.xbmc/userdata''' %mythhome
+                    mv_common.runcmd(cmd)
+                except:
+                    logging.debug("   Couldn't change permissions for .xbmc")
+                    pass    
+            try:
+                    cmd = ''' rm -f %s''' %(userxmbcfile)
+                    mv_common.runcmd(cmd)
+                    logging.debug("    Creating symlink for xmbc lircrc")
+                    os.symlink(xbmcfile, mythhome+"/.xbmc/userdata/Lircmap.xml")
+            except:
+                pass
+        else:
+            logging.debug("    XBMC lirc file %s not present" %xbmcfile)
+        
+            
+        
+        
+        
+        
+
         #remote has it's own modprobe.d/conf filename
         cmd = "rm  -f /etc/modprobe.d/mv_ir.conf"
         mv_common.runcmd(cmd)
-- 
cgit v0.12