freebsd-ports/mail/postgrey/files/pkg-install.in
Chris Rees fd4a2cbe49 - Fix package installation; pre-install part of script depends on postgrey
username existing.

PR:		ports/166943
Submitted by:	Darren Pilgrim <ports.maintainer@evilphi.com> (maintainer)

- While here, use packages for perl dependencies to avoid requiring bsd.perl.mk

Approved by:	Darren Pilgrim <ports.maintainer@evilphi.com> (maintainer)
2012-04-18 07:54:30 +00:00

47 lines
1.3 KiB
Bash

#! /bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/mail/postgrey/files/pkg-install.in,v 1.6 2012-04-18 07:54:30 crees Exp $
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
PRE-INSTALL)
echo "---> Starting install script:"
if [ -z "%%POSTGREYDIR%%" -o \
-z "%%USER%%" -o -z "%%GROUP%%" -o \
-z "%%UID%%" -o -z "%%GID%%" ]; then
echo "ERROR: A required pragma was empty"
exit 1
fi
;;
POST-INSTALL)
echo "---> Starting post-install script:"
# Create home directory if required
if [ -d "%%POSTGREYDIR%%" ]; then
echo "---> Using existing Postgrey database directory (%%POSTGREYDIR%%)"
echo " (There may be existing active postgrey databases - this installation"
echo " will attempt to preserve them.)"
else
echo "---> Creating Postgrey database directory (%%POSTGREYDIR%%)"
(umask 002 && /bin/mkdir -p "%%POSTGREYDIR%%") || exit 1
/usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%POSTGREYDIR%%" || exit 1
/bin/chmod g+s "%%POSTGREYDIR%%" || exit 1
fi
for i in %%ETCFILES%%; do
if [ ! -f "%%PREFIX%%/etc/postfix/postgrey_${i}" ]; then
echo "---> Installing new config file %%PREFIX%%/etc/postfix/postgrey_${i}"
cp -p %%PREFIX%%/etc/postfix/dist-postgrey_${i} \
%%PREFIX%%/etc/postfix/postgrey_${i}
else
echo "---> Keeping existing config file %%PREFIX%%/etc/postfix/postgrey_${i}"
fi
done
;;
esac