From 1c93373465c75d2d115cc9da72cfa5ff21f3867e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 9 Mar 2009 09:56:27 -0500
Subject: Create moblock-control-update script and add it to cron. create
 /var/spool/mblock/used modify blocklists.list REF FS#261

---
 abs/extra-testing/community/moblock/PKGBUILD       |  2 +-
 .../community/moblock/moblock.install              | 12 ++++++----
 .../community/moblockcontrol/PKGBUILD              | 10 +++++---
 .../moblockcontrol/moblock-control-update.sh       |  3 +++
 .../moblockcontrol/moblockcontrol.install          | 28 ++++++++++++++++++++++
 5 files changed, 47 insertions(+), 8 deletions(-)
 create mode 100644 abs/extra-testing/community/moblockcontrol/moblock-control-update.sh
 create mode 100644 abs/extra-testing/community/moblockcontrol/moblockcontrol.install

diff --git a/abs/extra-testing/community/moblock/PKGBUILD b/abs/extra-testing/community/moblock/PKGBUILD
index 283eb8c..f6c7e51 100755
--- a/abs/extra-testing/community/moblock/PKGBUILD
+++ b/abs/extra-testing/community/moblock/PKGBUILD
@@ -3,7 +3,7 @@
 
 pkgname=moblock
 pkgver=0.9rc2
-pkgrel=7
+pkgrel=8
 pkgdesc="Console application that blocks connections from/to hosts listed in a file in peerguardian format"
 arch=('i686' 'x86_64')
 url="http://moblock.berlios.de/"
diff --git a/abs/extra-testing/community/moblock/moblock.install b/abs/extra-testing/community/moblock/moblock.install
index 6afe1d5..c7715e7 100644
--- a/abs/extra-testing/community/moblock/moblock.install
+++ b/abs/extra-testing/community/moblock/moblock.install
@@ -7,6 +7,10 @@ post_install() {
     echo ">>> moblock-update script no longer uses /var/spool/moblock"
     echo ">>> as a temporary directory.  You can safely delete it."
     echo ""
+    if [ ! -d /var/spool/moblock/used ]
+    then
+        mkdir -p /var/spool/moblock/used
+    fi
 }
 
 post_upgrade() {
@@ -14,10 +18,10 @@ post_upgrade() {
     if [ -h /usr/lib/libnfnetlink.so.1 ]; then
         rm /usr/lib/libnfnetlink.so.1
     fi
-    echo ""
-    echo ">>> moblock-update script no longer uses /var/spool/moblock"
-    echo ">>> as a temporary directory.  You can safely delete it."
-    echo ""
+    if [ ! -d /var/spool/moblock/used ]
+    then
+        mkdir -p /var/spool/moblock/used
+   fi
 }
 
 op=$1
diff --git a/abs/extra-testing/community/moblockcontrol/PKGBUILD b/abs/extra-testing/community/moblockcontrol/PKGBUILD
index f13e48c..5a912e2 100644
--- a/abs/extra-testing/community/moblockcontrol/PKGBUILD
+++ b/abs/extra-testing/community/moblockcontrol/PKGBUILD
@@ -2,7 +2,7 @@
 
 pkgname=moblockcontrol
 pkgver=1.0
-pkgrel=8
+pkgrel=10
 pkgdesc="moblock-control"
 arch=('i686' 'x86_64')
 url="http://moblock-deb.sourceforge.net/"
@@ -10,9 +10,9 @@ license=('GPL')
 groups=()
 depends=('moblock')
 makedepends=()
-install=
+install=moblockcontrol.install
 source=(http://download.sourceforge.net/moblock-deb/moblock-control-1.0.tar.gz \
-		moblock_control.patch)
+		moblock_control.patch moblock-control-update.sh)
 md5sums=('1399e5465028e116e941cd1e01f6f7fc'
 			'dc269c6c47bc423b9093919d52e97d63')
 backup=('etc/moblock/moblock.conf' 'etc/moblock/blocklists.list')
@@ -34,5 +34,9 @@ build() {
   
   touch ${pkgdir}/var/log/moblock-control.log
   touch ${pkgdir}/etc/moblock/guarding.p2p 
+    
+  cd $startdir/src
+  install -m 755 moblock-control-update.sh ${pkgdir}/usr/bin/moblock-control-update.sh   
+  sed -i "s/config\/templist.gz/config\/badpeers.gz/" $startdir/pkg/etc/moblock/blocklists.list
 }
 
diff --git a/abs/extra-testing/community/moblockcontrol/moblock-control-update.sh b/abs/extra-testing/community/moblockcontrol/moblock-control-update.sh
new file mode 100644
index 0000000..8da564d
--- /dev/null
+++ b/abs/extra-testing/community/moblockcontrol/moblock-control-update.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+. /etc/profile
+/usr/bin/moblock-control update
diff --git a/abs/extra-testing/community/moblockcontrol/moblockcontrol.install b/abs/extra-testing/community/moblockcontrol/moblockcontrol.install
new file mode 100644
index 0000000..439a3ee
--- /dev/null
+++ b/abs/extra-testing/community/moblockcontrol/moblockcontrol.install
@@ -0,0 +1,28 @@
+post_install() {
+    if [ ! -d /var/spool/moblock/used ]
+    then
+        mkdir -p /var/spool/moblock/used
+    fi
+
+    if [ ! -e /etc/cron.daily/moblock-control-update.sh ]
+    then
+        ln -s /usr/bin/moblock-control-update.sh /etc/cron.daily/moblock-control-update.sh
+    fi
+}
+
+post_upgrade() {
+    if [ ! -d /var/spool/moblock/used ]
+    then
+        mkdir -p /var/spool/moblock/used
+    fi
+
+    if [ ! -e /etc/cron.daily/moblock-control-update.sh ]
+    then
+        ln -s /usr/bin/moblock-control-update.sh /etc/cron.daily/moblock-control-update.sh
+    fi
+}
+
+op=$1
+shift
+$op $*
+
-- 
cgit v0.12