chiark / gitweb /
Debianization for 1.01-2 debian/1.01-2
authorMark Wooding <mdw@distorted.org.uk>
Wed, 18 Mar 1998 23:33:15 +0000 (23:33 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 14 Feb 2006 00:06:35 +0000 (00:06 +0000)
32 files changed:
TARGETS
conf-cc
conf-groups
conf-ld
datemail.sh
debian/README [new file with mode: 0644]
debian/README.debian [new file with mode: 0644]
debian/TODO [new file with mode: 0644]
debian/build-qmail [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/conffiles [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/debianize-binary-tree [new file with mode: 0644]
debian/debianize-source-tree [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
debian/preinst [new file with mode: 0644]
debian/prerm [new file with mode: 0644]
debian/qmail [new file with mode: 0644]
debian/qmail-src.README [new file with mode: 0644]
debian/rules [new file with mode: 0644]
debian/substvars [new file with mode: 0644]
debian/suid [new file with mode: 0644]
elq.sh
mailsubj.sh
pinq.sh
qail.sh
qlist2.sh
qmail-lspawn.c
qmail.c
sendmail.c

diff --git a/TARGETS b/TARGETS
index 12054c0348e63d29de354ee7b9df45b9211c42d9..0f3ee7045ee0545c9c7ff13cf9f98e1152f0f9f6 100644 (file)
--- a/TARGETS
+++ b/TARGETS
@@ -306,12 +306,14 @@ qmail-rspawn.0
 qmail-clean.0
 qmail-send.8
 qmail-send.0
+qmail-start.8
 qmail-start.0
 splogger.0
 qmail-queue.0
 qmail-inject.0
 mailsubj.0
 qmail-showctl.0
+qmail-newu.8
 qmail-newu.0
 qmail-pw2u.8
 qmail-pw2u.0
@@ -338,8 +340,10 @@ qmail-upgrade.0
 qmail-limits.7
 qmail-limits.0
 qmail-log.0
+qmail-control.5
 qmail-control.0
 qmail-header.0
+qmail-users.5
 qmail-users.0
 dot-qmail.5
 dot-qmail.0
diff --git a/conf-cc b/conf-cc
index e58fb9bbab13783353b0be906ec38e31b3404c52..0f29a89a62239528543516f81db61db4e1d25a53 100644 (file)
--- a/conf-cc
+++ b/conf-cc
@@ -1,3 +1,3 @@
-cc -O2
+cc -O2 -g
 
 This will be used to compile .c files.
index cec08455b015ee11840d18afb3a63705d817794a..0c424557df3f5374ba887cadc07c079b9a7377d9 100644 (file)
@@ -1,5 +1,5 @@
 qmail
-nofiles
+nogroup
 
 These are the qmail groups. The second group should not have access to
 any files, but it must be usable for processes; this requirement
diff --git a/conf-ld b/conf-ld
index a9e796a591d78084a9a102889a2e8f4ba7f9b776..0329c85d90a22863dc55a9810c86c1e286f84e8b 100644 (file)
--- a/conf-ld
+++ b/conf-ld
@@ -1,3 +1,4 @@
+cc
 cc -s
 
 This will be used to link .o files into an executable.
index fd28f46d4edb20af8c17a449920c7bcc1c9f6453..caa2c42affcbe3f82dd980c4fac520134a02605b 100644 (file)
@@ -1 +1 @@
-exec QMAIL/bin/predate QMAIL/bin/sendmail ${1+"$@"}
+exec /usr/sbin/predate /usr/sbin/sendmail ${1+"$@"}
diff --git a/debian/README b/debian/README
new file mode 100644 (file)
index 0000000..6ff1a99
--- /dev/null
@@ -0,0 +1,7 @@
+Things to do when debianizing a new version of qmail.
+ Christian Hudon <chrish@debian.org>
+
+* Run debian/debianize-source-tree
+
+NB Programs are classified as belonging to sbin or bin according to their 
+manual page section. (section 1: bin; section 8: sbin)
diff --git a/debian/README.debian b/debian/README.debian
new file mode 100644 (file)
index 0000000..f5a17bd
--- /dev/null
@@ -0,0 +1,64 @@
+WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
+
+  qmail does not support dot-locking internally.
+
+  You are in danger of losing mail if you re-configure
+  qmail without understanding the implications of this.
+
+WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
+
+On Debian the standard location for a users mailbox is
+
+  /var/spool/mail/<username>
+
+and when programs write to that file they are expected to lock the
+file to prevent another process from accessing it at the same time, and
+thus corrupting your mail file.
+
+For reasons explained in /usr/doc/qmail/INSTALL.mbox, qmail does not do this.
+
+The default setup uses /usr/sbin/qmail-procmail to perform the final
+delivery of mail with apropriate dot-locking to prevent loss of mail.
+This is just a script that invokes procmail.
+
+You should not really need to invoke this as a user, but if you can
+think of a reason to do so, a line like this in your .qmail file will
+result in normal delivery via procmail:
+
+  |/usr/sbin/qmail-procmail
+
+If you were to instead put something like:
+
+  /var/spool/mail/phil
+
+in your .qmail file, it would deliver mail to that file, but would
+lock it using flock's rather than dot-lock's.  Unless you know
+different, that would probably mean that every other program on the
+system would consider the file to be unlocked, and would leave you
+open to mail loss.
+
+Personally, I'd recommend moving to Maildir/ format if you can.  Read
+the files in /usr/doc/qmail to find out more.
+
+---
+
+How the Debian setup differs from standard qmail setups:
+
+  The default setup sets aliasempty (i.e. the default delivery method)
+  to be /usr/sbin/qmail-procmail, which is a wrapper around procmail.
+
+  This results in delivery into /var/spool/mail.
+
+  To change this to one of the more standard qmail setups edit
+  /etc/init.d/qmail
+
+  The binaries normail found in /var/qmail/bin have been split between
+  /usr/bin and /usr/sbin.
+
+  The configuration files have been moved to /etc/qmail and the queue
+  has been moved to /var/spool/qmail.
+
+  Symbolic links have been placed in /var/qmail to make it look like a
+  normal qmail setup.
+
+Phil Hands <phil@hands.com>
diff --git a/debian/TODO b/debian/TODO
new file mode 100644 (file)
index 0000000..432d76b
--- /dev/null
@@ -0,0 +1,4 @@
+* Write nice qmailconfig script
+* Add aliases for postmaster, root and mailer-daemon
+* Enable pop3d daemon?
+* Edit /etc/login.defs:MAIL_DIR/MAIL_FILE ?
diff --git a/debian/build-qmail b/debian/build-qmail
new file mode 100644 (file)
index 0000000..dfcf28b
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh -e
+
+NEWDIR=./qmail
+
+cat <<-'!END!'
+
+       This script unpacks the qmail source in /usr/src/qmail-src
+       into a directory, and compiles it to produce a binary qmail*.deb file
+       The directory where this is done will end up containing the
+       source and package files for the qmail binary package, along
+       with a directory containing the unpacked source.
+
+       !END!
+
+echo -n "Where would you like to do this [$NEWDIR] "
+read line
+
+NEWDIR="${line:-$NEWDIR}"
+
+if test -d $NEWDIR
+then
+  echo -n "'$NEWDIR' already exists, should I use it anyway ? [yN] "
+  read yn
+  test "$yn" = y -o "$yn" = Y || exit 1
+else
+  mkdir $NEWDIR
+fi
+
+cd $NEWDIR
+dpkg-source -x /usr/src/qmail-src/qmail_*.dsc
+cd qmail-*
+
+BECOMEROOT=fakeroot
+cat <<-'!END!'
+
+       For some reason fakeroot causes install to hang on my system, so I'm
+       giving you the option of running sudo or fakeroot.  Give fakeroot a try
+       but if it does not work use sudo instead.
+
+       !END!
+echo -n "Should I use sudo or fakeroot to build the package ? [sF] "
+read yn
+test "$yn" = s -o "$yn" = S && BECOMEROOT=sudo
+
+dpkg-buildpackage -us -uc -r$BECOMEROOT
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..47c8866
--- /dev/null
@@ -0,0 +1,35 @@
+qmail (1.01-2) non-free; urgency=low
+
+  * new maintainer
+  * qmail-1.01.orig.tar.gz now really is pristine source ;-)
+  * revert to unpatched source, and get dot-locking by use of procmail
+  * add creation of qmail-src
+
+ -- Philip Hands <phil@hands.com>  Fri, 31 Oct 1997 21:13:40 +0000
+
+qmail (1.01-1) experimental; urgency=low
+
+  * New upstream release.
+  * Gave in and added /usr/lib/sendmail symlink (fixes bugs 10283 and 11347)
+  * Compiled with libc6.
+  * qmail-1.01.orig.tar.gz is now pristine source, thanks to dpkg 1.4.0.19
+
+ -- Christian Hudon <chrish@debian.org>  Fri,  8 Aug 1997 22:22:24 -0400
+
+qmail (1.00-2) experimental; urgency=low
+
+  * Fixed error in sed expression of qmailconfig (Thanks to Philip Hands)
+  * Made '/etc/init.d/qmail stop' output look prettier.
+
+ -- Christian Hudon <chrish@debian.org>  Sun, 13 Apr 1997 19:12:59 -0400
+
+qmail (1.00-1) experimental; urgency=low
+
+  * Initial release.
+
+ -- Christian Hudon <chrish@debian.org>  Wed, 26 Mar 1997 00:24:38 -0500
+
+Local variables:
+mode: debian-changelog
+add-log-mailing-address: "phil@hands.com"
+End:
diff --git a/debian/conffiles b/debian/conffiles
new file mode 100644 (file)
index 0000000..49c92fe
--- /dev/null
@@ -0,0 +1 @@
+/etc/init.d/qmail
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..9ede531
--- /dev/null
@@ -0,0 +1,67 @@
+Source: qmail
+Maintainer: Philip Hands <phil@hands.com>
+Section: mail
+Priority: extra
+Standards-Version: 2.1.2.2
+
+Package: qmail
+Architecture: any
+Section: mail
+Priority: extra
+Depends: ${shlibs:Depends}, netbase, procmail
+Provides: mail-transport-agent
+Conflicts: mail-transport-agent
+Suggests: pine | mail-reader
+Description: Secure, reliable, efficient, simple mail transport system
+ qmail is a secure, reliable, efficient, simple message transfer agent. It
+ is meant as a replacement for the entire sendmail-binmail system on typical
+ Internet-connected UNIX hosts. 
+ .
+ Reliable: qmail's straight-paper-path philosophy guarantees that a message,
+ once accepted into the system, will never be lost. qmail also supports
+ maildir, a new, super-reliable user mailbox format. Maildirs, unlike mbox
+ files and mh folders, won't be corrupted if the system crashes during
+ delivery. Even better, not only can a user safely read his mail over NFS,
+ but any number of NFS clients can deliver mail to him at the same time. 
+ .
+ Efficient: On a Pentium, qmail can easily sustain 200000 local messages per
+ day---that's separate messages injected and delivered to mailboxes in a real
+ test!  Although remote deliveries are inherently limited by the slowness of
+ DNS and SMTP, qmail overlaps 20 simultaneous deliveries by default, so it
+ zooms quickly through mailing lists.
+ .
+ Simple: qmail is vastly smaller than any other Internet MTA. Some reasons why:
+ (1) Other MTAs have separate forwarding, aliasing, and mailing list
+  mechanisms. qmail has one simple forwarding mechanism that lets users handle
+  their own mailing lists.
+ (2) Other MTAs offer a spectrum of delivery modes, from fast+unsafe to
+  slow+queued. qmail-send is instantly triggered by new items in the queue, so
+  the qmail system has just one delivery mode: fast+queued.
+ (3) Other MTAs include, in effect, a specialized version of inetd that
+  watches the load average. qmail's design inherently limits the machine load,
+  so qmail-smtpd can safely run from your system's inetd. 
+ .
+ Replacement for sendmail: qmail supports host and user masquerading, full
+ host hiding, virtual domains, null clients, list-owner rewriting, relay
+ control, double-bounce recording, arbitrary RFC 822 address lists, cross-host
+ mailing list loop detection, per-recipient checkpointing, downed host
+ backoffs, independent message retry schedules, etc.  In short, it's up to
+ speed on modern MTA features. qmail also includes a drop-in ``sendmail''
+ wrapper so that it will be used transparently by your current UAs. 
+
+Package: qmail-src
+Architecture: all
+Section: mail
+Depends: dpkg-dev, fakeroot | sudo 
+Priority: extra
+Description: Source only package for building qmail binary package
+ qmail is a secure Secure, reliable, efficient, simple mail transport system.
+ .
+ Dan Bernstein (qmail's author) only gives permission for qmail to be
+ distributed in source form, or binary for by approval.  This package
+ has been put together to allow people to easily build a qmail binary
+ package for themselves, from source.
+ .
+ If there is a package called qmail available, then Dan has approved the
+ binary version of the package for approval, so you might as well install
+ that and save yourself some effort.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..4ba0bb1
--- /dev/null
@@ -0,0 +1,33 @@
+Qmail is Copyright 1996, D. J. Bernstein.
+--
+
+Unfortunately (from SPI's point of view) Dan Bernstein does not include
+a conventional licence for qmail, so instead you must examine his published
+documentation on the subject to determine your rights to use his software.
+
+The right to distribute unmodified copies of the qmail-1.01 source is granted
+here:
+
+  ftp://koobera.math.uic.edu/www/qmail/dist.html
+
+In addition, Dan will approve distribution of specific binary packages, which
+he should have done for the Debian package that contains this file by the time
+you get to read it.
+
+He also states (see ftp://koobera.math.uic.edu/www/softwarelaw.html)
+the following:
+
+  What does all this mean for the free software world? Once you've legally
+  downloaded a program, you can compile it. You can run it. You can modify
+  it. You can distribute your patches for other people to use. If you think
+  you need a license from the copyright holder, you've been bamboozled by
+  Microsoft. As long as you're not distributing the software, you have
+  nothing to worry about.
+
+Of course, this only applies to people under US jurisdiction, but Dan
+claims that similar laws are in effect in most of the countries that
+take any notice of copyright, so I suppose that one can assume that
+this encapsulates his wishes on the subject.
+
+Cheers, Phil.
+<phil@hands.com>
diff --git a/debian/debianize-binary-tree b/debian/debianize-binary-tree
new file mode 100644 (file)
index 0000000..72dbf6f
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e 
+
+function startofpath() {
+    if [ -f usr/man/man8/`basename $1`.8 ]; then
+       echo usr/sbin
+    elif [ -f usr/man/man1/`basename $1`.1 ]; then
+       echo usr/bin
+    else
+       case `basename $1` in
+           elq|pinq|qail|qlist2) echo usr/bin;;
+           datemail|predate|qmail-home|qsmhook|sendmail) echo usr/sbin;;
+           *) echo 1>&2 Cannot determine if $1 belongs in sbin or bin;exit 2;;
+       esac
+    fi
+}
+
+test -d debian/tmp || (echo "Could not find debian/tmp directory.";exit 1)
+
+cd debian/tmp
+
+for f in var/qmail/bin/*; do
+    mv $f `startofpath $f`
+done
+
+rmdir var/qmail/bin || ( echo "Could not remove qmail/bin directory!"; exit 3)
diff --git a/debian/debianize-source-tree b/debian/debianize-source-tree
new file mode 100644 (file)
index 0000000..d1225bf
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -e
+
+if [ ! -f qmail-start.c ]; then
+    echo "This program must be run from the qmail source directory!"
+    exit 1
+fi
+
+#if [ ! -f qmail-send.8 ]; then
+#    make man
+#fi
+
+for f in `fgrep -l QMAIL/bin *.sh`; do
+    mv $f $f.$$ && sed -e "s,QMAIL/bin/predate,/usr/sbin/predate,g" \
+                      -e "s,QMAIL/bin/sendmail,/usr/sbin/sendmail,g" \
+                      -e "s,QMAIL/bin/maildir2mbox,/usr/bin/maildir2mbox,g" \
+                      -e "s,QMAIL/bin/qmail-inject,/usr/sbin/qmail-inject,g" \
+                      -e "s,QMAIL/bin/qlist,/usr/bin/qlist,g" $f.$$ >$f && \
+    rm $f.$$
+done
+
+if ls *.$$ >/dev/null 2>&1; then
+    echo Error during debianization! Some temporary files remain.
+    exit 1
+fi
+
+if fgrep QMAIL/bin *.sh; then
+    echo Error during debianization! Some .sh files still have relative paths.
+    exit 2
+fi
+
+
+if fgrep -q nofiles conf-groups; then
+    if sed <conf-groups >conf-groups.$$ -e '2s/nofiles/nogroup/' && \
+      mv -f conf-groups.$$ conf-groups; then
+       echo The file conf-groups was auto-edited. 
+       echo Please eyeball it to see if the editing was done correctly.
+       echo --- begin conf-groups ----
+       cat conf-groups
+       echo ---  end conf-groups  ----
+       echo
+    else
+       echo Error during auto-editing of conf-groups!
+       exit 3
+    fi
+fi
+
+if grep '\"bin/' *.c | grep -v 'qmail-\(check\|setup\)' >/dev/null; then
+    echo Remember to replace the relative paths by full paths in the following files:
+    grep '\"bin/' *.c | grep -v 'qmail-\(check\|setup\)'
+fi
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..8014036
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+require DebianNet;
+
+$| = 1;
+
+my $action = shift;
+
+if ( $action eq 'configure' or $action eq 'abort-upgrade' or $action eq 'abort-deconfigure' or $action eq 'abort-remove' ) {
+    my $old_version = shift;
+
+    DebianNet::add_service('smtp       stream  tcp     nowait  qmaild  /usr/sbin/tcpd /usr/bin/tcp-env /usr/sbin/qmail-smtpd', 
+                          "MAIL");
+    DebianNet::enable_service('smtp');
+
+    # Add rc?.d links
+    system('update-rc.d qmail defaults >/dev/null');
+
+    if ( ! -r '/var/qmail/control/me' ) {
+       system("/usr/sbin/qmailconfig");
+    }
+
+    if ( !defined($old_version) || $old_version eq '' ) { 
+       print <<'EOT1';
+
+By default qmail will deliver mail to ~/Mailbox instead of /var/spool/mail.
+To learn how to deal with this, read the file /usr/doc/qmail/INSTALL.mbox.
+Disregard the warning in INSTALL.mbox about qmail-alias using flock to lock
+the mailbox.
+
+If you were using sendmail (or smail) previously, you will want to read
+the "qmail-upgrade" manpage, which details user-visible differences between
+sendmail and qmail.
+
+If you are new to qmail, you will want to at least peruse the qmail FAQ, which
+can be found in /usr/doc/qmail
+
+EOT1
+        print 'Do you want to start qmail now? [y/N] ';
+       my $answer = <STDIN>;
+       if ( $answer =~ /^\s*[yY]/ ) {
+           system("/etc/init.d/qmail start");
+       } 
+       else {
+           print <<'EOT2';
+Qmail will be started at the next reboot. Or you can start qmail manually when 
+you are ready by typing (as root) "/etc/init.d/qmail start" at a shell prompt.
+EOT2
+        }
+    }
+    else {
+       system("/etc/init.d/qmail start");
+    }
+}
+
+exit 0;
+
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..0e5686f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+$| = 1;
+
+$action = shift @ARGV;
+
+if ( $action eq 'purge' ) {
+    system('update-rc.d qmail remove >/dev/null');
+    system("rm -rf /var/qmail");
+    system("rm -rf /etc/qmail");
+    exit $?;
+}
+
+if ( $action eq 'abort-install' ) {
+    # Put back old inetd.conf (?)
+    exit 0
+}
+
diff --git a/debian/preinst b/debian/preinst
new file mode 100644 (file)
index 0000000..bfacc91
--- /dev/null
@@ -0,0 +1,218 @@
+#!/usr/bin/perl
+
+require 5.002;
+use strict 'subs';
+use strict 'barewords';
+use English;
+
+sub check_uid($$$$$$) {
+    my ($name, $uid, $gid, $gecos, $home, $shell) = @_;
+    my $ok = 1;
+
+    print "Checking user $name (uid $uid, gid $gid, homedir $home)... ";
+    @name_entry = getpwnam("$name");
+    if ( @name_entry == () ) {
+       my @uid_entry = getpwuid($uid);
+       if ( @uid_entry == () ) {
+           system("adduser --system --quiet --home $home --gid $gid --uid $uid --gecos \'$gecos\' $name >/dev/null 2>&1");
+           if ( $? != 0 ) {
+               print "\n Error while adding user $name!\n";
+               $ok = 0;
+           }
+           else {
+               print "added.\n";
+           }
+           system("chsh -s $shell $name");
+       }
+       else {
+           print "error!\n Uid $uid is being used by user $uid_entry[0]\n";
+           $ok = 0;
+       }
+    }
+    else {
+       if ( $name_entry[3] != $gid ) {
+           print "error!\n" if $ok;
+           print " User $name has primary group $name_entry[3] instead of $gid\n";
+           $ok = 0;
+       }
+       if ( $name_entry[2] != $uid ) {
+           print "error!\n" if $ok;
+           print " User $name has uid $name_entry[2] instead of $uid\n";
+           $ok = 0;
+       }
+       if ( $name_entry[7] ne $home ) {
+           print "error!\n" if $ok;
+           print " User $name has home directory $name_entry[7] instead of $home\n";
+           $ok = 0;
+       }
+       if ( $ok ) {
+           print "ok.\n";
+       }
+    }
+    return $ok;
+}
+
+sub check_gid($$@) {
+    my ($name, $gid, @members) = @_;
+    my $ok = 1;
+
+    print "Checking group $name (gid $gid)... ";
+    @name_entry = getgrnam($name);
+    if ( @name_entry == () ) {
+       my @gid_entry = getgrgid($gid);
+       if ( @gid_entry == () ) {
+           system("addgroup --quiet --gid $gid $name");
+           if ( $? != 0 ) {
+               print "\n Error while adding group $name\n";
+               $ok = 0;
+           }
+           else {
+               print "added.\n";
+           }
+       }
+       else {
+           print "error!\n Gid $gid is being used by group $gid_entry[0]\n";
+           $ok = 0;
+       }
+    }
+    else {
+       if ( $name_entry[2] != $gid ) {
+           print "error!\n Group $name has gid $name_entry[2] instead of $gid\n";
+           $ok = 0;
+       }
+       if ( $ok ) {
+           print "ok.\n";
+       }
+    }
+    return $ok;
+}
+
+sub is_qmail_installed {
+    my $qmail_installed = 0;
+
+    print "Checking if qmail is already installed on this computer... ";
+
+    $qmail_home = '';
+    if ( -d '/var/qmail' ) {
+       print "\n Found /var/qmail directory";
+       $qmail_home = '/var/qmail';
+       $qmail_installed = 1;
+    }
+    else {
+       $qmail_home = `qmail-home`;
+       if ( $qmail_home ne '') {
+           print "\n Found qmail home directory at $qmail_home (using qmail-home program)";
+           $qmail_installed = 1;
+       }
+    }
+
+    if ( -d '/var/spool/qmail' ) {
+       print "\n Found qmail spool directory at /var/spool/qmail";
+       $qmail_installed = 1;
+    }
+    if ( -d '/etc/qmail' ) {
+       print "\n Found qmail control directory at /etc/qmail";
+       $qmail_installed = 1;
+    }
+    
+    if ( (-r '/etc/inetd.conf') and `fgrep -q qmail-smtpd /etc/inetd.conf` ) {
+       print "\n Found reference to qmail-smtpd in /etc/inetd.conf";
+       $qmail_installed = 1;
+    }
+    if ( (-r '/etc/xinetd.conf') and `fgrep -q qmail-smtpd /etc/xinetd.conf` ) {
+       print "\n Found reference to qmail-smtpd in /etc/xinetd.conf";
+       $qmail_installed = 1;
+    }
+
+    if ( -x '/etc/init.d/qmail' ) {
+       print "\n Found /etc/init.d/qmail script";
+       $qmail_installed = 1;
+    }
+    elsif ( `fgrep -q qmail-start /etc/init.d/*` ) {
+       print "\n Found reference to qmail-start in /etc/init.d directory";
+       $qmail_installed = 1;
+    }
+    if ( -x '/etc/rc.local' and `fgrep -q qmail-start /etc/rc.local` ) {
+       print "\n Found reference to qmail-start in /etc/rc.local";
+       $qmail_installed = 1;
+    }
+
+    if ( `killall -0 qmail-send >/dev/null 2>&1` ) {
+       print "\n Found qmail-send process running";
+       $qmail_installed = 1;
+    }
+
+    print 'no.' unless $qmail_installed;
+    print "\n";
+    return $qmail_installed;
+}
+       
+
+$| = 1;
+
+$action = shift;
+
+if ( $action eq 'install' ) {
+    $old_version = shift;
+    if ( ! defined $old_version || $old_version eq '' ) {
+       print "First installation of the Debian qmail package...\n";
+       # Check if a non-Debian qmail is installed...
+       if ( is_qmail_installed() ) {
+           print "Please remove your copy of qmail before installing the qmail Debian package.\n\n";
+           exit 1;
+       }
+       # Check for qmail uids and gids
+       my $errors;
+       $errors++ unless check_gid('qmail', 70, ());
+       #$errors++ unless check_gid('nogroup', 65534, ());
+
+       $errors++ unless check_uid('alias', 70, 65534, 'qmail alias', '/var/qmail/alias', '/bin/sh');
+       $errors++ unless check_uid('qmaild', 71, 65534, 'qmail daemon', '/var/qmail', '/bin/sh');
+       $errors++ unless check_uid('qmails', 72, 70, 'qmail send', '/var/qmail', '/bin/sh');
+       $errors++ unless check_uid('qmailr', 73, 70, 'qmail remote', '/var/qmail', '/bin/sh');
+       $errors++ unless check_uid('qmailq', 74, 70, 'qmail queue', '/var/qmail', '/bin/sh');
+       $errors++ unless check_uid('qmaill', 75, 65534, 'qmail log', '/var/qmail', '/bin/sh');
+       $errors++ unless check_uid('qmailp', 76, 65534, 'qmail pw', '/var/qmail', '/bin/sh');
+       #$errors++ unless check_uid('nobody', 65534, 65534, 'nobody', '/tmp', '/bin/sh');
+
+       if ( $errors ) {
+           print "\n$errors entries have errors. Please correct these errors and reinstall qmail.\n";
+           exit 2;
+       }
+    }
+
+    # Make sure there are no smtp entries in /etc/inetd.conf
+    # Kludge around smail buggy /etc/inetd.conf handling. (Grr.)
+    my $fixed_smail = 0;
+    my $found_commented = 0;
+    my $found_uncommented = 0;
+    my $new_inetd = "/etc/inetd.conf.qmail-preinst.$$";
+    open I, '</etc/inetd.conf' or die "Could not open /etc/inetd.conf\n";
+    open N, ">$new_inetd" or die "Could not create $new_inetd\n";
+    while (<I>) {
+       if ( m|^\# *smtp\s+.*/usr/sbin/in.smtpd.*\(will be restored by smail postinst\)\s*$| ) {
+                $fixed_smail = 1;
+               next;
+            } elsif ( m/^\# *smtp\s+/ ) {
+                $found_commented= 1;
+            } elsif ( m/^smtp\s+/ ) {
+                $found_uncommented= 1;
+            }
+       print N or die "Cannot write to $new_inetd\n";
+       }
+    close N or die "Could not close $new_inetd\n";
+    close I or die "Could not close /etc/inetd.conf\n";
+    if ( $found_commented or $found_uncommented ) {
+       print "Your /etc/inetd.conf already containts entries for the SMTP service.\n";
+       print "Please remove all SMTP entries from /etc/inetd.conf (even those commented out)\n";
+       print "and reinstall the qmail package.\n\n";
+       exit 1; 
+    }
+    if ( $fixed_smail ) {
+       print "Removing commented smtp entry left by buggy version of smail postinst... ";
+       rename "$new_inetd", '/etc/inetd.conf' or die "failed!\n";
+       print "done.\n";
+    }
+}
+
+exit 0;
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..fa2406e
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+require DebianNet;
+
+$| = 1;
+
+$action = shift;
+
+if ( $action eq 'failed-upgrade' ) {
+    exit 1;
+}
+
+if ( $action eq 'upgrade'  or $action eq 'deconfigure' ) {
+    system("/etc/init.d/qmail stop");
+    exit $? if $?;
+    DebianNet::disable_service('smtp');
+    exit 0;
+}
+
+if ( $action eq 'remove' ) {
+    # Ask for confirmation if there are still messages in qmail's queue.
+    $mesg_inqueue = `find /var/qmail/queue/mess -type f -print | wc -l`;
+    $mesg_inqueue =~ s/\s//g;
+    $mesg_unprocessed = `find /var/qmail/queue/todo -type f -print | wc -l`;
+    $mesg_unprocessed =~ s/\s//g;
+
+    if ( $mesg_inqueue != 0 || $mesg_unprocessed != 0 ) {
+       print STDERR <<EOT;
+There are still messages in qmail's queue. You probably want to wait until
+qmail's queue is empty before removing the qmail package. Otherwise 
+the messages currently waiting in the queue will not be delivered or will be 
+lost. (\`qmail-qstat' will tell you the number of messages in qmail's queue.)
+
+EOT
+
+        print STDERR 'Do you still want to proceed and remove the qmail package? [y/N] ';
+       my $answer = <STDIN>;
+       exit 1 unless $answer =~ /^\s*[yY]/;
+    }
+
+    # Remove qmail-smtpd from inetd.conf
+    DebianNet::remove_service('smtp\s+stream\s+tcp\s+nowait\s+qmaild.*/usr/sbin/qmail-smtpd');
+    
+    # Stop qmail process.
+    system("/etc/init.d/qmail stop");
+    exit $? if $?;
+}
+
+exit 0;
diff --git a/debian/qmail b/debian/qmail
new file mode 100644 (file)
index 0000000..55e7faa
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/sh
+#
+# /etc/init.d/qmail : start or stop the qmail mail subsystem.
+#
+# Written by Christian Hudon <chrish@debian.org>
+
+#
+# Configuration
+#
+
+
+# set default delivery method
+
+alias_empty="|/usr/sbin/qmail-procmail"  # procmail delivery to /var/spool/mail
+#alias_empty="./Maildir/"       # This uses qmail prefered ~/Maildir/ directory
+#alias_empty="./Mailbox"        # This uses Mailbox file in users $HOME
+
+logger="splogger qmail"
+#logger="|accustamp >>/var/log/qmail.log"   # If you have accustamp installed.
+#logger=">>/var/log/qmail.log"              # Does not give timing info.
+
+# If you uncommented one of the lines that appends to /var/log/qmail.log, you
+# need to uncomment the following two lines.
+#touch /var/log/qmail.log
+#chown qmaill /var/log/qmail.log
+
+#
+# End of configuration
+#
+
+test -x /usr/sbin/qmail-start || exit 0
+test -x /usr/sbin/qmail-send || exit 0
+
+case "$1" in
+    start)
+       echo -n "Starting mail-transfer agent: qmail"
+       sh -c "start-stop-daemon --start --quiet \
+                --exec /usr/sbin/qmail-send \
+                --startas /usr/sbin/qmail-start -- \"$alias_empty\" $logger &"
+       echo "."
+       ;;
+    stop)
+       echo -n "Stopping mail-transfer agent: qmail"
+       if [ "`pidof /usr/sbin/qmail-send`" ] ; then
+           start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/qmail-send
+
+           # Wait until the timeout for qmail processes to die.
+           count=120
+           numdots=0
+           while ([ $count != 0 ]) do
+               let count=$count-1
+               if [ "`pidof /usr/sbin/qmail-send`" ] ; then
+                   echo -n .
+                   let numdots=$numdots+1
+                   sleep 1
+               else
+                   count=0
+               fi
+           done
+
+           # If it's not dead yet, kill it.
+#          if [ "`pidof /usr/sbin/qmail-send`" ] ; then
+#              echo -n " TIMEOUT!"
+#              kill -KILL `pidof /usr/sbin/qmail-send`
+#          else
+               case $numdots in
+                 0) echo "." ;;
+                 1) echo ;;
+                 *) echo " done." ;;
+               esac
+#          fi
+       else
+           echo " not running.";
+       fi
+
+       ;;
+    restart)
+       $0 stop
+       $0 start
+       ;;
+    reload)
+       echo "Reloading 'locals' and 'virtualdomains' control files."
+       start-stop-daemon --stop --quiet --oknodo --signal HUP --exec /usr/sbin/qmail-send
+       ;;
+    *)
+       echo 'Usage: /etc/init.d/qmail {start|stop|restart|reload}'
+       exit 1
+esac
+
+exit 0
diff --git a/debian/qmail-src.README b/debian/qmail-src.README
new file mode 100644 (file)
index 0000000..f6250c3
--- /dev/null
@@ -0,0 +1,9 @@
+This is a feeble little package that just contains a script to unpack
+and build qmail from source, so that we don't violate Dan Bernstein's
+`no binary distribution, without approval' restriction.
+
+Hopefully this will help allow a binary package to be approved, but
+even if it doesn't it means that Debian users can use qmail without to
+much effort.
+
+Philip Hands <phil@hands.com>
diff --git a/debian/rules b/debian/rules
new file mode 100644 (file)
index 0000000..e8193f3
--- /dev/null
@@ -0,0 +1,97 @@
+#!/usr/bin/make -f 
+#
+
+build:
+       $(checkdir)
+       if fgrep QMAIL/bin *.sh >/dev/null; then \
+           echo >&2 "You must run debian/debianize-source-tree first!"; \
+           exit 1; \
+       fi
+       $(MAKE) man
+       $(MAKE)
+       touch build
+
+clean:
+       $(checkdir)
+       -rm -f build
+       -$(MAKE) clean
+       -rm `find . -name "*~"`
+       -rm -rf debian/files
+       -rm -rf `find debian/* -type d -prune`
+
+binary-indep: checkroot build
+       $(checkdir)
+
+binary-arch: checkroot build
+       $(checkdir)
+       -rm -rf debian/files debian/substvars debian/tmp
+       -rm -rf `find debian/* -type d -prune`
+# Make the directory tree and copy qmail files.
+       install -d debian/tmp/etc/init.d \
+               debian/tmp/usr/doc/qmail \
+               debian/tmp/var/qmail \
+               debian/tmp/var/spool \
+               debian/tmp/usr/bin \
+               debian/tmp/usr/sbin \
+               debian/tmp/usr/lib \
+               debian/qmail-src/usr/bin \
+               debian/qmail-src/usr/src/qmail-src \
+               debian/qmail-src/usr/doc/qmail-src
+       ./qmail-hier | ./install debian/tmp/var/qmail
+       mv debian/tmp/var/qmail/queue debian/tmp/var/spool/qmail
+       mv debian/tmp/var/qmail/control debian/tmp/etc/qmail
+       (cd debian/tmp/var/qmail && ln -s /var/spool/qmail queue)
+       (cd debian/tmp/var/qmail && ln -s /etc/qmail control)
+       mv debian/tmp/var/qmail/man debian/tmp/usr/man && \
+               rm -r debian/tmp/usr/man/cat?
+# Move /var/qmail/bin programs to either /usr/bin or /usr/sbin
+       bash debian/debianize-binary-tree
+# Create /usr/lib/sendmail symlink for backward compatibility.
+       (cd debian/tmp/usr/lib && ln -s ../sbin/sendmail)
+# Copy qmailconfig and its helper programs...
+       install -o root -g root -m 755 dnsfq debian/tmp/usr/sbin/qmailconfig-dnsfq
+       install -o root -g root -m 755 dnsip debian/tmp/usr/sbin/qmailconfig-dnsip
+       install -o root -g root -m 755 ipmeprint debian/tmp/usr/sbin/qmailconfig-ipmeprint
+       install -o root -g root -m 755 dnsptr debian/tmp/usr/sbin/qmailconfig-dnsptr
+# (This one is a bit of a kludge...)
+       sed -e 's|./hostname|hostname|g' \
+           -e 's|\./dnsptr|/usr/sbin/qmailconfig-dnsptr|g' \
+           -e 's|\./dnsip|/usr/sbin/qmailconfig-dnsip|g' \
+           -e 's|\./dnsfq|/usr/sbin/qmailconfig-dnsfq|g' \
+           -e 's|\./ipmeprint|/usr/sbin/qmailconfig-ipmeprint|g' \
+               qmail-config >debian/tmp/usr/sbin/qmailconfig
+       chmod 755 debian/tmp/usr/sbin/qmailconfig
+# Install /etc/init.d/qmail
+       install -o root -g root -m 755 debian/qmail debian/tmp/etc/init.d/qmail
+# Copy /usr/doc/qmail files.
+       install -o root -g root -m 644 debian/changelog debian/tmp/usr/doc/qmail/changelog.Debian
+# do the stuff for qmail-src
+       cp ../qmail_1.01.orig.tar.gz ../qmail_1.01-2.diff.gz \
+                ../qmail_1.01-2.dsc debian/qmail-src/usr/src/qmail-src
+       install -m 755 debian/build-qmail debian/qmail-src/usr/bin
+       install debian/copyright debian/qmail-src/usr/doc/qmail-src
+       install debian/qmail-src.README debian/qmail-src/usr/doc/qmail-src/README
+       debstd -m CHANGES BLURB* FAQ INTERNALS README RFC* \
+               SECURITY INSTALL.* SYSDEPS THANKS THOUGHTS TODO
+# Correct permissions of binaries and manpages...
+       chmod go+rx debian/tmp/usr/*bin/*
+       chown -R root.root debian/tmp/usr/man
+
+       dpkg-gencontrol -pqmail
+# And finally, build the Debian package!
+       dpkg --build debian/tmp ..
+
+define checkdir
+       test -f qmail-send.c -a -f debian/rules
+endef
+
+binary:        binary-indep binary-arch
+
+source diff:
+       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+checkroot:
+       $(checkdir)
+       test "`whoami`" = root
+
+.PHONY: binary binary-arch binary-indep clean checkroot
diff --git a/debian/substvars b/debian/substvars
new file mode 100644 (file)
index 0000000..361c161
--- /dev/null
@@ -0,0 +1 @@
+shlibs:Depends=libc5 (>= 5.4.0-0)
diff --git a/debian/suid b/debian/suid
new file mode 100644 (file)
index 0000000..cfb931e
--- /dev/null
@@ -0,0 +1 @@
+off
diff --git a/elq.sh b/elq.sh
index 7e20262d810617ce2417d0be3ef03d69a3285aa2..22a327d43bc546d37a83ba068d8c87fc6cbe080d 100644 (file)
--- a/elq.sh
+++ b/elq.sh
@@ -1 +1 @@
-QMAIL/bin/maildir2mbox && exec elm ${1+"$@"}
+/usr/bin/maildir2mbox && exec elm ${1+"$@"}
index a93d3f45a43ba187209502c21900eadaff7cafaa..d465b93dcc5fa28c3ff025752bdb544190966369 100644 (file)
@@ -4,4 +4,4 @@ shift
   echo To: ${1+"$@"}
   echo ''
   cat
-) | QMAIL/bin/qmail-inject
+) | /usr/sbin/qmail-inject
diff --git a/pinq.sh b/pinq.sh
index 93e747a2503e49621fa15c5d8ddcd82b71506b9f..06847d8cd630e3e683944078c441632d9ee4e289 100644 (file)
--- a/pinq.sh
+++ b/pinq.sh
@@ -1 +1 @@
-QMAIL/bin/maildir2mbox && exec pine ${1+"$@"}
+/usr/bin/maildir2mbox && exec pine ${1+"$@"}
diff --git a/qail.sh b/qail.sh
index 7e31c335d1e144647a2e41935b4cbab6fcbc9523..81e3fdb18eaff26708c77cef779bcf1439df4cee 100644 (file)
--- a/qail.sh
+++ b/qail.sh
@@ -1 +1 @@
-QMAIL/bin/maildir2mbox && exec Mail ${1+"$@"}
+/usr/bin/maildir2mbox && exec Mail ${1+"$@"}
index 9e31a2a41c7ede2da8a8b1b862fb3e1760d18e6c..916c3c24ee12d55a027c5b501d48d5e16cbb51d5 100644 (file)
--- a/qlist2.sh
+++ b/qlist2.sh
@@ -1 +1 @@
-exec QMAIL/bin/qlist "$USERBREAK$1@$2" "$USERBREAK$1-request@$2" .qmail-"$1" .qmail-"$1"-request .qtemp-"$1" "$USERBREAK$1-owner" ${3+"$3"}
+exec /usr/bin/qlist "$USERBREAK$1@$2" "$USERBREAK$1-request@$2" .qmail-"$1" .qmail-"$1"-request .qtemp-"$1" "$USERBREAK$1-owner" ${3+"$3"}
index 5109cc350a90f423e77f0eb6e6cea5bf1753c2cb..f3b91ad3e390936f6f37861d087a7080323b0bb5 100644 (file)
@@ -139,7 +139,7 @@ char *local;
   }
 
  if (pipe(pi) == -1) _exit(QLX_SYS);
- args[0] = "bin/qmail-getpw";
+ args[0] = "/usr/sbin/qmail-getpw";
  args[1] = local;
  args[2] = 0;
  switch(gpwpid = vfork())
@@ -191,7 +191,7 @@ char *s; char *r; int at;
    x = nughde.s;
    xlen = nughde.len;
 
-   args[0] = "bin/qmail-local";
+   args[0] = "/usr/sbin/qmail-local";
    args[1] = "--";
    args[2] = x;
    n = byte_chr(x,xlen,0); if (n++ == xlen) _exit(QLX_USAGE); x += n; xlen -= n;
diff --git a/qmail.c b/qmail.c
index 748433151e0fd996a3bb7858b462ed0af638c649..70b17c3b931067b0cf7e3e12f57b739db562ed8c 100644 (file)
--- a/qmail.c
+++ b/qmail.c
@@ -7,7 +7,7 @@
 #include "qmail.h"
 #include "auto_qmail.h"
 
-static char *binqqargs[2] = { "bin/qmail-queue", 0 } ;
+static char *binqqargs[2] = { "/usr/sbin/qmail-queue", 0 } ;
 
 int qmail_open(qq)
 struct qmail *qq;
index f4205e1f81587241722ab26f4303034ffa41c23b..3b4fc8c2cb9268c47d3f287cc7f0772a57c2be01 100644 (file)
@@ -80,7 +80,7 @@ char **argv;
  if (!qiargv) nomem();
 
  arg = qiargv;
- *arg++ = "bin/qmail-inject";
+ *arg++ = "/usr/sbin/qmail-inject";
  *arg++ = (flagh ? "-H" : "-a");
  if (sender)
   {