From fd6ce7a9788aeb0800a18cf5b99e615c90d16677 Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Wed, 3 Aug 2011 01:33:41 +0000
Subject: lirc: Add upgrade logic to change LircSocket to /var/run/lirc/lircd.
 Closes #745

---
 abs/core/lirc/PKGBUILD                | 24 ++++++++++++------------
 abs/core/lirc/lirc-0.9.0-5.src.tar.gz |  1 +
 abs/core/lirc/lirc.install            | 18 ++++++++++++++++++
 3 files changed, 31 insertions(+), 12 deletions(-)
 create mode 120000 abs/core/lirc/lirc-0.9.0-5.src.tar.gz

diff --git a/abs/core/lirc/PKGBUILD b/abs/core/lirc/PKGBUILD
index 2f63d9a..14c4962 100644
--- a/abs/core/lirc/PKGBUILD
+++ b/abs/core/lirc/PKGBUILD
@@ -4,7 +4,7 @@
 pkgbase=lirc
 pkgname=('lirc' 'lirc-utils')
 pkgver=0.9.0
-pkgrel=4
+pkgrel=5
 #epoch=1
 _kernver=2.6.39-LinHES
 arch=('i686' 'x86_64')
@@ -18,17 +18,6 @@ source=(http://prdownloads.sourceforge.net/${pkgbase}/${pkgbase}-${pkgver}.tar.b
         lirc_atiusb-kfifo.patch
         kernel-2.6.39.patch
 	lircd lircmd lirc.logrotate lircd.conf irexec.conf irexecd)
-md5sums=('b232aef26f23fe33ea8305d276637086'
-         '1cce37e18e3f6f46044abab29016d18f'
-         'b70cc9640505205446ec47b7d4779f38'
-         '1f8b104a2365d9f93404b143f499059b'
-         '087a7d102e1c96bf1179f38db2b0b237'
-         '8d0e238dc0eda95e340fe570605da492'
-         '85f7fdac55e5256967241864049bf5e9'
-         '3deb02604b37811d41816e9b4385fcc3'
-         '5b1f8c9cd788a39a6283f93302ce5c6e'
-         'f0c0ac930326168035f0c8e24357ae55'
-         '69d099e6deedfa3c1ee2b6e82d9b8bfb')
 
 build() {
   cd "${srcdir}/lirc-${pkgver}"
@@ -101,3 +90,14 @@ package_lirc-utils() {
   # remove built modules
   rm -r "${pkgdir}/lib/"
 }
+md5sums=('b232aef26f23fe33ea8305d276637086'
+         '1cce37e18e3f6f46044abab29016d18f'
+         'b70cc9640505205446ec47b7d4779f38'
+         '1f8b104a2365d9f93404b143f499059b'
+         '087a7d102e1c96bf1179f38db2b0b237'
+         '8d0e238dc0eda95e340fe570605da492'
+         '85f7fdac55e5256967241864049bf5e9'
+         '1f5611304c1cdcd1f0696468f58b87de'
+         '5b1f8c9cd788a39a6283f93302ce5c6e'
+         'f0c0ac930326168035f0c8e24357ae55'
+         '69d099e6deedfa3c1ee2b6e82d9b8bfb')
diff --git a/abs/core/lirc/lirc-0.9.0-5.src.tar.gz b/abs/core/lirc/lirc-0.9.0-5.src.tar.gz
new file mode 120000
index 0000000..c758f27
--- /dev/null
+++ b/abs/core/lirc/lirc-0.9.0-5.src.tar.gz
@@ -0,0 +1 @@
+/data/pkg_repo/packages/lirc-0.9.0-5.src.tar.gz
\ No newline at end of file
diff --git a/abs/core/lirc/lirc.install b/abs/core/lirc/lirc.install
index 814312e..1f8fd7c 100644
--- a/abs/core/lirc/lirc.install
+++ b/abs/core/lirc/lirc.install
@@ -8,6 +8,24 @@ post_install() {
 
 post_upgrade() {
   post_install
+
+  . /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 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
 }
 
 # arg 1:  the old package version
-- 
cgit v0.12