pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail Add SMF manifest and method.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/21df13272657
branches:  trunk
changeset: 355982:21df13272657
user:      hans <hans%pkgsrc.org@localhost>
date:      Fri Dec 16 15:52:52 2016 +0000

description:
Add SMF manifest and method.

diffstat:

 mail/spamass-milter/Makefile                    |   4 +-
 mail/spamass-milter/files/smf/manifest.xml      |  66 +++++++++++++++++++
 mail/spamass-milter/files/smf/spamass-milter.sh |  86 +++++++++++++++++++++++++
 mail/spamassassin/Makefile                      |   6 +-
 mail/spamassassin/files/smf/manifest.xml        |  59 +++++++++++++++++
 mail/spamassassin/files/smf/spamassassin.sh     |  79 ++++++++++++++++++++++
 6 files changed, 297 insertions(+), 3 deletions(-)

diffs (truncated from 350 to 300 lines):

diff -r ae8d9ee0f5c5 -r 21df13272657 mail/spamass-milter/Makefile
--- a/mail/spamass-milter/Makefile      Fri Dec 16 15:47:35 2016 +0000
+++ b/mail/spamass-milter/Makefile      Fri Dec 16 15:52:52 2016 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.34 2016/12/07 00:36:24 wiedi Exp $
+# $NetBSD: Makefile,v 1.35 2016/12/16 15:56:05 hans Exp $
 #
 
 DISTNAME=      spamass-milter-0.4.0
+PKGREVISION=   1
 CATEGORIES=    mail
 MASTER_SITES=  http://savannah.nongnu.org/download/spamass-milt/
 
@@ -19,6 +20,7 @@
 CPPFLAGS.SunOS+=       -Du_int8_t=uint8_t
 
 RCD_SCRIPTS=   spamass-milter
+SMF_METHODS=   spamass-milter
 
 .include "../../mail/libmilter/buildlink3.mk"
 .include "../../mk/pthread.buildlink3.mk"
diff -r ae8d9ee0f5c5 -r 21df13272657 mail/spamass-milter/files/smf/manifest.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/spamass-milter/files/smf/manifest.xml        Fri Dec 16 15:52:52 2016 +0000
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+
+This file and its contents are supplied under the terms of the
+Common Development and Distribution License ("CDDL"), version 1.0.
+You may only use this file in accordance with the terms of version
+1.0 of the CDDL.
+A full copy of the text of the CDDL should have accompanied this
+source.  A copy of the CDDL is also available via the Internet at
+http://www.illumos.org/license/CDDL.
+
+-->
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+  Copyright 2016 Hans Rosenfeld <rosenfeld%grumpf.hope-2000.org@localhost>
+-->
+<service_bundle type='manifest' name='@SMF_NAME@'>
+  <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
+    <dependency name='filesystem_minimal' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/filesystem/local' />
+    </dependency>
+    <dependency name='loopback' grouping='require_any' restart_on='error' type='service'>
+      <service_fmri value='svc:/network/loopback' />
+    </dependency>
+    <dependency name='network' grouping='optional_all' restart_on='error' type='service'>
+      <service_fmri value='svc:/milestone/network' />
+    </dependency>
+    <dependency name='spamassassin' grouping='require_any' restart_on='error' type='service'>
+      <service_fmri value='svc:/@SMF_PREFIX@/spamassassin' />
+    </dependency>
+    <instance name='default' enabled='false'>
+      <exec_method type='method' name='start' exec='@PREFIX@/@SMF_METHOD_FILE.spamass-milter@ %m %i' timeout_seconds='60' />
+      <exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
+      <!-- Default property settings for spamass-milter(1) instance. -->
+      <property_group name='options' type='application'>
+        <!--   socket-path: pathname for milter socket -->
+        <propval name='socket-path' type='astring' value='/var/run/spamass-milter.sock' />
+        <!--   reject-code: SMTP reject code for rejected spam -->
+        <propval name='reject-code' type='astring' value='' />
+        <!--   reject-text: message text for rejected spam -->
+        <propval name='reject-text' type='astring' value='' />
+        <!--   reject-threshold: minimum spam score for rejecting spam -->
+        <propval name='reject-threshold' type='integer' value='' />
+        <!--   ignore-nets: comma-separated list of IP nets that can send mail unchecked-->
+        <propval name='ignore-nets' type='astring' value='' />
+        <!--   ignore-auth: don't scan mail from authenticated users -->
+        <propval name='ignore-auth' type='boolean' value='true' />
+        <!--   default-user: fallback user, and alway pass receipient user name to spamc -->
+        <propval name='default-user' type='astring' value='' />
+        <!--   lookup-users: call sendmail to translate receipient to user -->
+        <propval name='lookup-users' type='boolean' value='false' />
+        <!--   spamc-flags: flags passed verbatim to spamc -->
+        <propval name='spamc-flags' type='astring' value='' />
+      </property_group>
+    </instance>
+    <stability value='Unstable' />
+    <template>
+      <common_name>
+        <loctext xml:lang='C'>Spamassassin Milter</loctext>
+      </common_name>
+      <documentation>
+        <manpage title='spamass-milter' section='8' manpath='@PREFIX@/@PKGMANDIR@' />
+      </documentation>
+    </template>
+  </service>
+</service_bundle>
diff -r ae8d9ee0f5c5 -r 21df13272657 mail/spamass-milter/files/smf/spamass-milter.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/spamass-milter/files/smf/spamass-milter.sh   Fri Dec 16 15:52:52 2016 +0000
@@ -0,0 +1,86 @@
+#!@SMF_METHOD_SHELL@
+#
+# $NetBSD: spamass-milter.sh,v 1.1 2016/12/16 15:56:05 hans Exp $
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# Copyright 2016 Hans Rosenfeld <rosenfeld%grumpf.hope-2000.org@localhost>
+#
+
+# smf_method(5) start/stop script required for spamass-milter
+
+. /lib/svc/share/smf_include.sh
+
+
+get_config ()
+{   
+    cmdopts=""
+    # spamc-flags must be last
+    properties="socket-path reject-code reject-text reject-threshold ignore-nets ignore-auth default-user lookup-users spamc-flags"
+
+    for prop in $properties
+    do
+        value=`/usr/bin/svcprop -p options/${prop} ${SMF_FMRI}`
+        if [ -z "${value}" -o "${value}" = '""' ]; then
+            continue;
+        fi
+
+        case $prop in
+        'socket-path')
+            cmdopts="${cmdopts} -p ${value}"
+            ;;
+        'reject-code')
+            cmdopts="${cmdopts} -C ${value}"
+            ;;
+        'reject-text')
+            cmdopts="${cmdopts} -R ${value}"
+            ;;
+        'reject-threshold')
+            if [ ${value} != "0" ]; then
+                cmdopts="${cmdopts} -r ${value}"
+            fi
+            ;;
+        'ignore-nets')
+            cmdopts="${cmdopts} -i ${value}"
+            ;;
+        'ignore-auth')
+            if [ ${value} = "true" ]; then
+                cmdopts="${cmdopts} -a"
+            fi
+            ;;
+        'default-user')
+            cmdopts="${cmdopts} -u ${value}"
+            ;;
+        'lookup-users')
+            if [ ${value} = "true" ]; then
+                cmdopts="${cmdopts} -x"
+            fi
+            ;;
+        'spamc-flags')
+            value=`echo ${value} | sed -e 's/\\\\//g'`
+            cmdopts="${cmdopts} -- ${value}"
+            ;;
+        esac
+    done
+}
+
+result=${SMF_EXIT_OK}
+
+# Set defaults; SMF_FMRI should have been set, but just in case.
+if [ -z "$SMF_FMRI" ]; then
+    SMF_FMRI="svc:/@SMF_PREFIX@/@SMF_NAME@:${instance}"
+fi
+
+get_config
+
+# Execute spamd with relevant command line options.
+ppriv -s A-all -s A+basic,net_privaddr,file_dac_read,file_dac_search,sys_resource,proc_setid -e @PREFIX@/sbin/spamass-milter -f ${cmdopts}
+
+exit $?
diff -r ae8d9ee0f5c5 -r 21df13272657 mail/spamassassin/Makefile
--- a/mail/spamassassin/Makefile        Fri Dec 16 15:47:35 2016 +0000
+++ b/mail/spamassassin/Makefile        Fri Dec 16 15:52:52 2016 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.127 2016/11/10 20:25:50 roy Exp $
+# $NetBSD: Makefile,v 1.128 2016/12/16 15:52:52 hans Exp $
 
 DISTNAME=      Mail-SpamAssassin-3.4.1
 PKGNAME=       spamassassin-3.4.1
-PKGREVISION=   5
+PKGREVISION=   6
 CATEGORIES=    mail perl5
 MASTER_SITES=  ${MASTER_SITE_APACHE:=spamassassin/source/}
 DISTFILES=     ${DISTNAME}${EXTRACT_SUFX}
@@ -18,6 +18,8 @@
 
 .include "../../mk/bsd.prefs.mk"
 
+SMF_METHODS=   spamassassin
+
 RULESARCHIVE=  Mail-SpamAssassin-rules-3.4.1.r1675274.tgz
 #RULESARCHIVEASC=${RULESARCHIVE}.asc
 #RULESARCHIVESHA=${RULESARCHIVE}.sha1
diff -r ae8d9ee0f5c5 -r 21df13272657 mail/spamassassin/files/smf/manifest.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/spamassassin/files/smf/manifest.xml  Fri Dec 16 15:52:52 2016 +0000
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+
+This file and its contents are supplied under the terms of the
+Common Development and Distribution License ("CDDL"), version 1.0.
+You may only use this file in accordance with the terms of version
+1.0 of the CDDL.
+A full copy of the text of the CDDL should have accompanied this
+source.  A copy of the CDDL is also available via the Internet at
+http://www.illumos.org/license/CDDL.
+
+-->
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+  Copyright 2016 Hans Rosenfeld <rosenfeld%grumpf.hope-2000.org@localhost>
+-->
+<service_bundle type='manifest' name='@SMF_NAME@'>
+  <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
+    <dependency name='filesystem_minimal' grouping='require_all' restart_on='none' type='service'>
+      <service_fmri value='svc:/system/filesystem/local' />
+    </dependency>
+    <dependency name='loopback' grouping='require_any' restart_on='error' type='service'>
+      <service_fmri value='svc:/network/loopback' />
+    </dependency>
+    <dependency name='network' grouping='optional_all' restart_on='error' type='service'>
+      <service_fmri value='svc:/milestone/network' />
+    </dependency>
+    <instance name='default' enabled='false'>
+      <exec_method type='method' name='start' exec='@PREFIX@/@SMF_METHOD_FILE.spamassassin@ %m %i' timeout_seconds='60' />
+      <exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
+      <!-- Default property settings for spamd(1) instance. -->
+      <property_group name='options' type='application'>
+        <!--   allow-tell: Allow learning/reporting -->
+        <propval name='allow-tell' type='boolean' value='false' />
+        <!--   listen-on: Listen on IP addr and port -->
+        <propval name='listen-on' type='astring' value='' />
+        <!--   allowed-ips: Restrict to IP addresses which can connect -->
+        <propval name='allowed-ips' type='astring' value='' />
+        <!--   max-children: maximum number of children -->
+        <propval name='max-children' type='integer' value='' />
+        <!--   user: Run as username -->
+        <propval name='user' type='astring' value='' />
+        <!--   local-only: Perform only local tests on all mail -->
+        <propval name='local-only' type='boolean' value='false' />
+        <!--   log-facility: syslog facility used for logging -->
+        <propval name='log-facility' type='astring' value='' />
+      </property_group>
+    </instance>
+    <stability value='Unstable' />
+    <template>
+      <common_name>
+        <loctext xml:lang='C'>Spamassassin</loctext>
+      </common_name>
+      <documentation>
+        <manpage title='spamd' section='1' manpath='@PREFIX@/@PKGMANDIR@' />
+      </documentation>
+    </template>
+  </service>
+</service_bundle>
diff -r ae8d9ee0f5c5 -r 21df13272657 mail/spamassassin/files/smf/spamassassin.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/spamassassin/files/smf/spamassassin.sh       Fri Dec 16 15:52:52 2016 +0000
@@ -0,0 +1,79 @@
+#!@SMF_METHOD_SHELL@
+#
+# $NetBSD: spamassassin.sh,v 1.1 2016/12/16 15:52:52 hans Exp $
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+# Copyright 2016 Hans Rosenfeld <rosenfeld%grumpf.hope-2000.org@localhost>
+#
+
+# smf_method(5) start/stop script required for spamassassin spamd
+
+. /lib/svc/share/smf_include.sh
+
+
+get_config ()
+{   
+    cmdopts=""
+    properties="allow-tell listen-on allowed-ips max-children user local-only
+       log-facility"
+
+    for prop in $properties
+    do



Home | Main Index | Thread Index | Old Index