PDA

View Full Version : Adding postfix package from extras



rtm
04-29-09, 03:13 PM
I thought I would document a process I followed to get the mail server "postfix" working for the Warp.

I needed it to be able to send email without access to a relaying mail server. The busybox sendmail command, ssmtp, and nullmailer all require you to specify a mail server to relay through. Setting up postfix allows the asterisk voicemail to email messages to any valid email address.


You will need to install both the postfix package and the pcre package that postfix uses. (I disabled pcre in the postfix build, so I didn't compile pcre)

To get the package from the the Pika extras source tree you follow these commands: http://pikawarp.org/?page_id=20

If make gives you errors, you will have to modify the make commands for postfix:


if the errors look like "undefined reference to `pthread_...` , you need to add "-lpthread" to the pads/build_warp/postfix-version/makedefs file.

seached for the LINUX2 section, then for SYSLIBS="-ldb"
and changed it to SYSLIBS="-ldb -lpthread"
in the postfix-ver/ run "make tidy" then try the whole PADS make again.

if you have an error with the "chown postfix:postfix ..." command, I just added a local user to the system to make it go away: "adduser -n postfix"
(I know that's not the best solution, but cross compiling can be messy)
If you don't want to install PCRE you can also disable it in the makedefs, search for HAS_PCRE or NO_PCRE and disable it there.


Cheers.

rtm
04-30-09, 12:03 PM
After installing it and starting it from the /service/postfix style of startup I've realized that the /service/postfix/run script is wrong.

It works, and restarts postfix if it goes away, but the script is run once a second, checking if postfix is still up and restarting it if it isn't. The thing is, supervise is the process that is already designed to do that. When you run svstat /service/postfix to see how long it has been running, it never shows more than one second because supervise is always running the script that checks if postfix is up.

Long story short, postfix needs a new /service/postfix/run script, I'll post it back here if I get one working.

Edit:
After looking at this page: http://www.dt.e-technik.uni-dortmund.de/~ma/postfix/daemontools.html (http://www.dt.e-technik.uni-dortmund.de/%7Ema/postfix/daemontools.html)
I have taken the existing script and fixed it:


#!/bin/sh

# Link to config directory if not already done so
[ -d /etc/postfix ] || ln -s /persistent/etc/postfix /etc/postfix

POSTFIX_GROUP=`fgrep postfix /etc/group`
POSTDROP_GROUP=`fgrep postdrop /etc/group`
POSTFIX_USER=`fgrep postfix /etc/passwd`
POSTFIX_RUNNING=FALSE

#/usr/libexec/postfix/master -t 2>/dev/null || POSTFIX_RUNNING=TRUE
# RTM20090501
/usr/libexec/postfix/master -t 2>/dev/null || /usr/sbin/postfix stop

# Make sure we have our postfix group
if [ "${POSTFIX_GROUP}" = "" ]; then
echo "postfix:*:189:" >> /etc/group
fi

# Make sure we have our postfix group
if [ "${POSTDROP_GROUP}" = "" ]; then
echo "postdrop:*:190:" >> /etc/group
fi

# Make sure we have our postfix user
if [ "${POSTFIX_USER}" = "" ]; then
echo "postfix:*:191:100::/var/spool/postfix:" >> /etc/passwd
fi

# The autorun and the service and mutually exclusive
# so we make sure it is not already started
#if [ "${POSTFIX_RUNNING}" = "FALSE" ]; then
# echo "Starting POSTFIX"; \
# /usr/sbin/postfix start; \
# echo "POSTFIX is started"; \
#fi

# RTM20090501
exec /usr/libexec/postfix/master
exit $?