浏览代码

provide new born MTA variables

Ralf S. Engelschall 24 年之前
父节点
当前提交
ebd02936ad
共有 6 个文件被更改,包括 119 次插入7 次删除
  1. 1 1
      exim/exim.spec
  2. 3 0
      exim/rc.exim
  3. 2 2
      postfix/postfix.spec
  4. 3 0
      postfix/rc.postfix
  5. 106 0
      sendmail/rc.sendmail
  6. 4 4
      sendmail/sendmail.spec

+ 1 - 1
exim/exim.spec

@@ -32,7 +32,7 @@ Distribution: OpenPKG [EXP]
 Group:        Mail
 License:      GPL
 Version:      3.33
-Release:      1
+Release:      2
 
 #   list of sources
 Source0:      ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim-%{version}.tar.bz2

+ 3 - 0
exim/rc.exim

@@ -4,6 +4,9 @@
 ##
 
 %config
+    mta_name="exim"
+    mta_aliases_file="@l_prefix@/etc/exim/aliases"
+    mta_aliases_update="true"
     exim_enable="yes"
     exim_flags="-bd -q30m"
 

+ 2 - 2
postfix/postfix.spec

@@ -56,7 +56,7 @@ Version:      %{V_here}
 %else
 Version:      %{V_unstable}
 %endif
-Release:      17
+Release:      18
 
 #   list of sources
 Source0:      ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_real}.tar.gz
@@ -258,7 +258,7 @@ Provides:     MTA
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
         %{l_files_std} \
         '%attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix' \
-        '%config %attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix/*.cf' \
+        '%config %attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix/*' \
         '%attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix/*' \
         '%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix' \
         '%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/var/postfix'

+ 3 - 0
postfix/rc.postfix

@@ -4,6 +4,9 @@
 ##
 
 %config
+    mta_name="postfix"
+    mta_aliases_file="@l_prefix@/etc/postfix/aliases"
+    mta_aliases_update="cd @l_prefix@/etc/postfix && @l_prefix@/sbin/postalias aliases"
     postfix_enable="yes"
     postfix_log_prolog="true"
     postfix_log_epilog="true"

+ 106 - 0
sendmail/rc.sendmail

@@ -0,0 +1,106 @@
+#!@l_prefix@/lib/rpm/bash @l_prefix@/etc/rc
+##
+##  rc.sendmail -- Run-Commands for Sendmail Daemon
+##  Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
+##  Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.com>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE. 
+##
+
+%config
+    mta_name="sendmail"
+    mta_aliases_file="@l_prefix@/etc/sendmail/t.aliases"
+    mta_aliases_update="cd @l_prefix@/etc/sendmail && make t.aliases.db"
+    sendmail_enable="yes"
+    sendmail_flags_in="-bd"
+    sendmail_flags_out="-q60s"
+    sendmail_flags=""
+    sendmail_rotate_prolog=""
+    sendmail_rotate_epilog=""
+    sendmail_rotate_numfiles="10"
+    sendmail_rotate_minsize="1M"
+    sendmail_rotate_complevel="9"
+
+%common 
+    sendmail_start () {
+        if opServiceEnabled sendmail; then
+            @l_prefix@/sbin/sendmail $sendmail_flags_in $sendmail_flags \
+                -OPidFile=@l_prefix@/var/sendmail/sendmail.in.pid
+            @l_prefix@/sbin/sendmail $sendmail_flags_out $sendmail_flags \
+                -OPidFile=@l_prefix@/var/sendmail/sendmail.out.pid
+        fi
+    }
+    sendmail_signal () {
+        if opServiceEnabled sendmail; then
+            if [ -f @l_prefix@/var/sendmail/sendmail.in.pid ]; then
+                rpmtool signal -c -d2 \
+                    -p `head -1 @l_prefix@/var/sendmail/sendmail.in.pid` "$@"
+            fi
+            if [ -f @l_prefix@/var/sendmail/sendmail.out.pid ]; then
+                rpmtool signal -c -d2 \
+                    -p `head -1 @l_prefix@/var/sendmail/sendmail.out.pid` "$@"
+            fi
+        fi
+    }
+
+%start -p 200 -u root
+    sendmail_start
+
+%stop -p 200 -u root
+    sendmail_signal TERM KILL
+
+%restart -u root
+    sendmail_signal TERM KILL
+    sleep 2
+    sendmail_start
+
+%reload -u root
+    #   sendmail does not like SIGHUP on queue-only processes,
+    #   so we have to perform actually a restart...
+    sendmail_signal TERM KILL
+    sleep 2
+    sendmail_start
+
+%daily -u root
+    if opServiceEnabled sendmail; then
+        opTmpDirGen sendmail
+        opTmpDirFile sendmail hint hintfile
+        prolog="true"
+        if [ ".$sendmail_rotate_prolog" != . ]; then
+            prolog="$prolog; $sendmail_rotate_prolog"
+        fi
+        epilog="echo 'epilog' >$hintfile"
+        if [ ".$sendmail_rotate_epilog" != . ]; then
+            epilog="$epilog; $sendmail_rotate_epilog"
+        fi
+        shtool rotate -f \
+            -n${sendmail_rotate_numfiles} -s${sendmail_rotate_minsize} \
+            -d -z${sendmail_rotate_complevel} \
+            -o@l_fsusr@ -g@l_fsgrp@ -m644 \
+            -P "$prolog" \
+            -E "$epilog" \
+            @l_prefix@/var/sendmail/sendmail.log
+        if [ ".`cat $hintfile`" = ".epilog" ]; then
+            sendmail_signal TERM KILL
+            sleep 2
+            sendmail_start
+        fi
+        opTmpDirDel sendmail
+    fi
+

+ 4 - 4
sendmail/sendmail.spec

@@ -37,7 +37,7 @@ Distribution: OpenPKG [EXP]
 Group:        Mail
 License:      BSD
 Version:      %{V_sendmail}
-Release:      13
+Release:      14
 
 #   list of sources
 Source0:      ftp://ftp.sendmail.org/pub/sendmail/sendmail.%{V_sendmail}.tar.gz
@@ -312,15 +312,15 @@ Provides:     MTA
 
 %post 
     if [ $1 -eq 1 ]; then
-        (cd $RPM_INSTALL_PREFIX/etc/sendmail; %{l_make} all >/dev/null 2>&1)
+        (cd $RPM_INSTALL_PREFIX/etc/sendmail; %{l_make} all >/dev/null 2>&1 || true)
     elif [ $1 -gt 1 ]; then
-        (cd $RPM_INSTALL_PREFIX/etc/sendmail; %{l_make} clean all >/dev/null 2>&1)
+        (cd $RPM_INSTALL_PREFIX/etc/sendmail; %{l_make} clean all >/dev/null 2>&1 || true)
         $RPM_INSTALL_PREFIX/etc/rc sendmail reload >/dev/null 2>&1 || true
     fi
 
 %preun
     if [ $1 -eq 0 ]; then
         $RPM_INSTALL_PREFIX/etc/rc sendmail stop >/dev/null 2>&1 || true
-        (cd $RPM_INSTALL_PREFIX/etc/sendmail/; %{l_make} clean >/dev/null 2>&1)
+        (cd $RPM_INSTALL_PREFIX/etc/sendmail/; %{l_make} clean >/dev/null 2>&1 || true)
     fi