]> git.ipfire.org Git - people/ms/dma.git/commitdiff
Initial import of a crude attempt at a Debian package of dma,
authorPeter Pentchev <roam@ringlet.net>
Fri, 6 Mar 2009 13:32:44 +0000 (13:32 +0000)
committerPeter Pentchev <roam@ringlet.net>
Fri, 6 Mar 2009 13:32:44 +0000 (13:32 +0000)
the DragonFly Mail Agent.

21 files changed:
README.Debian [new file with mode: 0644]
changelog [new file with mode: 0644]
compat [new file with mode: 0644]
control [new file with mode: 0644]
copyright [new file with mode: 0644]
dirs [new file with mode: 0644]
dma.default.ex [new file with mode: 0644]
dma.lintian-overrides [new file with mode: 0644]
init.d.lsb.ex [new file with mode: 0644]
patches/01-debian-build.patch [new file with mode: 0644]
patches/02-man-dragonflybsd.patch [new file with mode: 0644]
patches/03-debian-locations.patch [new file with mode: 0644]
patches/04-debian-setgid.patch [new file with mode: 0644]
patches/series [new file with mode: 0644]
postinst [new file with mode: 0644]
postinst.ex [new file with mode: 0644]
postrm.ex [new file with mode: 0644]
preinst.ex [new file with mode: 0644]
prerm.ex [new file with mode: 0644]
rules [new file with mode: 0755]
watch [new file with mode: 0644]

diff --git a/README.Debian b/README.Debian
new file mode 100644 (file)
index 0000000..d7c9bbb
--- /dev/null
@@ -0,0 +1,6 @@
+dma for Debian
+--------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Peter Pentchev <roam@ringlet.net>  Mon, 09 Feb 2009 13:28:53 +0200
diff --git a/changelog b/changelog
new file mode 100644 (file)
index 0000000..3b5a9e4
--- /dev/null
+++ b/changelog
@@ -0,0 +1,13 @@
+dma (0.0.2009.02.11-1~1) unstable; urgency=low
+
+  * Initial release (Closes: #511410)
+  * TODO:
+    - recognize permanent delivery errors;
+    - only warn on a QUIT error, treat the message as sent;
+    - find a way to list all queued mails;
+    - use liblockfile in deliver_local() for /var/mail locking;
+    - RCPT TO failed: Success? :)
+    - crontab an invocation of "dma -bp"
+    - use debconf.
+
+ -- Peter Pentchev <roam@ringlet.net>  Fri, 06 Mar 2009 15:28:33 +0200
diff --git a/compat b/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
+++ b/compat
@@ -0,0 +1 @@
+5
diff --git a/control b/control
new file mode 100644 (file)
index 0000000..55eb901
--- /dev/null
+++ b/control
@@ -0,0 +1,26 @@
+Source: dma
+Section: mail
+Priority: optional
+Maintainer: Peter Pentchev <roam@ringlet.net>
+Build-Depends: debhelper (>= 5), quilt
+Standards-Version: 3.8.0
+Homepage: http://devel.ringlet.net/mail/dma/
+Vcs-Svn: http://svn.ringlet.net/svn/ringlet/mail/dma/trunk/dma-pkg/debian/
+Vcs-Browser: http://svn.ringlet.net/cgi-bin/viewvc/viewvc.cgi/ringlet/mail/dma/trunk/dma-pkg/debian/
+
+Package: dma
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: mail-transport-agent
+Conflicts: mail-transport-agent
+Replaces: mail-transport-agent
+Description: the DragonFly Mail Agent, a lightweight MTA
+ The DragonFly Mail Agent is a small Mail Transport Agent (MTA),
+ designed for home and office use.  It accepts mails from locally
+ installed Mail User Agents (MUA) and delivers the mails either locally
+ or to a remote destination.  Remote delivery includes several features
+ like TLS/SSL support and SMTP authentication.
+ .
+ dma is not intended as a replacement for real, big MTAs like Sendmail,
+ Postfix, or Exim.  Consequently, dma does not listen on port 25 for
+ incoming connections.
diff --git a/copyright b/copyright
new file mode 100644 (file)
index 0000000..f55c1c5
--- /dev/null
+++ b/copyright
@@ -0,0 +1,100 @@
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?recall=184
+Upstream-Name: dma
+Upstream-Source: http://devel.ringlet.net/mail/dma/
+
+Files: base64.c
+Copyright: Copyright (c) 2008 The DragonFly Project.  All rights reserved.
+Copyright: Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
+ (Royal Institute of Technology, Stockholm, Sweden).
+ All rights reserved.
+License: BSD-3
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  .
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  .
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  .
+  3. Neither the name of the Institute nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+
+Files: conf.c crypto.c net.c
+Copyright: Copyright (c) 2008 The DragonFly Project.  All rights reserved.
+  This code is derived from software contributed to The DragonFly Project
+  by Matthias Schmidt <matthias@dragonflybsd.org>, University of Marburg,
+  Germany.
+License: BSD-3
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  .
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+  3. Neither the name of The DragonFly Project nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific, prior written permission.
+
+Files: dma.c
+Copyright: Copyright (c) 2008 The DragonFly Project.  All rights reserved.
+  This code is derived from software contributed to The DragonFly Project
+  by Simon 'corecode' Schubert <corecode@fs.ei.tum.de>.
+License: BSD-3
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  .
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+  3. Neither the name of The DragonFly Project nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific, prior written permission.
+
+Files: dma.h
+Copyright: Copyright (c) 2008 The DragonFly Project.  All rights reserved.
+  This code is derived from software contributed to The DragonFly Project
+  by Simon 'corecode' Schubert <corecode@fs.ei.tum.de> and
+  Matthias Schmidt <matthias@dragonflybsd.org>.
+License: BSD-3
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  .
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+  3. Neither the name of The DragonFly Project nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific, prior written permission.
+
+Files: debian/*
+Copyright: Copyright (c) 2009 Peter Pentchev.
+License: BSD-3
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  .
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+  3. Neither the name of The DragonFly Project nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific, prior written permission.
diff --git a/dirs b/dirs
new file mode 100644 (file)
index 0000000..f10c005
--- /dev/null
+++ b/dirs
@@ -0,0 +1,4 @@
+etc/dma
+usr/sbin
+usr/share/lintian/overrides
+usr/share/man/man8
diff --git a/dma.default.ex b/dma.default.ex
new file mode 100644 (file)
index 0000000..7108d2c
--- /dev/null
@@ -0,0 +1,10 @@
+# Defaults for dma initscript
+# sourced by /etc/init.d/dma
+# installed at /etc/default/dma by the maintainer scripts
+
+#
+# This is a POSIX shell fragment
+#
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS=""
diff --git a/dma.lintian-overrides b/dma.lintian-overrides
new file mode 100644 (file)
index 0000000..fe54d55
--- /dev/null
@@ -0,0 +1,2 @@
+dma: setgid-binary usr/sbin/dma 2755 root/mail
+dma: non-standard-dir-perm var/spool/dma/ 0770 != 0755
diff --git a/init.d.lsb.ex b/init.d.lsb.ex
new file mode 100644 (file)
index 0000000..6ed0181
--- /dev/null
@@ -0,0 +1,296 @@
+#!/bin/sh
+#
+# Example init.d script with LSB support.
+#
+# Please read this init.d carefully and modify the sections to
+# adjust it to the program you want to run.
+#
+# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
+#
+# This is free software; you may 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,
+# or (at your option) any later version.
+#
+# This 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 with
+# the Debian operating system, in /usr/share/common-licenses/GPL;  if
+# not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+#
+### BEGIN INIT INFO
+# Provides:          dma
+# Required-Start:    $network $local_fs
+# Required-Stop:
+# Should-Start:      $named
+# Should-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: <Enter a short description of the sortware>
+# Description:       <Enter a long description of the software>
+#                    <...>
+#                    <...>
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+DAEMON=/usr/sbin/dma # Introduce the server's location here
+NAME=#PACKAGE              # Introduce the short server's name here
+DESC=#PACKAGE              # Introduce a short description here
+LOGDIR=/var/log/dma  # Log directory to use
+
+PIDFILE=/var/run/$NAME.pid
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+# Default options, these can be overriden by the information
+# at /etc/default/$NAME
+DAEMON_OPTS=""          # Additional options given to the server
+
+DIETIME=10              # Time to wait for the server to die, in seconds
+                        # If this value is set too low you might not
+                        # let some servers to die gracefully and
+                        # 'restart' will not work
+
+#STARTTIME=2             # Time to wait for the server to start, in seconds
+                        # If this value is set each time the server is
+                        # started (on start or restart) the script will
+                        # stall to try to determine if it is running
+                        # If it is not set and the server takes time
+                        # to setup a pid file the log message might 
+                        # be a false positive (says it did not start
+                        # when it actually did)
+                        
+LOGFILE=$LOGDIR/$NAME.log  # Server logfile
+#DAEMONUSER=dma   # Users to run the daemons as. If this value
+                        # is set start-stop-daemon will chuid the server
+
+# Include defaults if available
+if [ -f /etc/default/$NAME ] ; then
+       . /etc/default/$NAME
+fi
+
+# Use this if you want the user to explicitly set 'RUN' in
+# /etc/default/
+#if [ "x$RUN" != "xyes" ] ; then
+#    log_failure_msg "$NAME disabled, please adjust the configuration to your needs "
+#    log_failure_msg "and then set RUN to 'yes' in /etc/default/$NAME to enable it."
+#    exit 1
+#fi
+
+# Check that the user exists (if we set a user)
+# Does the user exist?
+if [ -n "$DAEMONUSER" ] ; then
+    if getent passwd | grep -q "^$DAEMONUSER:"; then
+        # Obtain the uid and gid
+        DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'`
+        DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'`
+    else
+        log_failure_msg "The user $DAEMONUSER, required to run $NAME does not exist."
+        exit 1
+    fi
+fi
+
+
+set -e
+
+running_pid() {
+# Check if a given process pid's cmdline matches a given name
+    pid=$1
+    name=$2
+    [ -z "$pid" ] && return 1
+    [ ! -d /proc/$pid ] &&  return 1
+    cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
+    # Is this the expected server
+    [ "$cmd" != "$name" ] &&  return 1
+    return 0
+}
+
+running() {
+# Check if the process is running looking at /proc
+# (works for all users)
+
+    # No pidfile, probably no daemon present
+    [ ! -f "$PIDFILE" ] && return 1
+    pid=`cat $PIDFILE`
+    running_pid $pid $DAEMON || return 1
+    return 0
+}
+
+start_server() {
+# Start the process using the wrapper
+        if [ -z "$DAEMONUSER" ] ; then
+            start_daemon -p $PIDFILE $DAEMON -- $DAEMON_OPTS
+            errcode=$?
+        else
+# if we are using a daemonuser then change the user id
+            start-stop-daemon --start --quiet --pidfile $PIDFILE \
+                        --chuid $DAEMONUSER \
+                        --exec $DAEMON -- $DAEMON_OPTS
+            errcode=$?
+        fi
+       return $errcode
+}
+
+stop_server() {
+# Stop the process using the wrapper
+        if [ -z "$DAEMONUSER" ] ; then
+            killproc -p $PIDFILE $DAEMON
+            errcode=$?
+        else
+# if we are using a daemonuser then look for process that match
+            start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+                        --user $DAEMONUSER \
+                        --exec $DAEMON
+            errcode=$?
+        fi
+
+       return $errcode
+}
+
+reload_server() {
+    [ ! -f "$PIDFILE" ] && return 1
+    pid=pidofproc $PIDFILE # This is the daemon's pid
+    # Send a SIGHUP
+    kill -1 $pid
+    return $?
+}
+
+force_stop() {
+# Force the process to die killing it manually
+       [ ! -e "$PIDFILE" ] && return
+       if running ; then
+               kill -15 $pid
+       # Is it really dead?
+               sleep "$DIETIME"s
+               if running ; then
+                       kill -9 $pid
+                       sleep "$DIETIME"s
+                       if running ; then
+                               echo "Cannot kill $NAME (pid=$pid)!"
+                               exit 1
+                       fi
+               fi
+       fi
+       rm -f $PIDFILE
+}
+
+
+case "$1" in
+  start)
+       log_daemon_msg "Starting $DESC " "$NAME"
+        # Check if it's running first
+        if running ;  then
+            log_progress_msg "apparently already running"
+            log_end_msg 0
+            exit 0
+        fi
+        if start_server ; then
+            # NOTE: Some servers might die some time after they start,
+            # this code will detect this issue if STARTTIME is set
+            # to a reasonable value
+            [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time 
+            if  running ;  then
+                # It's ok, the server started and is running
+                log_end_msg 0
+            else
+                # It is not running after we did start
+                log_end_msg 1
+            fi
+        else
+            # Either we could not start it
+            log_end_msg 1
+        fi
+       ;;
+  stop)
+        log_daemon_msg "Stopping $DESC" "$NAME"
+        if running ; then
+            # Only stop the server if we see it running
+                       errcode=0
+            stop_server || errcode=$?
+            log_end_msg $errcode
+        else
+            # If it's not running don't do anything
+            log_progress_msg "apparently not running"
+            log_end_msg 0
+            exit 0
+        fi
+        ;;
+  force-stop)
+        # First try to stop gracefully the program
+        $0 stop
+        if running; then
+            # If it's still running try to kill it more forcefully
+            log_daemon_msg "Stopping (force) $DESC" "$NAME"
+                       errcode=0
+            force_stop || errcode=$?
+            log_end_msg $errcode
+        fi
+       ;;
+  restart|force-reload)
+        log_daemon_msg "Restarting $DESC" "$NAME"
+               errcode=0
+        stop_server || errcode=$?
+        # Wait some sensible amount, some server need this
+        [ -n "$DIETIME" ] && sleep $DIETIME
+        start_server || errcode=$?
+        [ -n "$STARTTIME" ] && sleep $STARTTIME
+        running || errcode=$?
+        log_end_msg $errcode
+       ;;
+  status)
+
+        log_daemon_msg "Checking status of $DESC" "$NAME"
+        if running ;  then
+            log_progress_msg "running"
+            log_end_msg 0
+        else
+            log_progress_msg "apparently not running"
+            log_end_msg 1
+            exit 1
+        fi
+        ;;
+  # Use this if the daemon cannot reload
+  reload)
+        log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
+        log_warning_msg "cannot re-read the config file (use restart)."
+        ;;
+  # And this if it cann
+  #reload)
+          #
+          # If the daemon can reload its config files on the fly
+          # for example by sending it SIGHUP, do it here.
+          #
+          # If the daemon responds to changes in its config file
+          # directly anyway, make this a do-nothing entry.
+          #
+          # log_daemon_msg "Reloading $DESC configuration files" "$NAME"
+          # if running ; then
+          #    reload_server
+          #    if ! running ;  then
+          # Process died after we tried to reload
+          #       log_progress_msg "died on reload"
+          #       log_end_msg 1
+          #       exit 1
+          #    fi
+          # else
+          #    log_progress_msg "server is not running"
+          #    log_end_msg 1
+          #    exit 1
+          # fi
+                                                                                    #;;
+
+  *)
+       N=/etc/init.d/$NAME
+       echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/patches/01-debian-build.patch b/patches/01-debian-build.patch
new file mode 100644 (file)
index 0000000..923ef11
--- /dev/null
@@ -0,0 +1,140 @@
+Several fixes to make dma build on Debian:
+- build and install the files in the etc/ subdirectory;
+- disable compiler warnings;
+- generate aliases_parse.h and let the others depend on it;
+- replace open(..., O_EXLOCK) with a new open_locked() routine;
+- use st_mtime instead of st_mtimespec;
+- define the __unused function attribute;
+- do not redefine PATH_MAX.
+
+All of these are taken from the Ringlet Subversion repository:
+http://svn.ringlet.net/svn/ringlet/mail/dma/
+http://svn.ringlet.net/cgi-bin/viewvc/viewvc.cgi/ringlet/mail/dma/
+
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,8 @@
+ # $DragonFly: src/libexec/dma/Makefile,v 1.5 2008/09/19 00:36:57 corecode Exp $
+ #
++SUBDIR=       etc
++
+ CFLAGS+= -DHAVE_CRYPTO
+ CFLAGS+= -I${.CURDIR}
+@@ -14,6 +16,25 @@
+ BINOWN= root
+ BINGRP= mail
+ BINMODE=2555
+-WARNS?=       1
++#WARNS?=      1
++
++# The pmake Debian package does not seem to deal properly with y.tab.h
++
++DPSRCS+=      aliases_parse.h
++CLEANFILES+=  aliases_parse.h
++
++YFLAGS+=      -d
++
++aliases_parse.c:      aliases_parse.y
++      ${YACC} ${YFLAGS} aliases_parse.y
++      mv y.tab.c aliases_parse.c
++
++aliases_parse.h:      aliases_parse.c
++      mv y.tab.h aliases_parse.h
++
++aliases_parse.o:      aliases_parse.h
++aliases_scan.o:       aliases_parse.h
+ .include <bsd.prog.mk>
++
++.include <bsd.subdir.mk>
+--- a/dma.c
++++ b/dma.c
+@@ -74,6 +74,8 @@
+ static int daemonize = 1;
+ struct config *config;
++static int open_locked(const char *, int);
++
+ char *
+ hostname(void)
+ {
+@@ -542,7 +544,7 @@
+       }
+       /* mailx removes users mailspool file if empty, so open with O_CREAT */
+-      mbox = open(fn, O_WRONLY | O_EXLOCK | O_APPEND | O_CREAT);
++      mbox = open_locked(fn, O_WRONLY | O_APPEND | O_CREAT);
+       if (mbox < 0) {
+               syslog(LOG_ERR, "%s: local delivery deferred: can not open `%s': %m",
+                      it->queueid, fn);
+@@ -639,7 +641,7 @@
+                       exit(1);
+               }
+               if (gettimeofday(&now, NULL) == 0 &&
+-                  (now.tv_sec - st.st_mtimespec.tv_sec > MAX_TIMEOUT)) {
++                  (now.tv_sec - st.st_mtime > MAX_TIMEOUT)) {
+                       char *msg;
+                       if (asprintf(&msg,
+@@ -703,7 +705,7 @@
+                       continue;
+               if (asprintf(&queuefn, "%s/%s", config->spooldir, de->d_name) < 0)
+                       goto fail;
+-              fd = open(queuefn, O_RDONLY|O_EXLOCK|O_NONBLOCK);
++              fd = open_locked(queuefn, O_RDONLY|O_NONBLOCK);
+               if (fd < 0) {
+                       /* Ignore locked files */
+                       if (errno == EWOULDBLOCK)
+@@ -962,3 +964,24 @@
+       /* NOTREACHED */
+       return (0);
+ }
++
++static int
++open_locked(const char *fname, int flags)
++{
++#ifndef O_EXLOCK
++      int fd, save_errno;
++
++      fd = open(fname, flags, 0);
++      if (fd < 0)
++              return(fd);
++      if (flock(fd, LOCK_EX|((flags & O_NONBLOCK)? LOCK_NB: 0)) < 0) {
++              save_errno = errno;
++              close(fd);
++              errno = save_errno;
++              return(-1);
++      }
++      return(fd);
++#else
++      return(open(fname, flags|O_EXLOCK));
++#endif
++}
+--- a/dma.h
++++ b/dma.h
+@@ -46,6 +46,13 @@
+ #include <stdint.h>
+ #include <stdio.h>
++#ifndef __unused
++#ifdef __GNUC__
++#define __unused      __attribute__((unused))
++#else
++#define __unused
++#endif  /* __GNUC__ */
++#endif
+ #define VERSION       "DragonFly Mail Agent"
+@@ -53,7 +60,9 @@
+ #define MIN_RETRY     300             /* 5 minutes */
+ #define MAX_RETRY     (3*60*60)       /* retry at least every 3 hours */
+ #define MAX_TIMEOUT   (5*24*60*60)    /* give up after 5 days */
++#ifndef PATH_MAX
+ #define PATH_MAX      1024            /* Max path len */
++#endif
+ #define       SMTP_PORT       25              /* Default SMTP port */
+ #define CON_TIMEOUT   120             /* Connection timeout */
diff --git a/patches/02-man-dragonflybsd.patch b/patches/02-man-dragonflybsd.patch
new file mode 100644 (file)
index 0000000..46d8cca
--- /dev/null
@@ -0,0 +1,14 @@
+Use ".Bx DragonFly" to represent DragonFlyBSD since Debian groff does
+not have the ".Dx" macro yet.
+
+--- a/dma.8
++++ b/dma.8
+@@ -248,7 +248,7 @@
+ The
+ .Nm
+ utility first appeared in
+-.Dx 1.11 .
++.Bx DragonFly 1.11 .
+ .Sh AUTHORS
+ .Nm
+ was written by
diff --git a/patches/03-debian-locations.patch b/patches/03-debian-locations.patch
new file mode 100644 (file)
index 0000000..9b1bdaf
--- /dev/null
@@ -0,0 +1,41 @@
+On Debian, the aliases file lives in /etc, not /etc/mail.
+Also, define a smarthost by default, albeit an invalid one.
+
+--- a/dma.8
++++ b/dma.8
+@@ -141,7 +141,7 @@
+ .Pa dma.conf .
+ .Bl -tag -width 4n
+ .It Ic SMARTHOST Xo
+-(string, default=empty)
++(string, default=mail.example.com)
+ .Xc
+ If you want to send outgoing mails via a smarthost, set this variable to
+ your smarthosts address.
+@@ -156,7 +156,7 @@
+ will deliver all mails to this port, regardless of whether a smarthost is set
+ or not.
+ .It Ic ALIASES Xo
+-(string, default=/etc/mail/aliases)
++(string, default=/etc/aliases)
+ .Xc
+ Path to the local aliases file.
+ Just stick with the default.
+--- a/etc/dma.conf
++++ b/etc/dma.conf
+@@ -2,13 +2,13 @@
+ #
+ # Your smarthost (also called relayhost).  Leave blank if you don't want
+ # smarthost support.
+-#SMARTHOST
++SMARTHOST mail.example.com
+ # Use this SMTP port.  Most users will be fine with the default (25)
+ PORT 25
+ # Path to your alias file.  Just stay with the default.
+-ALIASES /etc/mail/aliases
++ALIASES /etc/aliases
+ # Path to your spooldir.  Just stay with the default.
+ SPOOLDIR /var/spool/dma
diff --git a/patches/04-debian-setgid.patch b/patches/04-debian-setgid.patch
new file mode 100644 (file)
index 0000000..042db9a
--- /dev/null
@@ -0,0 +1,14 @@
+As per the Debian Policy, change the /usr/sbin/dma permissions from 2555
+to 2755, since removing root write access gains us nothing.
+
+--- a/Makefile
++++ b/Makefile
+@@ -15,7 +15,7 @@
+ BINOWN= root
+ BINGRP= mail
+-BINMODE=2555
++BINMODE=2755
+ #WARNS?=      1
+ # The pmake Debian package does not seem to deal properly with y.tab.h
diff --git a/patches/series b/patches/series
new file mode 100644 (file)
index 0000000..1c54b77
--- /dev/null
@@ -0,0 +1,4 @@
+01-debian-build.patch
+02-man-dragonflybsd.patch
+03-debian-locations.patch
+04-debian-setgid.patch
diff --git a/postinst b/postinst
new file mode 100644 (file)
index 0000000..68499ca
--- /dev/null
+++ b/postinst
@@ -0,0 +1,40 @@
+#!/bin/sh
+# postinst script for dma
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+umask 022
+
+case "$1" in
+    configure)
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/postinst.ex b/postinst.ex
new file mode 100644 (file)
index 0000000..fb664ed
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+# postinst script for dma
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+. /usr/share/debconf/confmodule
+db_version 2.0
+
+umask 022
+
+case "$1" in
+    configure)
+       db_get shared/mailname
+       echo "$RET" > /etc/mailname
+
+       db_stop
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/postrm.ex b/postrm.ex
new file mode 100644 (file)
index 0000000..e56d252
--- /dev/null
+++ b/postrm.ex
@@ -0,0 +1,37 @@
+#!/bin/sh
+# postrm script for dma
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/preinst.ex b/preinst.ex
new file mode 100644 (file)
index 0000000..5193b70
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+# preinst script for dma
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/prerm.ex b/prerm.ex
new file mode 100644 (file)
index 0000000..07a2823
--- /dev/null
+++ b/prerm.ex
@@ -0,0 +1,38 @@
+#!/bin/sh
+# prerm script for dma
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/rules b/rules
new file mode 100755 (executable)
index 0000000..ae4caa2
--- /dev/null
+++ b/rules
@@ -0,0 +1,89 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Debian build rules for dma, the DragonFly mail agent
+
+include /usr/share/quilt/quilt.make
+
+PACKAGE=       dma
+VERSION = `sed -e 's/^[^ ]\+ (\([^)]\+\)).*/\1/; 1q' debian/changelog`
+VERSION_UP = `sed -e 's/^[^ ]\+ (0\.0\.\([^)-]\+\).*/\1/; 1q' debian/changelog | tr . -`
+VERSION_ADD ?= -debian-01
+
+#CFLAGS+=      -pipe -Wall -W -ansi -pedantic -Wbad-function-cast \
+#              -Wcast-align -Wcast-qual -Wchar-subscripts -Winline \
+#              -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+#              -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings
+ifneq (,$(filter werror,$(DEB_BUILD_OPTIONS)))
+       CFLAGS+=        -Werror
+endif
+ifneq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
+       export STRIPFLAG=
+endif
+
+export CFLAGS
+
+diffsrc:
+       -diff -urN -x .svn debian/ ../svn/${PACKAGE}/tags/${PACKAGE}-${VERSION}${VERSION_ADD}/
+       -diff -urN -x .svn -x debian -x .pc -I'\$$Ringlet.*\$$' ./ ../svn/${PACKAGE}/tags/${PACKAGE}-dfly-${VERSION_UP}/
+
+build: build-stamp
+build-stamp: ${QUILT_STAMPFN}
+       dh_testdir
+       pmake
+       touch $@
+
+clean: 
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       pmake clean
+       $(MAKE) -f debian/rules unpatch
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+       pmake DESTDIR=$(CURDIR)/debian/$(PACKAGE) BINDIR=/usr/sbin install
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       install -d -o root -g mail -m 770 $(CURDIR)/debian/$(PACKAGE)/var/spool/dma
+       install -c -o root -g root -m 644 $(CURDIR)/debian/dma.lintian-overrides $(CURDIR)/debian/$(PACKAGE)/usr/share/lintian/overrides/$(PACKAGE)
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+#      dh_install
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link usr/sbin/dma usr/sbin/sendmail
+       dh_link usr/share/man/man8/dma.8 usr/share/man/man8/sendmail.8
+       dh_strip
+       dh_compress
+       dh_fixperms -Xusr/sbin/dma -Xvar/spool/dma
+#      dh_perl
+#      dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/watch b/watch
new file mode 100644 (file)
index 0000000..21cd961
--- /dev/null
+++ b/watch
@@ -0,0 +1,3 @@
+# watch control file for dma, the DragonFly mail agent
+version=3
+http://devel.ringlet.net/mail/dma/ dma-(\d.*)\.tar\.gz