From fadd791ceddc196e958e9a108f26532a0a2d1170 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 12 Apr 2012 19:09:26 -0500
Subject: LinHES-system: firstboot.sh: add fix_lirc_socket; closes #822

---
 abs/core/LinHES-system/PKGBUILD     |  4 ++--
 abs/core/LinHES-system/firstboot.sh | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index d2fb0f8..607bda1 100644
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=39
+pkgrel=40
 arch=('i686')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -55,7 +55,7 @@ md5sums=('d6a564f3286590875874573107940908'
          'd1f27cb422010077c841376526fe46ea'
          '2ef9f945e034119f77d9b6beb17e4fa5'
          '5c96527397a35519d72c78d6e3c8dbea'
-         '18a884a73344ff6eb74f63b49745e0f5'
+         '5e67a8b7ff57ec32d668bce7aab0aa6d'
          'dc3eef2a624754e16805d72bbe488b67'
          'dc0be354ce77ba2b89868fc29b942c43'
          '542e670e78d117657f93141e9689f54d'
diff --git a/abs/core/LinHES-system/firstboot.sh b/abs/core/LinHES-system/firstboot.sh
index 7e2f603..8e3dc57 100755
--- a/abs/core/LinHES-system/firstboot.sh
+++ b/abs/core/LinHES-system/firstboot.sh
@@ -23,6 +23,26 @@ function try_smolt {
 
 }
 
+function fix_lirc_socket {
+  . /etc/systemconfig
+
+  # Fix LircSocket in mythtv database
+  SOCKET=`mysql -u mythtv -pmythtv -B --skip-column-names -h "${dbhost}" -D mythconverg -e \
+         "SELECT data FROM settings WHERE value = 'LircSocket' AND hostname = '${hostname}';"`
+    if [ "${SOCKET}" != "/var/run/lirc/lircd" ]; then
+      mysql -u mythtv -pmythtv -B --skip-column-names -h "${dbhost}" -D mythconverg -e \
+      "UPDATE settings SET data = '/var/run/lirc/lircd' WHERE value = 'LircSocket' AND hostname = '${hostname}';"
+    else
+      echo ">>>"
+      echo ">>> ATTENTION! ATTENTION! ATTENTION!"
+      echo ">>> Unable to connect the the MySQL database to make needed"
+      echo ">>> changes to the LIRC socket."
+      echo ">>> LIRC now uses /var/run/lirc/lircd and /dev/lirc is now"
+      echo ">>> obsolete. Update your MythTV settings to reflect this."
+      echo ">>>"
+    fi
+}
+
 
 if [ ! -e /tmp/debug ]
 then
@@ -35,6 +55,7 @@ then
 				fb_status=4
 				while [ $fb_status != 0 ]
 				do
+                    fix_lirc_socket
 					try_smolt
 					if [ $fb_status != 0  ]
 					then
-- 
cgit v0.12

