Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=c268595e0408180a265b016267765c4c6d41192e

commit c268595e0408180a265b016267765c4c6d41192e
Author: James Buren <[email protected]>
Date:   Sun Jul 29 11:24:11 2012 -0500

p3scan-2.3.2-5-x86_64
* convert to systemd schema

diff --git a/source/network-extra/p3scan/FrugalBuild 
b/source/network-extra/p3scan/FrugalBuild
index 682777a..4e1c795 100644
--- a/source/network-extra/p3scan/FrugalBuild
+++ b/source/network-extra/p3scan/FrugalBuild
@@ -4,20 +4,26 @@

pkgname=p3scan
pkgver=2.3.2
-pkgrel=4
+pkgrel=5
pkgdesc="This is a full-transparent proxy-server for email clients"
Finclude sourceforge
url="http://p3scan.sourceforge.net/";
license="GPL2"
up2date="lynx -dump $url|grep -m 1 -o '[0-9\.]\+\.[0-9]'"
-source=($source README.frugalware rc.$pkgname)
+source=($source README.frugalware rc.$pkgname $pkgname.service fixes.patch)
sha1sums=('bc2d01699d34183e78cef44ac6a229326473d5d4' \
'bf88e004e2d96f492930966b8b06c1c4d3421d4f' \
-          'e35372c6cc7b548794367c886cb5ddeb81b86f15')
+          'e35372c6cc7b548794367c886cb5ddeb81b86f15' \
+          '8e4123923d92a90d1330dfd9005dc6e08ef1305e' \
+          '0e8fe0d1ebc9c6d2fa2a593fcc2a04d8b3ee11b9')
groups=('network-extra')
archs=('i686' 'x86_64')
depends=('openssl>=1.0.0' 'pcre>=8.30')
backup=(etc/p3scan/p3scan.conf etc/p3scan/p3scan.mail)
+_F_systemd_scriptlet="$pkgname.install"
+_F_sysvinit_units=($pkgname)
+_F_systemd_units=($pkgname=)
+Finclude systemd

build()
{
@@ -25,7 +31,6 @@ build()
Fsed '^CFLAGS=.*' "& $CFLAGS" Makefile
Fmkdir /etc/rc.d /usr/man/man8 /usr/sbin
Fbuild
-       Fln p3scan-en.mail /etc/p3scan/p3scan.mail
Fdoc README.frugalware
Frcd2
Frm /var/run
@@ -33,6 +38,9 @@ build()
cat > $Fdestdir/etc/tmpfiles.d/p3scan.conf << EOF
d $Flocalstatedir/run/p3scan 0755 mail mail -
EOF
+       Frm /etc/p3scan/p3scan.mail
+       Ffile /lib/systemd/system/$pkgname.service
+       Fgenscriptlet
}

# optimization OK
diff --git a/source/network-extra/p3scan/fixes.patch 
b/source/network-extra/p3scan/fixes.patch
new file mode 100644
index 0000000..6f0e823
--- /dev/null
+++ b/source/network-extra/p3scan/fixes.patch
@@ -0,0 +1,80 @@
+diff -ur a/p3scan.conf b/p3scan.conf
+--- a/p3scan.conf      2012-07-29 11:20:50.941315744 -0500
++++ b/p3scan.conf      2012-07-29 11:21:27.501585396 -0500
+@@ -7,41 +7,41 @@
+ #                                                                        #
+ ##########################################################################
+
+-/*
+- * P3Scan v2.3.2
+- *
+- * (C) 2003-2005 by Jack S. Lai <[email protected]>
+- *
+- * It's intent is to provide a follow on program to POP3-Virusscan-Proxy 0.4
+- * by Folke Ashberg <[email protected]>.
+- *
+- * It is based upon his program but provides numerous changes to include
+- * scanning pop3 mail for spam, hardening the program, addaption to todays
+- * email environment, and many other changes.
+- *
+- * The initial release of p3scan includes patches made and submitted to the
+- * original project but were never incorporated. Please see the README for
+- * further information.
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2 of the License, or
+- * (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+- *
+- * This program is released under the GPL with the additional exemption that
+- * compiling, linking, and/or using OpenSSL is allowed."
+- * (http://www.openssl.org/support/faq.html#LEGAL2)
+- *
+- */
++#/*
++# * P3Scan v2.3.2
++# *
++# * (C) 2003-2005 by Jack S. Lai <[email protected]>
++# *
++# * It's intent is to provide a follow on program to POP3-Virusscan-Proxy 0.4
++# * by Folke Ashberg <[email protected]>.
++# *
++# * It is based upon his program but provides numerous changes to include
++# * scanning pop3 mail for spam, hardening the program, addaption to todays
++# * email environment, and many other changes.
++# *
++# * The initial release of p3scan includes patches made and submitted to the
++# * original project but were never incorporated. Please see the README for
++# * further information.
++# *
++# * This program is free software; you can redistribute it and/or modify
++# * it under the terms of the GNU General Public License as published by
++# * the Free Software Foundation; either version 2 of the License, or
++# * (at your option) any later version.
++# *
++# * This program is distributed in the hope that it will be useful,
++# * but WITHOUT ANY WARRANTY; without even the implied warranty of
++# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# * GNU General Public License for more details.
++# *
++# * You should have received a copy of the GNU General Public License
++# * along with this program; if not, write to the Free Software
++# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++# *
++# * This program is released under the GPL with the additional exemption that
++# * compiling, linking, and/or using OpenSSL is allowed."
++# * (http://www.openssl.org/support/faq.html#LEGAL2)
++# *
++# */
+
+ #
+ # PID File
diff --git a/source/network-extra/p3scan/p3scan.install 
b/source/network-extra/p3scan/p3scan.install
index 066da11..8f7f416 100644
--- a/source/network-extra/p3scan/p3scan.install
+++ b/source/network-extra/p3scan/p3scan.install
@@ -1,7 +1,8 @@
+sysvinit_units=(@_F_sysvinit_units@)
+systemd_units=(@_F_systemd_units@)
+
post_install()
{
-       [ -h etc/p3scan/p3scan.mail ] && rm -f etc/p3scan/p3scan.mail
-
lang=`echo $LANG|cut -d _ -f 1`

[ "$lang" == "de" ] && lang="ge"
@@ -9,28 +10,60 @@ post_install()
[ "$lang" == "pt" -a "`echo $LANG|cut -d . -f 1|cut -d @ -f 1`" == "pt_BR" ] \
&& lang="pt-br"

-       if [ ! -e etc/p3scan/p3scan.mail -a -e etc/p3scan/p3scan-$lang.mail ] ; 
then
-               cp etc/p3scan/p3scan-$lang.mail etc/p3scan/p3scan.mail
+       if [ ! -e /etc/p3scan/p3scan.mail -a -e /etc/p3scan/p3scan-$lang.mail ] 
; then
+               cp /etc/p3scan/p3scan-$lang.mail /etc/p3scan/p3scan.mail
else
-               cp etc/p3scan/p3scan-en.mail etc/p3scan/p3scan.mail
+               cp /etc/p3scan/p3scan-en.mail /etc/p3scan/p3scan.mail
fi

-       echo "Please have a look on README.frugalware to know how to setup 
p3scan."
+       local unit
+       local op
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       for i in ${systemd_units[@]}; do
+               unit=$(echo $i | cut -f 1 -d '=')
+               op=$(echo $i | cut -f 2 -d '=')
+               if echo $op | grep -q 'e'; then
+                       systemctl enable $unit.service >/dev/null 2>&1
+               fi
+               if echo $op | grep -q 's'; then
+                       systemctl start $unit.service >/dev/null 2>&1
+               fi
+       done
+}
+
+post_upgrade()
+{
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       systemctl daemon-reload >/dev/null 2>&1
}

pre_remove()
{
-       [ -f var/run/p3scan/p3scan.pid ] && etc/rc.d/rc.p3scan stop
+       local unit
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       for i in ${systemd_units[@]}; do
+               unit=$(echo $i | cut -f 1 -d '=')
+               systemctl --no-reload disable $unit.service >/dev/null 2>&1
+               systemctl stop $unit.service >/dev/null 2>&1
+       done
}

-post_upgrade()
+post_remove()
{
-       [ -f var/run/p3scan/p3scan.pid ] && etc/rc.d/rc.p3scan restart
+       systemctl daemon-reload >/dev/null 2>&1
}

op=$1
shift
-
$op $*
-
-# vim: ft=sh
diff --git a/source/network-extra/p3scan/p3scan.service 
b/source/network-extra/p3scan/p3scan.service
new file mode 100644
index 0000000..25ef808
--- /dev/null
+++ b/source/network-extra/p3scan/p3scan.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=POP3 Virus Scanner Proxy Server
+After=network.target
+
+[Service]
+PIDFile=/var/run/p3scan/p3scan.pid
+ExecStart=/usr/sbin/p3scan
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to