#!/bin/sh
# Set initial variables:
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-sendmail-cf
VERSION=8.14.2
ARCH=noarch
BUILD=1

rm -rf $PKG
mkdir -p $PKG
echo "+====================+"
echo "| sendmail.cf.$VERSION |"
echo "+====================+"
( cd $TMP/sendmail-$VERSION ; find . -name "*~" -print -exec rm {} \; )
( cd $PKG
mkdir -p usr/share/sendmail/cf
cd usr/share/sendmail/cf
cp -a $TMP/sendmail-$VERSION/cf/README .
cp -a $TMP/package-sendmail/usr/share/sendmail/README.linux .
for dir in cf domain feature hack m4 mailer ostype sh siteconfig ; do
  cp -a $TMP/sendmail-$VERSION/cf/$dir .
done
# Replace the sendmail Build script with a simple (working) one:
cp -a $PKG/usr/share/sendmail/cf/cf/Build $PKG/usr/share/sendmail/cf/cf/Build.orig
zcat $CWD/Build.gz > $PKG/usr/share/sendmail/cf/cf/Build
chown -R root.root *

mkdir -p $PKG/install
cat $CWD/slack-desc.sendmail-cf > $PKG/install/slack-desc

# Build the package:
cd $PKG
makepkg -l y -c n $TMP/sendmail-cf-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/sendmail-cf.build.log
