From 4be23d4482a7aec8820be8fa373bc8de5a0272b5 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sat, 3 Nov 2012 12:59:45 -0500
Subject: mythweb, mythexport,zoneminder, web_auth: convert packages to use
 gen_light_include.conf

refs #864
closes #864
---
 abs/core/LinHES-config/PKGBUILD                    |  4 +--
 abs/core/LinHES-config/mv_webuser.py               | 17 +++++++++---
 abs/core/mythtv/stable-0.25/mythweb/PKGBUILD       |  9 ++++---
 .../mythtv/stable-0.25/mythweb/mythweb.install     | 18 ++-----------
 .../stable-0.25/mythweb/mythweb_gen_light.conf     |  1 +
 abs/core/zoneminder/PKGBUILD                       |  7 ++++-
 abs/core/zoneminder/__changelog                    |  2 ++
 abs/core/zoneminder/gen_light_zm.conf              |  1 +
 abs/core/zoneminder/zm_gen_light.conf              |  1 +
 abs/core/zoneminder/zoneminder.install             | 28 +++++---------------
 abs/extra/mythexport/PKGBUILD                      |  9 +++++--
 abs/extra/mythexport/mythexport.install            | 30 +++-------------------
 abs/extra/mythexport/mythexport_gen_light.conf     |  1 +
 13 files changed, 51 insertions(+), 77 deletions(-)
 create mode 100644 abs/core/mythtv/stable-0.25/mythweb/mythweb_gen_light.conf
 create mode 100644 abs/core/zoneminder/gen_light_zm.conf
 create mode 100644 abs/core/zoneminder/zm_gen_light.conf
 create mode 100644 abs/extra/mythexport/mythexport_gen_light.conf

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index b86421e..daacaf2 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=175
+pkgrel=177
 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'
@@ -156,7 +156,7 @@ md5sums=('6a9a22b3c3cb74d9f1ac595cf437a7b7'
          '824e49d9b01fed295c704ab68908b464'
          'fe5e31b833cc6707209e9d656b6eb53c'
          'ecb52b9b7a9ac0c8988093c1dfdda635'
-         '23d0e12b7ca1cc6ea6b993c1d7ff20b9'
+         '087a0ef743bc8af915503f8773536ce4'
          '1aa69e89034def751177cbd96c64e4ef'
          'b4900090d841d3e390cb840cf16afd85'
          '6dd202ec664ede468e42edf600f7913d'
diff --git a/abs/core/LinHES-config/mv_webuser.py b/abs/core/LinHES-config/mv_webuser.py
index 3e383f2..e349e0b 100755
--- a/abs/core/LinHES-config/mv_webuser.py
+++ b/abs/core/LinHES-config/mv_webuser.py
@@ -8,16 +8,25 @@ def setup_web_auth(UseMythWEB_auth):
         return
 
     logging.info("____Start of setup_web_auth____")
+    include_file="/etc/gen_light_conf.d/auth.conf"
     if UseMythWEB_auth == str(1):
-        #enable auth
         logging.info("    Enabling authorization for mythweb")
-        cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
-        mv_common.runcmd(cmd)
+        try:
+            fo = open(include_file, "w")
+            out_string='''include "/etc/lighttpd/auth-inc.conf"'''
+            fo.write(out_string)
+            fo.close()
+        except:
+            logging.info("    Couldn't open auth include file")
+
     else:
         #disable auth
         logging.info("    Disabling authorization for mythweb")
-        cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/#include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf'''
+        cmd="rm -f %s" %include_file
         mv_common.runcmd(cmd)
+    logging.debug("Running gen_light_include.py")
+    cmd="/usr/LH/bin/gen_light_include.py"
+    mv_common.runcmd(cmd)
     logging.debug("Restarting lighttpd")
     cmd="sudo sv restart lighttpd"
     mv_common.runcmd(cmd)
diff --git a/abs/core/mythtv/stable-0.25/mythweb/PKGBUILD b/abs/core/mythtv/stable-0.25/mythweb/PKGBUILD
index 7c0cc8d..5e1c853 100644
--- a/abs/core/mythtv/stable-0.25/mythweb/PKGBUILD
+++ b/abs/core/mythtv/stable-0.25/mythweb/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythweb
 pkgver=0.25
-pkgrel=5
+pkgrel=6
 
 commit_hash=`cat ../git_src/git_hash_web`
 
@@ -14,7 +14,7 @@ groups=('mythtv-extras')
 install=mythweb.install
 #http://code.mythtv.org/trac/ticket/10504
 patches=(schedules.php.patch  sorting.php.patch  tv-schedules.php.patch)
-source=(`echo ${patches[@]:0}` mythweb.include)
+source=(`echo ${patches[@]:0}` mythweb.include mythweb_gen_light.conf)
 
 DOCROOT=/data/srv/httpd/mythweb
 build() {
@@ -64,9 +64,12 @@ build() {
     #install conf files for lighttpd
     mkdir -p $pkgdir/etc/lighttpd
     install -D -m 644 $srcdir/mythweb.include          $pkgdir/etc/lighttpd/
+    #gen_light_conf
+    install -D -m0744 ${srcdir}/mythweb_gen_light.conf ${pkgdir}/etc/gen_light_conf.d/mythweb.conf
 
 }
 md5sums=('392e570594859c026ac12194920246d8'
          '53cc59d6a8bf144027b25d5dcbfffc66'
          '515e29fda503c199888a91553e1815a0'
-         '7645a6399434cbba35639713ac5d88e0')
+         '7645a6399434cbba35639713ac5d88e0'
+         'df190116b3aba35720fb6631885f973f')
diff --git a/abs/core/mythtv/stable-0.25/mythweb/mythweb.install b/abs/core/mythtv/stable-0.25/mythweb/mythweb.install
index f5abcea..0073499 100644
--- a/abs/core/mythtv/stable-0.25/mythweb/mythweb.install
+++ b/abs/core/mythtv/stable-0.25/mythweb/mythweb.install
@@ -1,13 +1,5 @@
 post_install() {
- COUNT=`grep -c "mythweb.include" /etc/lighttpd/conf.include`
- if [ $COUNT == 0 ]
- then
-    echo "==> Adding mythweb.include to conf.include"
-    echo "include \"/etc/lighttpd/mythweb.include\""  >>  /etc/lighttpd/conf.include
- fi
- echo
- echo "==> Forcing a re-read of lighttpd's configuration file."
- echo ""
+ gen_light_include.py
   /sbin/sv hup /service/lighttpd
 }
 post_upgrade() {
@@ -16,13 +8,7 @@ post_upgrade() {
 }
 
 post_remove() {
- COUNT=`grep -c "mythweb.include" /etc/lighttpd/conf.include`
- if [ $COUNT -gt 0 ]
- then
-      echo "==> Removing mythweb.include from conf.include"
-      sed -i 's#include \"/etc/lighttpd/mythweb.include\"##' -i  /etc/lighttpd/conf.include
- fi
-
+ gen_light_include.py
  echo
  echo "==> Forcing a re-read of lighttpd's configuration file."
  echo ""
diff --git a/abs/core/mythtv/stable-0.25/mythweb/mythweb_gen_light.conf b/abs/core/mythtv/stable-0.25/mythweb/mythweb_gen_light.conf
new file mode 100644
index 0000000..ddf0d2f
--- /dev/null
+++ b/abs/core/mythtv/stable-0.25/mythweb/mythweb_gen_light.conf
@@ -0,0 +1 @@
+include "/etc/lighttpd/mythweb.include"
diff --git a/abs/core/zoneminder/PKGBUILD b/abs/core/zoneminder/PKGBUILD
index 4dc5c63..9ea64a5 100644
--- a/abs/core/zoneminder/PKGBUILD
+++ b/abs/core/zoneminder/PKGBUILD
@@ -63,6 +63,7 @@ source=(
   patch-ffmpeg-0.11.patch
   zm.include
   zm.sysctrl.conf
+  zm_gen_light.conf
 )
 
 
@@ -193,9 +194,12 @@ package() {
 
   ln -s /usr/share/cambozola/cambozola.jar $pkgdir/data/srv/httpd/$pkgname
   mkdir -p $pkgdir/etc/lighttpd
+
   install -D -m 644 $srcdir/zm.include          $pkgdir/etc/lighttpd/
   #sysctrl conf
   install -o root -g root  -D -m 0755 $srcdir/zm.sysctrl.conf $startdir/pkg/etc/sysctl.d/zm.conf
+  #gen_light_conf
+  install -D -m0744 ${srcdir}/zm_gen_light.conf ${pkgdir}/etc/gen_light_conf.d/zoneminder.conf
 
   install -D -m 644 $srcdir/httpd-$pkgname.conf $pkgdir/etc/httpd/conf/extra
   install -D -m 644 $srcdir/$pkgname            $pkgdir/etc/rc.d
@@ -210,4 +214,5 @@ md5sums=('eaefa14befd482154970541252aa1a39'
          'ca3fe00739707b9f92eaaa9034d4da2b'
          '81c8be870260142e2633eedf73c72040'
          '9d93f9b7b0a1384df533efde19ed3021'
-         '9a60f8b9af050220e1cb86da438952b3')
+         '9a60f8b9af050220e1cb86da438952b3'
+         '81cb12b36616a299ec808ac70a809ec2')
diff --git a/abs/core/zoneminder/__changelog b/abs/core/zoneminder/__changelog
index e7181bc..5ebce4d 100644
--- a/abs/core/zoneminder/__changelog
+++ b/abs/core/zoneminder/__changelog
@@ -3,6 +3,7 @@ Change cgidir and webdir:
 --
 added zm.include for lighttpd
 added zm.sysctrl.conf  to set the shared mem
+added zm_gen_light.conf
 --
 run file
 
@@ -13,3 +14,4 @@ Removed modifications of php.ini
 Added remove/add of zm.include in post install/remove
 added install_db
 add http to video group
+gen_light_conf.py
diff --git a/abs/core/zoneminder/gen_light_zm.conf b/abs/core/zoneminder/gen_light_zm.conf
new file mode 100644
index 0000000..3716bb0
--- /dev/null
+++ b/abs/core/zoneminder/gen_light_zm.conf
@@ -0,0 +1 @@
+include "/etc/lighttpd/zm.include"
diff --git a/abs/core/zoneminder/zm_gen_light.conf b/abs/core/zoneminder/zm_gen_light.conf
new file mode 100644
index 0000000..3716bb0
--- /dev/null
+++ b/abs/core/zoneminder/zm_gen_light.conf
@@ -0,0 +1 @@
+include "/etc/lighttpd/zm.include"
diff --git a/abs/core/zoneminder/zoneminder.install b/abs/core/zoneminder/zoneminder.install
index c2e1cb8..bf5cd99 100644
--- a/abs/core/zoneminder/zoneminder.install
+++ b/abs/core/zoneminder/zoneminder.install
@@ -60,23 +60,17 @@ post_install() {
   fi
 #---
  usermod -G video http
- COUNT=`grep -c "zm.include" /etc/lighttpd/conf.include`
- if [ $COUNT == 0 ]
- then
-    echo "==> Adding zm.include to conf.include"
-    echo "include \"/etc/lighttpd/zm.include\""  >>  /etc/lighttpd/conf.include
- fi
- echo
- echo "==> Forcing a re-read of lighttpd's configuration file."
- echo ""
-  /sbin/sv hup /service/lighttpd
-
  install_db
+ gen_light_include.py
+ /sbin/sv hup /service/lighttpd
 #---
 }
+
 post_upgrade() {
   post_install
   /usr/bin/zmupdate.pl -f >/dev/null
+  gen_light_include.py
+  /sbin/sv hup /service/lighttpd
 }
 
 post_remove() {
@@ -85,17 +79,7 @@ post_remove() {
   fi
 
 #--
- COUNT=`grep -c "zm.include" /etc/lighttpd/conf.include`
- if [ $COUNT -gt 0 ]
- then
-      echo "==> Removing zm.include from conf.include"
-      sed -i 's#include \"/etc/lighttpd/zm.include\"##' -i  /etc/lighttpd/conf.include
- fi
-
-
- echo
- echo "==> Forcing a re-read of lighttpd's configuration file."
- echo ""
+ gen_light_include.py
   /sbin/sv hup /service/lighttpd
 #--
 
diff --git a/abs/extra/mythexport/PKGBUILD b/abs/extra/mythexport/PKGBUILD
index 1a51bd2..9a973e5 100644
--- a/abs/extra/mythexport/PKGBUILD
+++ b/abs/extra/mythexport/PKGBUILD
@@ -13,8 +13,9 @@ depends=('atomicparsley' 'perl-config-simple' 'perl-net-upnp' 'perl-xml-rss'
 optdepends=('lighttpd: For web based interaction')
 url="http://www.ubuntuupdates.org/mythexport"
 source=(https://launchpad.net/ubuntu/precise/+source/${pkgname}/${pkgver}-0ubuntu2/+files/${pkgname}_${pkgver}.orig.tar.gz
-        mythexport.lighttpd.include
-	linhes.diff)
+        mythexport.lighttpd.include mythexport_gen_light.conf
+	    linhes.diff
+	    )
 install=mythexport.install
 
 build() {
@@ -32,6 +33,9 @@ package() {
   # Install lighttpd include file
   install -D -m644 ${srcdir}/mythexport.lighttpd.include ${pkgdir}/etc/mythexport/mythexport.lighttpd.include
 
+  #gen_light_conf
+  install -D -m0744 ${srcdir}/mythexport_gen_light.conf ${pkgdir}/etc/gen_light_conf.d/mythexport.conf
+
   # Compress man pages
   gzip -9 *.1
   install -D -m644 mythexport.1.gz ${pkgdir}/usr/share/man/man1/mythexport.1.gz || return 1
@@ -43,4 +47,5 @@ package() {
 }
 md5sums=('a780c00536a4680ce7d79057658971c8'
          'b08404255abcc99a35e9c1ab8e0dec57'
+         'e6f84aa222eddf803a81d1b92a315d06'
          'e32369bb2fde6352798e3522d67527b2')
diff --git a/abs/extra/mythexport/mythexport.install b/abs/extra/mythexport/mythexport.install
index a599f2d..2718715 100644
--- a/abs/extra/mythexport/mythexport.install
+++ b/abs/extra/mythexport/mythexport.install
@@ -17,15 +17,7 @@ post_install() {
 	chown mythtv:mythtv /var/run/mythtv
 	chown -R mythtv:mythtv /etc/mythtv
 
-  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 ""
+  gen_light_include.py
   echo "==> Forcing a re-read of lighttpd's configuration file."
   echo ""
     /sbin/sv hup /service/lighttpd
@@ -45,15 +37,7 @@ post_install() {
 }
 
 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
-
+  gen_light_include.py
   echo ""
   echo "==> Forcing a re-read of lighttpd's configuration file."
   echo ""
@@ -68,15 +52,7 @@ pre_remove() {
 }
 
 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
-
+  gen_light_include.py
   echo ""
   echo "==> Forcing re-read of lighttpd's configuration file."
   echo ""
diff --git a/abs/extra/mythexport/mythexport_gen_light.conf b/abs/extra/mythexport/mythexport_gen_light.conf
new file mode 100644
index 0000000..f495657
--- /dev/null
+++ b/abs/extra/mythexport/mythexport_gen_light.conf
@@ -0,0 +1 @@
+include "/etc/mythexport/mythexport.lighttpd.include"
-- 
cgit v0.12

