BjarneDM
Registered
This guide has the pre-requisite that you've installed MySQL as described here: http://www.macosx.com/forums/showthread.php?t=257966
Create and enter the folder we'll use to build from:
In the above folder save the following as 'postfix.bash':
Make the file executable: chmod o+x postfix.bash
and then either: ./postfix.bash 2.2.5 install -or- ./postfix.bash 2.2.5 upgrade
Under Tiger, Apple has done away with the Postfix StarupItem and is instead using launchd. I've never been able to get postfix and launchd to play togethere, so we'll have to 1) disable the launchd postfix service 2) create a StartupItem for Postfix.
1) disable the launchd postfix service:
2) creating a StartupItem for Postfix
Create the Postfix StartupItem folder:
Save the following as just 'Postfix' (remember to make it executable with 'chmod o+x Postfix'):
and the follwing as 'StartupParameters.plist'
Then append the following line to '/etc/hostconfig':
Create and enter the folder we'll use to build from:
Code:
mkdir -p ~/WebServer/Postfix
cd ~/WebServer/Postfix
Code:
#!/bin/bash
# usage : building.bash <version> [type]
# ${1} : version number
# ${2} : ( install | upgrade ) (default: install )
if [ ! -e postfix-${1}.tar.gz ]
then
curl -O ftp://ftp.jaquet.dk/mirror/ftp.porcupine.org/official/postfix-${1}.tar.gz
fi
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec
rm -rf postfix-${1}
tar -zxf postfix-${1}.tar.gz
cd postfix-${1}
# everything gets installed in /Library/Postfix
# all documentation is installed
make -f Makefile.init makefiles \
'CCARGS=-DHAS_MYSQL -I/Library/MySQL/include/mysql \
-DDEF_CONFIG_DIR=\"/Library/Postfix/conf\" \
-DDEF_COMMAND_DIR=\"/Library/Postfix/sbin\" \
-DDEF_DAEMON_DIR=\"/Library/Postfix/libexec\" \
-DDEF_QUEUE_DIR=\"/Library/Postfix/spool\" \
-DDEF_MAILQ_PATH=\"/Library/Postfix/bin/mailq\" \
-DDEF_NEWALIAS_PATH=\"/Library/Postfix/bin/newaliases\" \
-DDEF_SENDMAIL_PATH=\"/Library/Postfix/sbin/sendmail\" \
-DDEF_HTML_DIR=\"/Library/Postfix/documentation/html\" \
-DDEF_MANPAGE_DIR=\"/Library/Postfix/documentation/man\" \
-DDEF_README_DIR=\"/Library/Postfix/documentation/readme\" \
' \
'AUXLIBS=-L/Library/MySQL/lib/mysql -lmysqlclient -lz -lm'
make
sudo SystemStarter stop Postfix
case "${2:-install}" in
"install") #(interactive version, first time install)
echo "interactive version, first time install)"
echo "every setting should already have the correct default answer"
echo "!EXCEPT! for the scratch directory to which you have to answer : "
echo "/tmp/postfix"
sleep 10
sudo make install
;;
"upgrade") #(non-interactive version, for upgrades)
sudo make upgrade
;;
*)
echo '::::::::: parameter fejl :::::::::'
echo 'forkert installeringsmetode angivet'
echo 'tilladte er: "install" el. "upgrade"'
exit
;;
esac
export PATH=/Library/Postfix/sbin:$PATH
sudo postfix set-permissions
sudo SystemStarter start Postfix
tail /var/log/mail.log
and then either: ./postfix.bash 2.2.5 install -or- ./postfix.bash 2.2.5 upgrade
Under Tiger, Apple has done away with the Postfix StarupItem and is instead using launchd. I've never been able to get postfix and launchd to play togethere, so we'll have to 1) disable the launchd postfix service 2) create a StartupItem for Postfix.
1) disable the launchd postfix service:
Code:
sudo launchctl stop org.postfix.master
sudo launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist
2) creating a StartupItem for Postfix
Create the Postfix StartupItem folder:
Code:
sudo mkdir -p /Library/StartupItems/Postfix
Code:
#!/bin/bash
. /etc/rc.common
export MAIL_CONFIG=/Library/Postfix/conf
export PATH=/Library/Postfix/sbin:$PATH
StartService ()
{
if [ "${POSTFIX:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting mail services"
/Library/Postfix/sbin/postfix -c /Library/Postfix/conf start
elif [ "${MAILSERVER:=-NO-}" = "-AUTOMATIC-" ]; then
/Library/Postfix/sbin/postfix-watch
fi
}
StopService ()
{
ConsoleMessage "Stopping Postfix mail services"
/Library/Postfix/sbin/postfix -c /Library/Postfix/conf stop
killall -1 postfix-watch 2> /dev/null
}
RestartService ()
{
if [ "${POSTFIX:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Reloading Postfix configuration"
/Library/Postfix/sbin/postfix -c /Library/Postfix/conf reload
else
StopService
fi
}
RunService "$1"
Code:
{
Description = "Postfix mail server";
Provides = ("Postfix");
Requires = ("Resolver");
Uses = ("Network Time", "NFS");
Preference = "None";
Messages =
{
start = "Starting Postfix";
stop = "Stopping Postfix";
restart = "Reloading Postfix Configuration";
};
}
Code:
POSTFIX=-YES-