#!/bin/bash # # Blueprint to build postfix-2.1.1. # # The postfix package provides the 'sendmail' command among others. # # Source is from ftp://ftp.porcupine.org/mirrors/postfix-release/official/ # # This blueprint has some prerequisites: # # 1. The sleepycat Berkeley db package must be installed. There is # an architect blueprint provided for the db package. # 2. A user account named 'postfix' must exist on the system on which # this blueprint is run. See /extra/config-files/etc/passwd. # 3. A group named 'postdrop' should exist on the build system with no # users as members. See /extra/config-files/etc/group. # 4. The files /etc/aliases /etc/aliases.db must exist on the system # where the postfix binary package is to be installed. Without these # files postfix will start, but will not run correctly making trouble- # shooting difficult. See /extra/config-files/etc/ for the # aliases and aliases.db files. # # # This architect blueprint is copyright (c)2003-2004 David Horton # dhorton@nospam.speakeasy.net # # 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; either version 2 of the License, or # (at your option) any later version. # # This program 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, write to: # # Free Software Foundation, Inc. # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # # # Define the package name, source directory, build directory and # staging directory paths. Prefixes to directories may be overridden # by setting shell variables SRC, BUILD and STAGING. For example, # doing "export SRC=/root/foo" before calling this script will override # the default /usr/src and set SRC_DIR to /root/foo/$PKG_NAME instead. # PKG_NAME=$(basename $0) SRC_DIR=${SRC:-/usr/src}/$PKG_NAME BUILD_DIR=${BUILD:-/var/tmp/build}/$PKG_NAME STAGING_DIR=${STAGING:-/var/tmp/staging}/$PKG_NAME # # Check that the source directory really exits and bail out if not. if ! [ -d $SRC_DIR ]; then echo "$PKG_NAME: Cannot find source code directory $SRC_DIR." exit 1 fi # # Do not overwrite existing build directory. if [ -d $BUILD_DIR ]; then echo "$PKG_NAME: Build directory $BUILD_DIR already exists." exit 2 else mkdir -p $BUILD_DIR fi # # Do not overwrite existing staging directory. if [ -d $STAGING_DIR ]; then echo "$PKG_NAME: Staging directory $STAGING_DIR already exists." exit 4 else mkdir -p $STAGING_DIR fi # # This is not one of the packages that can be configured and built # completely outside of the source tree. So in order to leave the # original source untouched, the contents of $SRC_DIR are first copied # to $BUILD_DIR. The copy in $BUILD_DIR is then modified to suit the # configuration. cp -dpR $SRC_DIR/* $BUILD_DIR # # # Configuration is done by passing variables to make in order to over- # ride the values defined in the Makefile. The CCARGS variable is used # to configure the the package to produce i386 compatible code. All # other parameters are configured in /etc/postfix/main.cf and are # specified later as the package is installed into the staging area. cd $BUILD_DIR make CCARGS="-mcpu=i386" # # Check return code and bail if it looks bad. if [ $? -gt 0 ]; then echo "$PKG_NAME: Build failed!" exit 16 fi # # Installing into the staging area is done a little differently with # postfix when compared to the other architect package blueprints. Rather # than 'make install', postfix uses a shell script called postfix-install # to handle the installation tasks. postfix-install has a number of # parameter that can be specified to fine-tune the installation. sh ./postfix-install -non-interactive \ command_directory=/usr/sbin \ daemon_directory=/usr/lib/postfix \ html_directory=/usr/share/doc/postfix/html \ install_root=$STAGING_DIR \ mail_owner=postfix \ manpage_directory=/usr/share/man \ newaliases_path=/usr/sbin/newaliases \ queue_directory=/var/spool/postfix \ readme_directory=/usr/share/doc/postfix/text \ sendmail_path=/usr/sbin/sendmail \ setguid_group=postdrop # # Check return code and bail if it looks bad. if [ $? -gt 0 ]; then echo "$PKG_NAME: Installation to staging area failed!" exit 32 fi # # Post-install tweaking. # Clean up the /etc/postfix directory so that installing this package # will not overwrite any locally modified files. # SAMPLE_CONFIGS="access aliases canonical header_checks main.cf master.cf relocated transport virtual" for FILE in $SAMPLE_CONFIGS; do mv $STAGING_DIR/etc/postfix/$FILE $STAGING_DIR/etc/postfix/SAMPLE.$FILE done # # Leave the shell scripts alone since they are not really customizable. # # end of postfix blueprint