Hi! Please find attached xmail-ebuild.tar.gz containing xmail-1.12.ebuild and a patch to reconfigure the init.d script for Gentoo. XMail is a small, fast, and highly configurable SMTP/POP3/Finger server for Win32 and Linux. Tests have shown it to be about 50% faster than qmail. I suggest net-mail/xmail. Kevin Reproducible: Always Steps to Reproduce: 1. 2. 3.
Created attachment 8431 [details] xmail 1.12 ebuild script and patch
Created attachment 8484 [details] Updated ebuild script for secure config files I forgot to secure the config files in the original script.
I also strongly suggest adding "/var/MailRoot -/var/MailRoot/bin -/var/MailRoot/docs" to the CONFIG_PROTECT variable in /etc/make.globals.
Created attachment 9261 [details, diff] new diff to patch xmail start/stop script without killing it XMail server has a way to stop it by placing .shutdown file in its $MAIL_ROOT folder. Killing it by signal may cause problems and misbehavior.
Created attachment 9265 [details, diff] corrected patch results of testing and debugging runscript and XMail interaction
I don't know for sure what signal "start-stop-daemon --stop --quiet --exec $DAEMON --name $NAME --pidfile=/var/run/$NAME.pid" sends out, I just plugged in the executable, name, and pid file. According to http://www.xmailserver.org/Readme.html#server%20shutdown it is perfectly acceptable to use "kill -INT `cat /var/run/XMail.pid`" to shutdown XMail on Linux. Either will probably work. I was just trying to do things "the Gentoo way" as best I can. I'm glad someone has looked at this - I posted it weeks ago!
Created attachment 9267 [details, diff] Change to command line options Please don't create an "issue" concerning what options to run under. The author, Davide Libenzi, distributes with no options and leaves that to the end user. This should obsolete attachment (id=9265) but I guess I don't have permissions to do that.
Created attachment 9366 [details] new ebuild which incorporates Debian's xmail folder stucture This ebuild moves configuration files to /etc, and creates symlink to /var/spool, /var/cache and /var/log xmail subdirectories. Also it contains configure script to run manually after emerge, which fill ctrlaccount.tab from user input and also create first mail domain and it's mail users. Relaying closed by default, clients should use smtpauth.
Created attachment 9367 [details, diff] start/stop xmail script Kevin, thank you, you are right. Sending XMail server signal INT is the correct way to stop it. If you do not provide --signal parameter to start-stop-daemon, it may cause misbehavior. This new patch also incorporates changes to directory structure I've take from Debian's XMail build. Sergey
Comment on attachment 9367 [details, diff] start/stop xmail script >--- xmail-1.12/xmail 2003-01-17 20:01:36.000000000 -0500 >+++ xmail 2003-03-12 16:34:54.000000000 -0500 >@@ -1,93 +1,47 @@ >-#!/bin/sh >-# >-# skeleton example file to build /etc/init.d/ scripts. >-# This file should be used to construct scripts for /etc/init.d. >-# >-# Written by Miquel van Smoorenburg <miquels@cistron.nl>. >-# Modified by Davide Libenzi <davidel@xmailserver.org> >-# >-# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl >-# >- >-XMAIL_ROOT=/var/MailRoot >-XMAIL_CMD_LINE="" >-PATH=$XMAIL_ROOT/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin >-DAEMON=$XMAIL_ROOT/bin/XMail >+#!/sbin/runscript >+# Copyright 1999-2002 Gentoo Technologies, Inc. >+# Distributed under the terms of the GNU General Public License, v2 or later >+# $Header $ >+ >+XMAIL_ROOT=/etc/xmail >+XMAIL_CMD_LINE=" -Ms $XMAIL_ROOT -Sl -Pl -Ql -Fl -Cl" >+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin >+DAEMON=/usr/bin/XMail > NAME=XMail > DESC="XMail server" > >-test -f $DAEMON || exit 0 >- >-set -e >-ulimit -c 20000 >- >-start_xmail() >-{ >- MAIL_ROOT=$XMAIL_ROOT >- export MAIL_ROOT >- MAIL_CMD_LINE=$XMAIL_CMD_LINE >- export MAIL_CMD_LINE >- $DAEMON >- while [ ! -f /var/run/$NAME.pid ] >- do >- sleep 1 >- done >+depend() { >+ need net >+ use dns > } > >-stop_xmail() >-{ >- if [ -f /var/run/$NAME.pid ] >- then >- echo `date` > $XMAIL_ROOT/.shutdown >- while [ -f $XMAIL_ROOT/.shutdown ] >- do >- sleep 1 >- done >+checkconfig() { >+ if [ ! -f $DAEMON ] ; then >+ eerror "XMail binary not found!" > fi >-} > >+ set -e >+ ulimit -c 20000 >+ >+} > >-case "$1" in >- start) >- echo -n "Starting $DESC: " >- start_xmail >- echo "$NAME.[" `cat /var/run/$NAME.pid` "]" >- ;; >- stop) >- echo -n "Stopping $DESC: " >- stop_xmail >- echo "$NAME." >- ;; >- #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. >- # >- # echo "Reloading $DESC configuration files." >- # start-stop-daemon --stop --signal 1 --quiet --pidfile \ >- # /var/run/$NAME.pid --exec $DAEMON >- #;; >- restart|force-reload) >- # >- # If the "reload" option is implemented, move the "force-reload" >- # option to the "reload" entry above. If not, "force-reload" is >- # just the same as "restart". >- # >- echo -n "Restarting $DESC: " >- stop_xmail >- sleep 1 >- start_xmail >- echo "$NAME.[" `cat /var/run/$NAME.pid` "]" >- ;; >- *) >- N=/etc/init.d/$NAME >- # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 >- echo "Usage: $N {start|stop|restart|force-reload}" >&2 >- exit 1 >- ;; >-esac >+start() { >+ checkconfig || return 1 >+ ebegin "Starting $NAME" >+ start-stop-daemon --start --startas $DAEMON \ >+ --quiet --pidfile=/var/run/$NAME.pid -- $XMAIL_CMD_LINE >+ while [ ! -f /var/run/$NAME.pid ] >+ do >+ sleep 1 >+ done >+ eend $? "Failed to start XMail" >+} > >-exit 0 >+stop() { >+ ebegin "Stopping xmail" >+ if [ -f /var/run/$NAME.pid ] ; then >+ start-stop-daemon --stop --quiet --pidfile=/var/run/$NAME.pid --name=$NAME --retry 120 \ >+ --oknodo --signal 2 --quiet >+ fi >+ eend $? "Failed to stop XMail" >+}
Hi, I've arranged page http://www.spectr.org/sergey/ for xmail-1.12.ebuild and accomplishing it files with short description how to use it. So all my submitted attachments here should be considered as out of use. Sergey Ivanov <seriv@parkheights.dyndns.org>
Created attachment 9660 [details] latest ebuild script with path structure from sergey
Created attachment 9661 [details] ENV.D file for MAIL_ROOT variable
Created attachment 9662 [details] CONF.D file for XMail configuration
Created attachment 9663 [details] INIT.D script greatly simplified, uses CONF.D file variables
Created attachment 9664 [details] automated configuration script - separated from ebuild
Created attachment 9697 [details] ChangeLog
Created attachment 10375 [details, diff] patch for xmail-1.14 This patch make xmail ebuild and xmail.diff independent of XMail version number. The only thing to do with new version of XMail (tested on 1.14) is to rename ebuild s/12/14/ and make new digest. Sergey
Created attachment 11652 [details] latest version (1.15) fixes permissions problems, sendmail problems
I've modified Kevin's ebuild and it's files to run XMail in chrooted environment from unprivileged user. Should I place ebuild and start/stop and conf. files here or it is sufficient to place it at http://www.spectr.org/sergey/XMail_for_Gentoo.html ? Sergey
I have added the ebuild to portage with some minor changes. Please check it out and let me know if you find any problems with my submission. I removed the interactive portion and changed the useradd/groupadd functions.
Nick, That should be fine. The wizard just speeds up the initial setup process for those who have at least read the readme file. I read http://freshmeat.net/projects/xmail/?topic_id=32%2C33%2C34%2C30%2C88 a long time ago concerning XMail performance, and that's what convinced me to try it. I haven't tested the claims, but they aren't from XMail's author, so I don't suspect too much exaggeration. Kevin
My test results: ebuild succeeds at second attempt. The first attempt fails, xmail user and group unavailable at install stage of ebuild. But they created and are available for second emerge. The original ebuild with groupadd and useradd in install also does not work, I think the portage has changed and I failed to manage to chown installed files to new user by ebuild. Sergey.
I have moved the useradd/groupadd routines to pkg_setup... which should fix the aforementioned problem
I have four corrections. First: remove CR/LF line ending in files/xmail* Second: move line : --- cp -R -u /etc/xmail/* ${CHROOT}${MAIL_ROOT} --- before line: --- chown -R xmail.xmail ${CHROOT} --- in files/xmail.initd, else xmail will not start the first time, it's control tab files remains root's owned. And third, :%s/6017/29617/g in files/xmailwizard. XMail starts after two first corrections, but xmailwizard wait for him in a wrong port. And the last - XMail server needs also /tmp in it's chrooted jail. This may be added as dodir /chroot/xmail/tmp in ebuild or into files/xmail.initd into line: --- for subdir in dev lib var/run var/MailRoot tmp --- Sincerely, Sergey
I hope someone (not me) is going to patch the documentation to reflect all the deviation from the readme file. Sergey's build is advanced from my point of view - I don't know any Linux users who actually run anything in a chroot environment. The novice won't be able to follow the readme file with the way things are now. My build reflects the readme file and everything runs without modification, including sendmail. I've even got Courier-IMAP running against the user's mailboxes without hassle. I may be a novice in the Linux world, but I feel the ebuild should not take such a simple build and make it so complicated. I'm happy that XMail in finally in portage, but I'll stick with my ebuild because it works for me.
I think it's worth while accept Kewin's suggestion and roll back to his ebuild version or accept my last corrections. Both produce ebuild creating working XMail. While existing gentoo's XMail can not produce working XMail. Sergey
xmail-1.16 has been marked stable for x86