pkgsrc-Changes archive

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

CVS commit: pkgsrc/mail/sendmail



Module Name:    pkgsrc
Committed By:   hans
Date:           Fri Dec 16 16:07:29 UTC 2016

Modified Files:
        pkgsrc/mail/sendmail: Makefile
        pkgsrc/mail/sendmail/files/smf: manifest.xml
Added Files:
        pkgsrc/mail/sendmail/files/smf: sendmail.sh sendmail_include.sh
            smmsp.sh

Log Message:
Update SMF manifest and add methods based on whats in illumos.

This will create two sendmail service instances, :mta and :msp, to start
the two sendmail instances that are usually required. The :mta instance
optionally depends on spamassassin and spamass-milter.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 pkgsrc/mail/sendmail/Makefile
cvs rdiff -u -r1.4 -r1.5 pkgsrc/mail/sendmail/files/smf/manifest.xml
cvs rdiff -u -r0 -r1.1 pkgsrc/mail/sendmail/files/smf/sendmail.sh \
    pkgsrc/mail/sendmail/files/smf/sendmail_include.sh \
    pkgsrc/mail/sendmail/files/smf/smmsp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mail/sendmail/Makefile
diff -u pkgsrc/mail/sendmail/Makefile:1.128 pkgsrc/mail/sendmail/Makefile:1.129
--- pkgsrc/mail/sendmail/Makefile:1.128 Sat Mar  5 11:28:51 2016
+++ pkgsrc/mail/sendmail/Makefile       Fri Dec 16 16:07:29 2016
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.128 2016/03/05 11:28:51 jperkin Exp $
+# $NetBSD: Makefile,v 1.129 2016/12/16 16:07:29 hans Exp $
 
 PKGNAME=       sendmail-${DIST_VERS}
-PKGREVISION=   1
+PKGREVISION=   2
 COMMENT=       The well known Mail Transport Agent
 
 CONFLICTS+=    courier-mta-[0-9]* fastforward>=0.51nb2 postfix-[0-9]*
@@ -18,6 +18,7 @@ PLIST_SRC=    ${WRKDIR}/.PLIST_SRC
 SMRSH_CMDDIR?= ${PREFIX}/libexec/sm.bin
 PLIST_SUBST+=  SMRSH_CMDDIR=${SMRSH_CMDDIR}
 RCD_SCRIPTS=   sendmail smmsp
+SMF_METHODS=   sendmail sendmail_include smmsp
 
 BUILD_DEFS+=   VARBASE
 

Index: pkgsrc/mail/sendmail/files/smf/manifest.xml
diff -u pkgsrc/mail/sendmail/files/smf/manifest.xml:1.4 pkgsrc/mail/sendmail/files/smf/manifest.xml:1.5
--- pkgsrc/mail/sendmail/files/smf/manifest.xml:1.4     Wed Jun  8 10:16:53 2016
+++ pkgsrc/mail/sendmail/files/smf/manifest.xml Fri Dec 16 16:07:29 2016
@@ -1,40 +1,284 @@
-<?xml version='1.0'?>
-<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
-<service_bundle type='manifest' name='export'>
-  <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='0'>
-    <create_default_instance enabled="false" />
-    <single_instance />
-    <dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
-      <service_fmri value='svc:/system/filesystem/local' />
-    </dependency>
-    <dependency name='loopback' grouping='require_all' restart_on='error' type='service'>
-      <service_fmri value='svc:/network/loopback:default' />
-    </dependency>
-    <dependency name='physical' grouping='require_all' restart_on='error' type='service'>
-      <service_fmri value='svc:/network/physical:default' />
-    </dependency>
-    <dependency name='name-services' grouping='require_all'  restart_on='refresh' type='service'>
-      <service_fmri value='svc:/milestone/name-services' />
-    </dependency>
-    <dependency name='system-log' grouping='optional_all' restart_on='none' type='service'>
-      <service_fmri value='svc:/system/system-log' />
-    </dependency>
-    <dependency name='config-files' grouping='require_all' restart_on='refresh' type='path'>
-      <service_fmri value='file:///etc/mail/sendmail.cf' />
-    </dependency>
-    <exec_method name='start' type='method' exec='@PREFIX@/libexec/sendmail/sendmail -Lsm-mta -bd -q30m' timeout_seconds='60' />
-    <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60' />
-    <property_group name='startd' type='framework'>
-      <propval name='ignore_error' type='astring' value='core,signal' />
-    </property_group>
-    <template>
-      <common_name>
-        <loctext xml:lang='C'>Sendmail SMTP Server</loctext>
-      </common_name>
-      <documentation>
-        <manpage title='sendmail' section='8' manpath='@PREFIX@/@PKGMANDIR@'/>
-        <doc_link name='sendmail.com' uri='http://www.sendmail.com/sm/open_source/docs/' />
-      </documentation>
-    </template>
-  </service>
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+    CDDL HEADER START
+   
+    The contents of this file are subject to the terms of the
+    Common Development and Distribution License (the "License").
+    You may not use this file except in compliance with the License.
+   
+    You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+    or http://www.opensolaris.org/os/licensing.
+    See the License for the specific language governing permissions
+    and limitations under the License.
+   
+    When distributing Covered Code, include this CDDL HEADER in each
+    file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+    If applicable, add the following below this CDDL HEADER, with the
+    fields enclosed by brackets "[]" replaced with your own identifying
+    information: Portions Copyright [yyyy] [name of copyright owner]
+   
+    CDDL HEADER END
+   
+    Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+    Use is subject to license terms.
+
+    Copyright 2016 Hans Rosenfeld <rosenfeld%grumpf.hope-2000.org@localhost>
+
+    NOTE:  This service manifest is not editable; its contents will
+    be overwritten by package or patch operations, including
+    operating system upgrade.  Make customizations in a different
+    file.
+-->
+
+<service_bundle type='manifest' name='@SMF_NAME@'>
+
+<service
+       name='@SMF_PREFIX@/@SMF_NAME@'
+       type='service'
+       version='1'>
+
+       <dependency
+           name='fs-local'
+           grouping='require_all'
+           restart_on='none'
+           type='service'>
+               <service_fmri value='svc:/system/filesystem/local' />
+       </dependency>
+
+       <dependency
+           name='network-service'
+           grouping='require_all'
+           restart_on='none'
+           type='service'>
+               <service_fmri value='svc:/network/service' />
+       </dependency>
+
+       <dependency
+           name='name-services'
+           grouping='require_all'
+           restart_on='refresh'
+           type='service'>
+               <service_fmri value='svc:/milestone/name-services' />
+       </dependency>
+
+       <dependency
+           name='identity'
+           grouping='optional_all'
+           restart_on='refresh'
+           type='service'>
+               <service_fmri value='svc:/system/identity:domain' />
+       </dependency>
+
+       <dependency
+           name='system-log'
+           grouping='optional_all'
+           restart_on='none'
+           type='service'>
+               <service_fmri value='svc:/system/system-log' />
+       </dependency>
+
+       <property_group name='firewall_context' type='com.sun,fw_definition'>
+               <propval name='name' type='astring' value='smtp' />
+       </property_group>
+
+
+       <instance name='mta' enabled='false'>
+
+               <dependency
+                   name='config-file'
+                   grouping='require_all'
+                   restart_on='refresh'
+                   type='path'>
+                       <service_fmri
+                           value='file://localhost/etc/mail/sendmail.cf' />
+               </dependency>
+
+               <dependency
+                   name='nsswitch'
+                   grouping='require_all'
+                   restart_on='refresh'
+                   type='path'>
+                       <service_fmri
+                           value='file://localhost/etc/nsswitch.conf' />
+               </dependency>
+
+               <!-- If spamassassin is enabled, wait for it. -->
+               <dependency
+                   name='spamassassin'
+                   grouping='optional_all'
+                   restart_on='none'
+                   type='service'>
+                       <service_fmri value='svc:/@SMF_PREFIX@/spamassassin' />
+               </dependency>
+
+               <dependency
+                   name='spamass-milter'
+                   grouping='optional_all'
+                   restart_on='none'
+                   type='service'>
+                       <service_fmri value='svc:/@SMF_PREFIX@/spamass-milter' />
+               </dependency>
+                
+               <!--
+               If autofs is enabled, wait for it to get users' home
+               directories.
+               -->
+               <dependency
+                   name='autofs'
+                   grouping='optional_all'
+                   restart_on='none'
+                   type='service'>
+                       <service_fmri value='svc:/system/filesystem/autofs' />
+               </dependency>
+
+               <dependent
+                       name='smtp-sendmail_multi-user'
+                       grouping='optional_all'
+                       restart_on='none'>
+                               <service_fmri
+                                   value='svc:/milestone/multi-user' />
+               </dependent>
+
+               <!--
+               Sendmail is hard-coded to sleep for 60 seconds if it cannot
+               determine the FQHN, so the timeout for start must be longer
+               than that.  For details, see
+               http://www.sendmail.org/vendor/sun/differences.html#3.2
+               -->
+
+               <exec_method
+                       type='method'
+                       name='start'
+                       exec='@PREFIX@/@SMF_METHOD_FILE.sendmail@ start'
+                       timeout_seconds='120' />
+
+               <exec_method
+                       type='method'
+                       name='stop'
+                       exec='@PREFIX@/@SMF_METHOD_FILE.sendmail@ stop %{restarter/contract}'
+                       timeout_seconds='60' />
+
+               <exec_method
+                       type='method'
+                       name='refresh'
+                       exec='@PREFIX@/@SMF_METHOD_FILE.sendmail@ refresh'
+                       timeout_seconds='60' />
+
+               <property_group name='firewall_config' type='com.sun,fw_configuration'>
+                       <propval name='policy' type='astring' value='use_global' />
+                       <propval name='block_policy' type='astring'
+                               value='use_global' />
+                       <propval name='apply_to' type='astring' value='' />
+                       <propval name='apply_to_6' type='astring' value='' />
+                       <propval name='exceptions' type='astring' value='' />
+                       <propval name='exceptions_6' type='astring' value='' />
+                       <propval name='target' type='astring' value='' />
+                       <propval name='target_6' type='astring' value='' />
+                       <propval name='value_authorization' type='astring'
+                               value='solaris.smf.value.firewall.config' />
+               </property_group>
+
+               <property_group name='startd' type='framework'>
+                       <propval name='ignore_error' type='astring'
+                           value='core,signal' />
+               </property_group>
+
+               <property_group name='general' type='framework'>
+                       <propval name='action_authorization' type='astring'
+                               value='solaris.smf.manage.sendmail' />
+               </property_group>
+
+               <property_group name='config' type='application'>
+                       <propval name='include_info'
+                               type='boolean' value='false' />
+                       <propval name='local_only'
+                               type='boolean' value='true' />
+                       <propval name='path_to_sendmail_mc'
+                               type='astring'
+                                value='@PREFIX@/share/sendmail/cf/sendmail.mc' />
+                       <propval name='value_authorization' type='astring'
+                               value='solaris.smf.value.sendmail' />
+               </property_group>
+                       
+               <template>
+                       <common_name>
+                               <loctext xml:lang='C'>
+                               sendmail SMTP mail transfer agent
+                               </loctext>
+                       </common_name>
+                       <documentation>
+                               <manpage title='sendmail' section='8'
+                                   manpath='@PREFIX@/@PKGMANDIR@' />
+                       </documentation>
+               </template>
+
+       </instance>
+
+       <instance name='msp' enabled='false'>
+
+               <dependency
+                   name='config-file'
+                   grouping='require_all'
+                   restart_on='refresh'
+                   type='path'>
+                       <service_fmri
+                           value='file://localhost/etc/mail/submit.cf' />
+               </dependency>
+
+               <!--
+               Sendmail is hard-coded to sleep for 60 seconds if it cannot
+               determine the FQHN, so the timeout for start must be longer
+               than that.  For details, see
+               http://www.sendmail.org/vendor/sun/differences.html#3.2
+               -->
+
+               <exec_method
+                       type='method'
+                       name='start'
+                       exec='@PREFIX@/@SMF_METHOD_FILE.smmsp@ start'
+                       timeout_seconds='120' />
+
+               <exec_method
+                       type='method'
+                       name='stop'
+                       exec='@PREFIX@/@SMF_METHOD_FILE.smmsp@ stop %{restarter/contract}'
+                       timeout_seconds='60' />
+
+               <exec_method
+                       type='method'
+                       name='refresh'
+                       exec='@PREFIX@/@SMF_METHOD_FILE.smmsp@ refresh'
+                       timeout_seconds='60' />
+
+               <property_group name='general' type='framework'>
+                       <propval name='action_authorization' type='astring'
+                               value='solaris.smf.manage.sendmail' />
+               </property_group>
+
+               <property_group name='config' type='application'>
+                       <propval name='value_authorization' type='astring'
+                               value='solaris.smf.value.sendmail' />
+                       <propval name='path_to_submit_mc'
+                               type='astring'
+                                value='@PREFIX@/share/sendmail/cf/submit.mc' />
+               </property_group>
+                       
+               <template>
+                       <common_name>
+                               <loctext xml:lang='C'>
+                               sendmail SMTP client queue runner
+                               </loctext>
+                       </common_name>
+                       <documentation>
+                               <manpage title='sendmail' section='8'
+                                   manpath='@PREFIX@/@PKGMANDIR@' />
+                       </documentation>
+               </template>
+
+       </instance>
+       <stability value='Unstable' />
+
+</service>
+
 </service_bundle>

Added files:

Index: pkgsrc/mail/sendmail/files/smf/sendmail.sh
diff -u /dev/null pkgsrc/mail/sendmail/files/smf/sendmail.sh:1.1
--- /dev/null   Fri Dec 16 16:07:29 2016
+++ pkgsrc/mail/sendmail/files/smf/sendmail.sh  Fri Dec 16 16:07:29 2016
@@ -0,0 +1,131 @@
+#!/sbin/sh
+#
+# $NetBSD: sendmail.sh,v 1.1 2016/12/16 16:07:29 hans Exp $
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+. /lib/svc/share/smf_include.sh
+. @PREFIX@/lib/svc/method/sendmail_include
+
+ERRMSG1='WARNING: /var/mail is NFS-mounted without setting actimeo=0,'
+ERRMSG2='this can cause mailbox locking and access problems.'
+SERVER_PID_FILE="@VARBASE@/run/sendmail.pid"
+ALIASES_FILE="/etc/mail/aliases"
+SENDMAIL_CF="/etc/mail/sendmail.cf"
+
+case "$1" in 
+'refresh')
+        [ -f $SERVER_PID_FILE ] && kill -1 `head -1 $SERVER_PID_FILE`
+        ;;
+
+'start')
+       exist_or_exit $SENDMAIL
+       if [ ! -d @VARBASE@/spool/mqueue ]; then
+               /usr/bin/mkdir -m 0750 @VARBASE@/spool/mqueue
+               /usr/bin/chown root:bin @VARBASE@/spool/mqueue
+       fi
+       if [ ! -f $ALIASES_FILE.db ] && [ ! -f $ALIASES_FILE.dir ] \
+           && [ ! -f $ALIASES_FILE.pag ]; then
+               @PREFIX@/bin/newaliases
+       fi
+       MODE="-bd"
+       [ -f $DEFAULT_FILE ] && . $DEFAULT_FILE
+       #
+       # * MODE should be "-bd" or null (MODE= or MODE="") or
+       #   left alone.  Anything else and you're on your own.
+       # * QUEUEOPTION should be "p" or null (as above).
+       # * QUEUEINTERVAL should be set to some legal value;
+       #   sanity checks are done below.
+       # * OPTIONS are catch-alls; set with care.
+       #
+       if [ -n "$QUEUEOPTION" -a "$QUEUEOPTION" != "p" ]; then
+               QUEUEOPTION=""
+       fi
+       if [ -z "$QUEUEOPTION" -o -n "$QUEUEINTERVAL" ]; then
+               check_queue_interval_syntax $QUEUEINTERVAL
+               QUEUEINTERVAL=$answer
+       fi
+
+       local=`/usr/bin/svcprop -p config/local_only $SMF_FMRI 2>/dev/null`
+       if [ $? -eq 0 -a "$local" = "true" ]; then
+               MODE="-bl"
+       fi
+       sendmail_path=`svcprop -p config/path_to_sendmail_mc $SMF_FMRI \
+           2>/dev/null`
+       if [ $? -eq 0 -a -n "$sendmail_path" ]; then
+               turn_m4_crank "$SENDMAIL_CF" "$sendmail_path"
+       fi
+       exist_or_exit "$SENDMAIL_CF"
+
+       $SENDMAIL $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
+
+       #
+       # ETRN_HOSTS should be of the form
+       # "s1:c1.1,c1.2        s2:c2.1 s3:c3.1,c3.2,c3.3"
+       # i.e., white-space separated groups of server:client where
+       # client can be one or more comma-separated names; N.B. that
+       # the :client part is optional; see etrn(1M) for details.
+       # server is the name of the server to prod; a mail queue run
+       # is requested for each client name.  This is comparable to
+       # running "/usr/lib/sendmail -qRclient" on the host server.
+       #
+       # See RFC 1985 for more information.
+       #
+       for i in $ETRN_HOSTS; do
+               SERVER=`echo $i | /usr/bin/sed -e 's/:.*$//'`
+               CLIENTS=`echo $i | /usr/bin/sed -n -e 's/,/ /g' \
+                   -e '/:/s/^.*://p'`
+               /usr/sbin/etrn -b $SERVER $CLIENTS >/dev/null 2>&1 &
+       done
+
+       if /usr/bin/nawk 'BEGIN{s = 1}
+           $2 == "/var/mail" && $3 == "nfs" && $4 !~ /actimeo=0/ &&
+           $4 !~ /noac/{s = 0} END{exit s}' /etc/mnttab; then
+
+               /usr/bin/logger -p mail.crit "$ERRMSG1"
+               /usr/bin/logger -p mail.crit "$ERRMSG2"
+       fi
+       ;;
+
+'stop')
+       [ -f $SERVER_PID_FILE ] && check_and_kill $SERVER_PID_FILE
+       # Need to kill the entire service contract to kill all sendmail related
+       # processes
+       smf_kill_contract $2 TERM 1 30
+       ret=$?
+       [ $ret -eq 1 ] && exit 1
+
+       # Since sendmail spawns user processes out of .forward files, it is
+       # possible that some of these are not responding to TERM.  If the
+       # contract did not empty after TERM, move on to KILL.
+       if [ $ret -eq 2 ] ; then
+               smf_kill_contract $2 KILL 1
+       fi
+       ;;
+
+*)
+       echo "Usage: $0 { start | stop | refresh }"
+       exit 1
+       ;;
+esac
+exit 0
Index: pkgsrc/mail/sendmail/files/smf/sendmail_include.sh
diff -u /dev/null pkgsrc/mail/sendmail/files/smf/sendmail_include.sh:1.1
--- /dev/null   Fri Dec 16 16:07:29 2016
+++ pkgsrc/mail/sendmail/files/smf/sendmail_include.sh  Fri Dec 16 16:07:29 2016
@@ -0,0 +1,103 @@
+#!/sbin/sh
+#
+# $NetBSD: sendmail_include.sh,v 1.1 2016/12/16 16:07:29 hans Exp $
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+DEFAULT_FILE="/etc/default/sendmail"
+SENDMAIL="@PREFIX@/libexec/sendmail/sendmail"
+PATH="/usr/bin:/usr/sbin:/usr/ccs/bin"
+export PATH
+
+check_queue_interval_syntax()
+{
+       default="15m"
+       if [ $# -lt 1 ]; then
+               answer=$default
+               return
+       fi
+       if echo $1 | egrep '^([0-9]*[1-9][0-9]*[smhdw])+$' >/dev/null 2>&1; then
+               answer=$1
+       else
+               answer=$default
+       fi
+}
+
+check_and_kill()
+{
+       PID=`head -1 $1`
+       kill -0 $PID > /dev/null 2>&1
+       [ $? -eq 0 ] && kill $PID
+}
+
+exist_or_exit()
+{
+       if [ ! -f $1 ]; then
+               echo "$1 does not exist" >&2
+               exit $SMF_EXIT_ERR_CONFIG
+       fi
+}
+
+turn_m4_crank()
+{
+       # expected to be called with two arguments: .cf path & path to m4 file
+       [ $# -lt 2 ] && return
+       cf_path=$1
+       m4_path=$2
+       if [ "$m4_path" = "_DONT_TOUCH_THIS" ]; then
+               if [ -f "${cf_path}.old" ]; then
+                       mv "$cf_path" "${cf_path}.new"
+                       [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+                       mv "${cf_path}.old" "$cf_path"
+                       [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+               fi
+               #
+               # If ${cf_path}.old does not exist, assume it was taken care
+               # of on a previous run.
+               #
+       else
+               case "$m4_path" in
+               /*)     ;;      # absolute path
+               *)      return;;
+               esac
+               exist_or_exit "$m4_path"
+               cd `dirname "$m4_path"`
+               base=`basename "$m4_path"`
+               name=`basename "$m4_path" .mc`
+               info=`svcprop -p config/include_info $SMF_FMRI 2>/dev/null`
+               if [ "$info" = "true" ]; then
+                       m4flags=""
+               else
+                       m4flags="-DSUN_HIDE_INTERNAL_DETAILS"
+               fi
+               m4 $m4flags @PREFIX@/share/sendmail/m4/cf.m4 "$base" > "${name}.cf"
+               [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+               cmp -s "${name}.cf" "$cf_path" || (
+                       cp "${name}.cf" "${cf_path}.tmp" &&
+                       chown root:bin "${cf_path}.tmp" &&
+                       chmod 444 "${cf_path}.tmp" &&
+                       mv "${cf_path}.tmp" "$cf_path"
+               )
+               [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+       fi
+}
Index: pkgsrc/mail/sendmail/files/smf/smmsp.sh
diff -u /dev/null pkgsrc/mail/sendmail/files/smf/smmsp.sh:1.1
--- /dev/null   Fri Dec 16 16:07:29 2016
+++ pkgsrc/mail/sendmail/files/smf/smmsp.sh     Fri Dec 16 16:07:29 2016
@@ -0,0 +1,82 @@
+#!/sbin/sh
+#
+# $NetBSD: smmsp.sh,v 1.1 2016/12/16 16:07:29 hans Exp $
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+. /lib/svc/share/smf_include.sh
+. @PREFIX@/lib/svc/method/sendmail_include
+
+CLIENT_PID_FILE="@VARBASE@/spool/clientmqueue/sm-client.pid"
+SUBMIT_CF="/etc/mail/submit.cf"
+
+case "$1" in 
+'refresh')
+        [ -f $CLIENT_PID_FILE ] && kill -1 `head -1 $CLIENT_PID_FILE`
+        ;;
+
+'start')
+       exist_or_exit $SENDMAIL
+       [ -f $DEFAULT_FILE ] && . $DEFAULT_FILE
+       #
+       # * CLIENTQUEUEINTERVAL should be set to some legal value;
+       #   sanity checks are done below.
+       # * CLIENTOPTIONS are catch-alls; set with care.
+       #
+       check_queue_interval_syntax $CLIENTQUEUEINTERVAL
+       CLIENTQUEUEINTERVAL=$answer
+
+       submit_path=`svcprop -p config/path_to_submit_mc $SMF_FMRI 2>/dev/null`
+       if [ $? -eq 0 -a -n "$submit_path" ]; then
+               turn_m4_crank "$SUBMIT_CF" "$submit_path"
+       fi
+       exist_or_exit "$SUBMIT_CF"
+
+       $SENDMAIL -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS &
+       ;;
+
+'stop')
+       if [ -f $CLIENT_PID_FILE ]; then
+               check_and_kill $CLIENT_PID_FILE
+               rm -f $CLIENT_PID_FILE
+       fi
+       # Need to kill the entire service contract to kill all sendmail related
+       # processes
+       smf_kill_contract $2 TERM 1 30
+       ret=$?
+       [ $ret -eq 1 ] && exit 1
+
+       # Sendmail can take its time responding to SIGTERM, as it waits for
+       # things like child processes and SMTP connections to clean up.  If
+       # the contract did not empty after TERM, move on to KILL.
+       if [ $ret -eq 2 ] ; then
+               smf_kill_contract $2 KILL 1
+       fi
+       ;;
+
+*)
+       echo "Usage: $0 { start | stop | refresh }"
+       exit 1
+       ;;
+esac
+exit 0



Home | Main Index | Thread Index | Old Index