Procházet zdrojové kódy

Add an SMTPfeed daemon similar to the stuff we did for TaylorUUCP's uucico. This allows MTAs like Postfix (which only can speak LMTP over TCP) to use SMTPfeed (which only speaks LMTP over STDIN/STDOUT).

Ralf S. Engelschall před 24 roky
rodič
revize
8be98a3814
3 změnil soubory, kde provedl 72 přidání a 5 odebrání
  1. 52 0
      smtpfeed/rc.smtpfeed
  2. 20 5
      smtpfeed/smtpfeed.spec
  3. binární
      smtpfeed/smtpfeedd.tar.gz

+ 52 - 0
smtpfeed/rc.smtpfeed

@@ -0,0 +1,52 @@
+#!@l_prefix@/lib/rpm/bash @l_prefix@/etc/rc
+##
+##  rc.smtpfeed -- Run-Commands for SMTPfeed Daemon
+##
+
+%config
+    smtpfeed_enable="no"
+    smtpfeed_bind_local="127.0.0.1:2525"
+    smtpfeed_bind_remote="0.0.0.0"
+    smtpfeed_hostname="localhost"
+    smtpfeed_timeout_connect="1m"
+    smtpfeed_timeout_greet="2m"
+    smtpfeed_timeout_rset="2m"
+    smtpfeed_maxrcpt="100"
+    smtpfeed_maxsize="4194304"
+
+
+%common
+    smtpfeed_pidfile="@l_prefix@/var/smtpfeed/smtpfeed.pid"
+    smtpfeed_args="-u -V -E -l mail"
+    smtpfeed_args="$smtpfeed_args -t connect=${smtpfeed_timeout_connect:-1m}"
+    smtpfeed_args="$smtpfeed_args -t greet=${smtpfeed_timeout_greet:-2m}"
+    smtpfeed_args="$smtpfeed_args -t rset=${smtpfeed_timeout_rset:-2m}"
+    smtpfeed_args="$smtpfeed_args -o ${smtpfeed_bind_remote:-0.0.0.0}"
+    smtpfeed_args="$smtpfeed_args -c ${smtpfeed_hostname:-localhost}"
+    smtpfeed_args="$smtpfeed_args -r 1 -R ${smtpfeed_maxrcpt:-100}"
+    smtpfeed_args="$smtpfeed_args -s ${smtpfeed_maxsize:-4194304}"
+    smtpfeed_start () {
+        ( @l_prefix@/sbin/smtpfeedd ${smtpfeed_bind_local:-127.0.0.1:2525} \
+          @l_prefix@/sbin/smtpfeed ${smtpfeed_args} \
+          </dev/null >/dev/null 2>&1 &
+          echo "$!" >${smtpfeed_pidfile}
+        ) </dev/null >/dev/null 2>&1
+    }
+    smtpfeed_stop () {
+        if [ -f ${smtpfeed_pidfile} ]; then
+            kill -TERM `cat ${smtpfeed_pidfile}`
+            sleep 1
+        fi
+    }
+
+%start -p 200 -u root
+    smtpfeed_start
+
+%stop -p 200 -u root
+    smtpfeed_stop
+
+%restart -u root
+    smtpfeed_stop
+    sleep 1
+    smtpfeed_start
+

+ 20 - 5
smtpfeed/smtpfeed.spec

@@ -25,8 +25,8 @@
 #   package information
 Name:         smtpfeed
 Summary:      LMTP Mailer for Mass Delivery via SMTP
-URL:          http://www.gnu.org/software/recode/
-Vendor:       Francois Pinard
+URL:          ftp://ftp.kyoto.wide.ad.jp/pub/mail/smtpfeed/
+Vendor:       Motonori Nakamura
 Packager:     The OpenPKG Project
 Distribution: OpenPKG [EXP]
 Group:        Mail
@@ -36,7 +36,8 @@ Release:      %{l_branch}.0
 
 #   list of sources
 Source0:      ftp://ftp.kyoto.wide.ad.jp/pub/mail/smtpfeed/smtpfeed-%{version}.tar.gz
-Source1:      fakesyslog.tar.gz
+Source1:      smtpfeedd.tar.gz
+Source2:      fakesyslog.tar.gz
 
 #   build information
 Prefix:       %{l_prefix}
@@ -55,6 +56,7 @@ AutoReqProv:  no
 %prep
     %setup0 -q -c
     %setup1 -q -T -D -a 1
+    %setup2 -q -T -D -a 2
 
 %build
     #   build faked syslog(3) library
@@ -81,20 +83,33 @@ AutoReqProv:  no
       %{l_make} %{l_mflags -O} 
     )
 
+    #   build smtpfeed daemon
+    ( cd smtpfeedd
+      CC="%{l_cc}" \
+      CFLAGS="%{l_cflags -O}" \
+      ./configure
+      %{l_make} %{l_mflags} 
+    )
+
 %install
     rm -rf $RPM_BUILD_ROOT
     %{l_shtool} mkdir -f -p -m 755 \
-        $RPM_BUILD_ROOT%{l_prefix}/bin \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
         $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
         $RPM_BUILD_ROOT%{l_prefix}/var/smtpfeed
     ( cd smtpfeed-%{version}
       %{l_shtool} install -c -s -m 755 \
-          smtpfeed $RPM_BUILD_ROOT%{l_prefix}/bin/
+          smtpfeed $RPM_BUILD_ROOT%{l_prefix}/sbin/
       %{l_shtool} install -c -m 644 \
           smtpfeed.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
       %{l_shtool} install -c -m 644 \
           /dev/null $RPM_BUILD_ROOT%{l_prefix}/var/smtpfeed/smtpfeed.log
     )
+    %{l_shtool} install -c -s -m 755 \
+        smtpfeedd/smtpfeedd $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
+        %{SOURCE rc.smtpfeed} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
 
 %files -f files

binární
smtpfeed/smtpfeedd.tar.gz