From 7d8a4f93e15f61418ea89666b57063111700dc7e Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Wed, 3 Aug 2011 22:49:59 +0000
Subject: mythexport: Upgrade to 2.2.3 -- needs testing

---
 abs/extra/mythexport/PKGBUILD                      | 38 ++++++++++---
 abs/extra/mythexport/mythexport-2.2.3-1.src.tar.gz |  1 +
 abs/extra/mythexport/mythexport.install            | 65 ++++++++++++++++++++++
 abs/extra/mythexport/mythexport.lighttpd.include   |  3 +
 4 files changed, 100 insertions(+), 7 deletions(-)
 create mode 120000 abs/extra/mythexport/mythexport-2.2.3-1.src.tar.gz
 create mode 100644 abs/extra/mythexport/mythexport.lighttpd.include

diff --git a/abs/extra/mythexport/PKGBUILD b/abs/extra/mythexport/PKGBUILD
index 3cd04f3..6fd3000 100644
--- a/abs/extra/mythexport/PKGBUILD
+++ b/abs/extra/mythexport/PKGBUILD
@@ -2,16 +2,40 @@
 # Maintainer: Cecil Watson<knoppmyth@gmail.com>
 
 pkgname=mythexport
-pkgver=2.0.71
-pkgrel=5
-pkgdesc="Script to export recordings for portable devices."
+pkgver=2.2.3
+pkgrel=1
+pkgdesc="Export MythTV recording to portable media players"
 arch=('i686' 'x86_64')
 license=('GPL3')
-depends=('atomicparsley' 'perl-config-simple' 'perl-net-upnp' 'perl-proc-daemon' 'perl-proc-pid-file')
-url="http://linhes.org/"
-source=(ftp://ftp.knoppmyth.net/R6/sources/mythexport.tar.bz2)
+depends=('atomicparsley' 'perl-config-simple' 'perl-net-upnp'
+         'perl-proc-daemon' 'perl-proc-pid-file')
+optdepends=('lighttpd: For web based interaction')
+url="http://www.ubuntuupdates.org/mythexport"
+source=(https://launchpad.net/ubuntu/natty/+source/${pkgname}/${pkgver}-0ubuntu1/+files/${pkgname}_${pkgver}.orig.tar.gz
+        mythexport.lighttpd.include)
 install=mythexport.install
 
 build() {
-  cp -a mythexport/* $startdir/pkg
+
+  /bin/true
+
+}
+
+package() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+  cp -a ./usr ${pkgdir}/ || return 1
+
+  # Install lighttpd include file
+  install -D -m644 ${srcdir}/mythexport.lighttpd.include ${pkgdir}/etc/mythexport/mythexport.lighttpd.include
+
+  # Compress man pages
+  gzip -9 *.1
+  install -D -m644 mythexport.1.gz ${pkgdir}/usr/share/man/man1/mythexport.1.gz || return 1
+  install -D -m644 mythimport.1.gz ${pkgdir}/usr/share/man/man1/mythimport.1.gz || return 1
+
+  # Standard GPL3 license text already in distro
+  rm -f ${pkgdir}/COPYING
+
 }
+md5sums=('a780c00536a4680ce7d79057658971c8'
+         'b08404255abcc99a35e9c1ab8e0dec57')
diff --git a/abs/extra/mythexport/mythexport-2.2.3-1.src.tar.gz b/abs/extra/mythexport/mythexport-2.2.3-1.src.tar.gz
new file mode 120000
index 0000000..3d55272
--- /dev/null
+++ b/abs/extra/mythexport/mythexport-2.2.3-1.src.tar.gz
@@ -0,0 +1 @@
+/data/pkg_repo/packages/mythexport-2.2.3-1.src.tar.gz
\ No newline at end of file
diff --git a/abs/extra/mythexport/mythexport.install b/abs/extra/mythexport/mythexport.install
index edd60f5..a6a2085 100644
--- a/abs/extra/mythexport/mythexport.install
+++ b/abs/extra/mythexport/mythexport.install
@@ -3,8 +3,73 @@ post_install() {
 	mysql -u root mythconverg < /usr/share/mythtv/mythexport.sql
 	ln -s /usr/share/mythtv/mythexport /data/srv/httpd/htdocs/
 	ln -s /myth/archive /usr/share/mythtv/mythexport/video
+
+  COUNT=`grep -c "include \"/etc/mythexport/mythexport.lighttpd.include\"" /etc/lighttpd/conf.include`
+
+  if [ $COUNT == 0 ] ; then
+    echo "==> Adding mythexport.lighttpd.include to conf.include"
+    echo "include \"/etc/mythexport/mythexport.lighttpd.include\"" >> \
+         /etc/lighttpd/conf.include
+  fi
+
+  echo ""
+  echo "==> Forcing a re-read of lighttpd's configuration file."
+  echo ""
+    /sbin/sv hup /service/lighttpd
+
+  echo ""
+  echo "==> Add the mythexport service to start the mythexport daemon"
+  echo "==> $ sudo add_service.sh mythexport"
+  echo ""
+
+  echo ""
+  echo "==> For move information on setup and configuration:"
+  echo "==> http://www.linhes.org/bugs/projects/linhes/wiki/HOWTO_Setup_MythExport_for_iPod"
+  echo ""
+
+}
+
+post_upgrade() {
+
+  COUNT=`grep -c "include \"/etc/mythexport/mythexport.lighttpd.include\"" /etc/lighttpd/conf.include`
+
+  if [ $COUNT == 0 ] ; then
+    echo "==> Adding mythexport.lighttpd.include to conf.include"
+    echo "include \"/etc/mythexport/mythexport.lighttpd.include\"" >> \
+         /etc/lighttpd/conf.include
+  fi
+
+  echo ""
+  echo "==> Forcing a re-read of lighttpd's configuration file."
+  echo ""
+    /sbin/sv hup /service/lighttpd
+
 }
 
+pre_remove() {
+
+  remove_service.sh mythexport
+
+}
+
+post_remove() {
+
+  COUNT=`grep -c "include \"/etc/mythexport/mythexport.lighttpd.include\"" /etc/lighttpd/conf.include`
+
+  if [ $COUNT -gt 0 ] ; then
+    echo "==> Removing mythexport.lighttpd.include from conf.include"
+    sed -e 's#include \"/etc/mythexport/mythexport.lighttpd.include\"##' -i \
+         /etc/lighttpd/conf.include
+  fi
+
+  echo ""
+  echo "==> Forcing re-read of lighttpd's configuration file."
+  echo ""
+    /sbin/sv hup /service/lighttpd
+}
+
+
+
 op=$1
 shift
 $op $*
diff --git a/abs/extra/mythexport/mythexport.lighttpd.include b/abs/extra/mythexport/mythexport.lighttpd.include
new file mode 100644
index 0000000..b846507
--- /dev/null
+++ b/abs/extra/mythexport/mythexport.lighttpd.include
@@ -0,0 +1,3 @@
+$HTTP["url"] =~ "/mythexport/" {
+        cgi.assign = ( ".cgi" => "/usr/bin/perl" )
+      }
-- 
cgit v0.12

