diff --git a/Makefile.PL b/Makefile.PL index c402b45..bd081a8 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -23,7 +23,6 @@ my %opts = ( 'MIME::Body'=> 5.0, 'Mail::Address'=> 1.0, 'Bit::Vector' => 6.4, - 'Digest::SHA1' => 2.11, 'Sys::Syslog' => 0.13 } ); diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..d386319 --- /dev/null +++ b/debian/README @@ -0,0 +1,7 @@ +The Debian Package manitou-mdx +---------------------------- + +This package contains manitou-mdx, the Mail Database eXchanger daemon +for Manitou-Mail. + + -- Daniel Verite Sun, 23 Sep 2012 14:01:29 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..35c240f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +manitou-mdx (1.3.1) unstable; urgency=low + + * New upstream release + + -- Daniel Verite Thu, 18 Oct 2012 14:09:12 +0200 + +manitou-mdx (1.3.0) unstable; urgency=low + + * Initial Release. + + -- Daniel Verite Sun, 23 Sep 2012 14:01:29 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/config b/debian/config new file mode 100644 index 0000000..09ecb41 --- /dev/null +++ b/debian/config @@ -0,0 +1,8 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +db_input high manitou-mdx/install-db || true +db_go || true + + diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..15fd79d --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: manitou-mdx +Section: mail +Priority: optional +Maintainer: Daniel Verite +HomePage: http://www.manitou-mail.org +Build-Depends: libdbd-pg-perl (>= 1.32), libmailtools-perl (>= 1.62), libmime-perl (>= 5.427), libbit-vector-perl (>= 6.4), libhtml-tree-perl (>=3.23), perl (>=5.10) + +Package: manitou-mdx +Architecture: all +Priority: optional +HomePage: http://www.manitou-mail.org +Depends: libdbd-pg-perl (>= 1.32), libmailtools-perl (>= 1.62), libmime-perl (>= 5.427), libbit-vector-perl (>= 6.4), libhtml-tree-perl (>=3.23), perl (>=5.10), adduser +Description: mail-database exchanger script for the manitou-mail software + Manitou is a database-driven mail user-agent and associated + utilities. It provides a framework and tools for storing and + exposing mail as organized data, accessible by SQL. It is aimed at + handling seamlessly large mailboxes, possibly processed by multiple + concurrent users. In addition to the features commonly found in + traditional mail programs, its user interface comes with some more + unique, database oriented ways to organize, retrieve and process mail + messages. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..9999b9d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,37 @@ +This work was packaged for Debian by: + + Daniel Verite on Sun, 23 Sep 2012 14:01:29 +0200 + +It was downloaded from: + + + +Upstream Author(s): + + + +Copyright: + + + +License: + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, version 2. + + This package 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 + along with this program. If not, see . + +On Debian systems, the complete text of the GNU General +Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. + +The Debian packaging is: + + Copyright (C) 2012 Daniel Verite + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/manitou-mdx.default b/debian/manitou-mdx.default new file mode 100644 index 0000000..7e4cc31 --- /dev/null +++ b/debian/manitou-mdx.default @@ -0,0 +1,2 @@ +# enable/disable manitou-mdx start at boot +ENABLED=1 diff --git a/debian/manitou-mdx.init b/debian/manitou-mdx.init new file mode 100644 index 0000000..2760996 --- /dev/null +++ b/debian/manitou-mdx.init @@ -0,0 +1,95 @@ +#! /bin/sh +# +# manitou-mdx start/stop manitou-mdx daemon +# +### BEGIN INIT INFO +# Provides: manitou-mdx +# Required-Start: $syslog, $local_fs, $remote_fs +# Required-Stop: $syslog, $local_fs, $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/stop the manitou-mdx daemon +### END INIT INFO + +set -e + +PATH=/bin:/usr/bin:/usr/sbin:/sbin +DAEMON=/usr/bin/manitou-mdx +NAME=manitou-mdx +DESC="manitou-mdx daemon" +DUID=manitou +PIDFILE=/var/run/manitou/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +MANITOU_MDX_OPTS="--fork --pidfile=$PIDFILE $MANITOU_MDX_OPTS" +ENABLED=1 + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +# Read config file if it is present. +if [ -r /etc/default/$NAME ] +then + . /etc/default/$NAME +fi + +if [ "$ENABLED" = "0" ]; then + echo "$DESC: disabled, see /etc/default/$NAME" + exit 0 +fi + +ret=0 +case "$1" in + start) + log_daemon_msg "Starting $DESC" "$NAME" + if start-stop-daemon --start --oknodo --quiet \ + --pidfile $PIDFILE --chuid $DUID --name $NAME \ + --startas $DAEMON -- $MANITOU_MDX_OPTS + then + log_end_msg 0 + else + ret=$? + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + if start-stop-daemon --stop --oknodo --quiet \ + --pidfile $PIDFILE --name $NAME + then + log_end_msg 0 + else + ret=$? + log_end_msg 1 + fi + rm -f $PIDFILE + ;; + reload|force-reload) + log_action_begin_msg "Reloading $DESC configuration..." + if start-stop-daemon --stop --signal 1 --quiet \ + --pidfile $PIDFILE --name $NAME + then + log_action_end_msg 0 + else + ret=$? + log_action_end_msg 1 + fi + ;; + restart) + $0 stop + $0 start + ret=$? + ;; + status) + status_of_proc -p $PIDFILE $DAEMON "$NAME" 2>/dev/null + ret=$? + ;; + + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit $ret diff --git a/debian/manpages/manitou-spool.1 b/debian/manpages/manitou-spool.1 new file mode 100644 index 0000000..fefd787 --- /dev/null +++ b/debian/manpages/manitou-spool.1 @@ -0,0 +1,59 @@ +'\" t +.\" Title: manitou-spool +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.75.2 +.\" Date: 09/27/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MANITOU\-SPOOL" "1" "09/27/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +manitou-spool \- drop a mail file into the spool for manitou\-mdx to import +.SH "SYNOPSIS" +.sp +\fBmanitou\-spool\fR \fIDIRECTORY\fR +.SH "DESCRIPTION" +.sp +manitou\-spool(1) is meant to be called as the right side of a pipe through an entry in \fI/etc/aliases\fR, or a \fIprocmailrc\fR file, or as a mail delivery agent for \fIfetchmail\fR, or any similar tool that passes a mail message to the standard input of a program for final delivery\&. +.sp +It copies the standard input into the spool directory in a new file uniquely named mail\-YYYMMDD\-HHMISS\-pid, where \fIYYYMMDD\-HHMISS\fR is the current date and time and \fIpid\fR is the current process ID\&. +.SH "EXIT STATUS" +.PP +\fB0\fR +.RS 4 +Success +.RE +.PP +\fB1\fR +.RS 4 +Failure +.RE +.SH "AUTHOR" +.sp +Daniel Verite +.SH "RESOURCES" +.sp +Main web site: http://www\&.manitou\-mail\&.org/ +.SH "COPYING" +.sp +Copyright (C) 2012 Daniel Verite\&. Licence: GNU General Public License (GPL) version 2\&. diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..36016bc --- /dev/null +++ b/debian/postinst @@ -0,0 +1,52 @@ +#!/bin/sh -e +. /usr/share/debconf/confmodule + +case "$1" in + configure) + if ! getent group manitou > /dev/null 2>&1 ; then + addgroup --system --quiet manitou + fi + if ! getent passwd manitou > /dev/null 2>&1 ; then + adduser --quiet --system --ingroup manitou \ + --home /var/lib/manitou/ manitou + fi + chown manitou:manitou /etc/manitou-mdx.conf + chmod 640 /etc/manitou-mdx.conf + if [ ! -d /var/run/manitou ]; then + mkdir -m 750 /var/run/manitou + chown manitou:manitou /var/run/manitou + fi + db_get manitou-mdx/install-db + if [ "$RET" = "true" ]; then + if [ -z "$2" ]; then + su postgres -c 'manitou-mgr --create-database' || ret=$? + # if the db already exists, try to upgrade the schema + if [ $ret -eq 2 ]; then + su manitou -c 'manitou-mgr --upgrade-schema' + elif [ $ret -ne 0 ]; then + # if the db creation failed, don't autostart + sed -i -e 's/^ENABLED=1/ENABLED=0/' /etc/default/manitou-mdx + fi + else + su manitou -c 'manitou-mgr --upgrade-schema' + fi + else + sed -i -e 's/^ENABLED=1/ENABLED=0/' /etc/default/manitou-mdx + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +db_stop + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..917d9bf --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000..3eb3e01 --- /dev/null +++ b/debian/templates @@ -0,0 +1,7 @@ +Template: manitou-mdx/install-db +Type: boolean +Description: Install the database? + The database can be created automatically now, or later by running manitou-mgr manually. The automatic creation assumes that PostgreSQL runs on this host and that passwordless local connections are allowed with the peer method (which is the case with a default pg_hba.conf file). + If this step fails, manitou-mdx will still be installed but the database will have to be created manually later and the db_connect_string section updated accordingly in /etc/manitou-mdx.conf +Default: true + diff --git a/lib/Manitou/Schema.pm b/lib/Manitou/Schema.pm index 8df3b71..22f5061 100644 --- a/lib/Manitou/Schema.pm +++ b/lib/Manitou/Schema.pm @@ -29,11 +29,11 @@ require Exporter; create_table_statements create_trigger_statements); sub current_version { - return "1.3.0"; + return "1.3.1"; } sub supported_versions { - return ("0.9.12", "1.0.0", "1.0.1", "1.0.2", "1.1.0", "1.2.0", "1.3.0"); + return ("0.9.12", "1.0.0", "1.0.1", "1.0.2", "1.1.0", "1.2.0", "1.3.0", "1.3.1"); } my $create_script=<execute(); if ($s2->fetchrow_array) { print STDERR "The database $dbname already exists.\nPlease check and drop the database before attempting to recreate, or choose another database name.\n"; - exit 1; + exit 2; } $s2->finish; $dbh1->do("CREATE DATABASE $dbname OWNER $dbuser") or die;