From a29afe5c402098513231cd873544c05147e19b18 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 10 Feb 2015 18:59:28 +0000
Subject: LinHES-config: mv_ir.py: add support for wol-lircrc in remote
 templates

---
 abs/core/LinHES-config/PKGBUILD |  4 ++--
 abs/core/LinHES-config/mv_ir.py | 24 +++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index b618689..9f79ef6 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=8.3
-pkgrel=10
+pkgrel=11
 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'
@@ -162,7 +162,7 @@ md5sums=('17d9dd5a097fbbd4dae75dff8e2677ff'
          'c0549457750c4f8e8038d904a0f3012a'
          'cb7abd558b6540bc5e2232866a2a42f8'
          'b845de3e05c1734cce4b9ac5e8f1baaf'
-         '9ed75eb02683cf48fd1a79b048b2d3f2'
+         '077ebce663edba30ba7f93e4d245d125'
          '8b7dce4a3a0a281fa6656aa8781a648e'
          '4b10fff21a0274f950f97f2b61e92463'
          '824e49d9b01fed295c704ab68908b464'
diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py
index 2f3de08..8eab7b0 100755
--- a/abs/core/LinHES-config/mv_ir.py
+++ b/abs/core/LinHES-config/mv_ir.py
@@ -46,6 +46,16 @@ def setup_lirc_links(mythhome):
     else:
         logging.debug("    /etc/lircrc does not exist, can not link it")
 
+    if os.path.exists("/etc/wol-lircrc"):
+        if not os.path.exists(mythhome+"/.wol-lircrc"):
+            logging.debug("    Creating symlink for .wol-lircrc")
+            os.symlink("/etc/wol-lircrc",mythhome+"/.wol-lircrc")
+        else:
+            logging.debug("    %s/.wol-lircrc already present",mythhome)
+    else:
+        logging.debug("    /etc/wol-lircrc does not exist, can not link it")
+
+
 def scrub_modules(filename,module):
     logging.debug("    scrubbing %s from %s",module,filename)
     cmd = '''sed -i -e '/.*#%s/d' %s''' %(module,filename)
@@ -100,6 +110,8 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
         mv_common.runcmd(cmd)
         cmd = "mv /etc/lircrc /etc/lircrc-%s" %currenttime
         mv_common.runcmd(cmd)
+        cmd = "mv /etc/wol-lircrc /etc/wol-lircrc-%s" %currenttime
+        mv_common.runcmd(cmd)
         cmd = "mv /etc/remote.run /etc/remote.run-%s" %currenttime
         mv_common.runcmd(cmd)
         if remotebucket == "user":
@@ -128,6 +140,16 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
                 continue
             include_file("/etc/lircrc",filename)
 
+        # include wol-lircrc
+        files = remote_path + "/wol-lircrc*"
+        logging.debug("    Using %s",files)
+        for filename in glob.glob(files):
+            # Ignore subfolders
+            if os.path.isdir (filename):
+                logging.debug("    %s is a dir, skipping",filename)
+                continue
+            include_file("/etc/wol-lircrc",filename)
+
         #if remote has a special run file use it.
         files = remote_path + "/remote.run*"
         logging.debug("    Using %s",files)
@@ -205,7 +227,7 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
 
 
         #cleanup
-        cmd =  "chmod 755 /etc/lircrc /etc/remote.run"
+        cmd =  "chmod 755 /etc/lircrc /etc/wol-lircrc /etc/remote.run"
         mv_common.runcmd(cmd)
         mv_common.add_service("remotes")
         mv_common.add_service("irexec")
-- 
cgit v0.12

