postfix = postfix-2.8.3 include ../.makefile rundir = $(rundirbase)/postfix confdir = $(prefix)/etc/postfix confext = ".zinux" default: all .PHONY: unstuff config comp install confdir perms ssl all clean unstuff: tar --xz -xf $(postfix).tar.xz xzcat no_nis.diff.xz | (cd $(postfix) && patch -p1) config: -groupadd -g 30 postfix -useradd -d /dev/null -f 0 -e 2000-01-01 -s /bin/false -g postfix -c "Postfix Daemon" -u 30 -p '*' postfix id postfix -groupadd -g 31 postdrop -useradd -d /dev/null -f 0 -e 2000-01-01 -s /bin/false -g postdrop -c "Postfix Delivery" -u 31 -p '*' postdrop id postdrop make -C $(postfix) -f Makefile.init makefiles \ CCARGS='-DUSE_TLS -DUSE_SASL_AUTH \ -DUSE_CYRUS_SASL -I$(prefix)/include/sasl \ -DDEF_COMMAND_DIR=\"$(prefix)/sbin\" \ -DDEF_CONFIG_DIR=\"$(confdir)\" \ -DDEF_DATA_DIR=\"$(prefix)/var/lib/postfix\" \ -DDEF_MAILQ_PATH=\"$(prefix)/bin/mailq\" \ -DDEF_HTML_PATH=\"no\" \ -DDEF_MANPAGE_DIR=\"$(prefix)/man\" \ -DDEF_NEWALIAS_PATH=\"$(prefix)/bin/newaliases\" \ -DDEF_QUEUE_DIR=\"$(prefix)/var/spool/postfix\" \ -DDEF_README_DIR=\"no\" \ -DDEF_SENDMAIL_PATH=\"$(prefix)/sbin/sendmail\"' \ AUXLIBS='-lssl -lcrypto -lsasl2' comp: $(MAKE) -C $(postfix) -j $(CC_PARALLEL) install: # Initial the example configuration $(MAKE) confdir # If no config exists, install the default configuration if [ ! -e $(confdir)/main.cf ]; then $(MAKE) confext="" confdir; fi # Install with upgrade target to allow non-interactive use $(MAKE) -C $(postfix) upgrade # Fix permissions/etc. $(MAKE) perms # Install an SSL certificate, if needed if [ ! -e $(confdir)/ssl/mail.crt ]; then $(MAKE) ssl; fi confdir: # Install the run file install -d -m 0755 -o root -g wheel $(rundir) install -m 0754 -o root -g wheel files/run $(rundir)/run # Install the conf files install -d -m 0755 -o root -g wheel $(confdir) install -m 0644 -o root -g wheel files/master.cf $(confdir)/master.cf$(confext) install -m 0644 -o root -g wheel files/main.cf $(confdir)/main.cf$(confext) install -m 0644 -o root -g wheel files/virtual $(confdir)/vitual$(confext) install -m 0644 -o root -g wheel files/aliases $(confdir)/aliases$(confext) install -m 0644 -o root -g wheel files/dspam_filter_access $(confdir)/dspam_filter_access$(confext) perms: # Install default maps postmap $(confdir)/transport postmap $(confdir)/virtual postmap $(confdir)/dspam_filter_access # Correct a common ownership error install -d -m 0755 -o root -g wheel $(prefix)/var/spool/postfix # Add a folder for caches install -d -m 0750 -o postfix -g wheel $(prefix)/var/spool/postfix/cache ssl: # Create and install a new key install -d -m 0755 -o root -g wheel $(confdir)/ssl echo -e "\n\n\n\n\n$(host).$(domain)\n\n" | \ openssl req -new -x509 -nodes -out tmp.crt \ -keyout tmp.key -days 1825 install -m 0644 -o root -g wheel tmp.crt $(confdir)/ssl/mail.crt install -m 0600 -o root -g wheel tmp.key $(confdir)/ssl/mail.key if [ -e $(prefix)/etc/ssl/certs/cacert.pem ]; then \ ln -s $(prefix)/etc/ssl/certs/cacert.pem \ $(confdir)/ssl/cacert.pem; fi all: $(MAKE) unstuff $(MAKE) config $(MAKE) comp $(MAKE) install clean: rm -rf $(postfix) rm -f main.zinux virtual.zinux rm -f tmp.crt tmp.key