You are not logged in.
Pages: 1
I'm starting on the PKGBUILD for postgrey - already put the remaining dependency in AUR (perl-io-multiplex). Currently, I've got everything put together and have a working PKGBUILD, but I'm looking for some feedback and some advice on how best to write the rc.d script. I plan on looking at most of the other stuff out there, but I figured I'd put this out there as an announcement and see if anyone has any advice.
I'm well aware that the rc script DOES NOT WORK. I haven't even started working on it - right now its just hacked together pieces (gentoo and some other arch start scripts) and is NOT CLOSE TO DONE. However, I'm leaving for the night, so I figured I'd put everything I've done up here so if someone else decides they want to work on it, they can.
Also, since this would be my first post/interaction with the community - hi!
# Contributor: Sean Timothy Noonan <laymil>
pkgname=postgrey
pkgver=1.27
pkgrel=1
pkgdesc="a Postfix policy server implementing greylisting"
url="http://isg.ee.ethz.ch/tools/postgrey/"
options=('NOLIBTOOL')
license="GPL"
depends=('perl-net-server' 'perl>=5.6.0' 'perl-berkeleydb' 'perl-io-multiplex' 'db>=4.1' 'postfix')
makedepends=('')
source=(http://isg.ee.ethz.ch/tools/postgrey/pub/$pkgname-$pkgver.tar.gz)
md5sums=('df3a8b4a0c6ab7e8e5bb5be0de096c47')
build() {
echo $startdir
cd $startdir/pkg
mkdir -p etc/rc.d
mkdir -p etc/conf.d
mkdir -p etc/postfix
mkdir -p usr/sbin
cd $startdir/src/$pkgname-$pkgver
chown -R root:root .
install -m 0755 $startdir/postgrey.rc $startdir/pkg/etc/rc.d/postgrey
install -m 0644 $startdir/postgrey.rc.conf $startdir/pkg/etc/conf.d/postgrey
install -m 0755 postgrey contrib/postgreyreport $startdir/pkg/usr/sbin/
install -m 0644 postgrey_whitelist_recipients postgrey_whitelist_clients $startdir/pkg/etc/postfix/
}
# Config file for /etc/rc.d/postgrey
# LISTEN TYPE
# Set to 'inet' if you want to use a TCP socket.
# Set to 'unix' if you want to use an UNIX socket.
POSTGREY_TYPE="inet"
# HOST
# What IP should postgrey bind to?
# Leave unchanged unless you know what you are doing.
# (ignored if POSTGREY_TYPE is set to 'unix')
POSTGREY_HOST="127.0.0.1"
# PORT
# What TCP port should postgrey listen on?
# (ignored if POSTGREY_TYPE is set to 'unix')
POSTGREY_PORT="10030"
# SOCKET
# Unix socket to listen on, if POSTGREY_TYPE is set to 'unix'.
# Leave unchanged unless you know what you are doing.
# (ignored if POSTGREY_TYPE is set to 'inet')
POSTGREY_SOCKET="/var/spool/postfix/private/postgrey"
# Additional Postgrey options
#
# -v, --verbose increase verbosity level
# --delay=N greylist for N seconds (default: 300)
# --max-age=N delete entries older than N days since the last time
# that they have been seen (default: 30)
# --retry-window=N allow only N days for the first retrial (default: 2)
# append 'h' if you want to specify it in hours
# --greylist-action=A if greylisted, return A to Postfix (default: DEFER_IF_PERMIT)
# --greylist-text=TXT response when a mail is greylisted
# (default: Greylisted for %s seconds)
# --lookup-by-subnet strip the last 8 bits from IP addresses (default)
# --lookup-by-host do not strip the last 8 bits from IP addresses
# --whitelist-clients=FILE default: /etc/postfix/postgrey_whitelist_clients
# --whitelist-recipients=FILE default: /etc/postfix/postgrey_whitelist_recipients
#
# Note that the --whitelist-x options can be specified multiple times, and that
# per default /etc/postfix/postgrey_whitelist_clients.local is also read, so
# that you can put there local entries.
#
POSTGREY_OPTS=""
#!/bin/bash
# source application-specific settings
POSTGREY_CONF=/etc/conf.d/postgrey
[ -f $POSTGREY_CONF ] && . $POSTGREY_CONF
. /etc/rc.conf
. /etc/rc.d/functions
DAEMON_NAME="postgrey"
POSTGREY_BIN="/usr/sbin/postgrey"
POSTGREY_PID=`pidof -o %PPID /usr/sbin/postgrey`
echo $POSTGREY_TYPE
checkconfig() {
if [ -z $POSTGREY_TYPE ]
then
echo "You need to choose the server type you want"
echo "by setting the POSTGREY_TYPE variable in ${conf}."
else
if [ "$POSTGREY_TYPE" = "inet" ]
then
if [ -z "$POSTGREY_PORT" ] || [ -z "$POSTGREY_HOST" ]
then
echo "The following entries are missing in ${conf}:"
[ -z "$POSTGREY_HOST" ] && echo " - POSTGREY_HOST"
[ -z "$POSTGREY_PORT" ] && echo " - POSTGREY_PORT"
stat_fail
fi
POSTGREY_ADDR="$POSTGREY_TYPE=$POSTGREY_HOST:$POSTGREY_PORT"
else
if [ -z "$POSTGREY_SOCKET" ]
then
echo "The following entries are missing in $conf:"
[ -z "$POSTGREY_SOCKET" ] && echo " - POSTGREY_SOCKET"
stat_fail
fi
POSTGREY_ADDR="$POSTGREY_TYPE=$POSTGREY_SOCKET"
fi
fi
}
start() {
checkconfig || stat_fail
stat_busy "Starting Postgrey"
# HACK -- start a subshell and corrects perms on the socket...
( if [ "x${POSTGREY_TYPE}" = "xunix" ]; then
rm -f ${POSTGREY_SOCKET};
while ! test -S ${POSTGREY_SOCKET}; do sleep 1; done;
chmod a+rw,a-x ${POSTGREY_SOCKET}; fi ) &
[ -z "$PID" ] && /usr/sbin/postgrey --$POSTGREY_ADDR $POSTGREY_OPTS&> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon postgrey
stat_done
fi
}
stop() {
stat_busy "Stopping Postfix"
[ ! -z "$PID" ] && kill -9 $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon postgrey
stat_done
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
# calling 'stop' and 'start' without the $0 fails...
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
Offline
Now in AUR. Some comments would be nice since this is only the second package I've done. Should some additional info on setting up the package be added to the .install file?
Offline
Pages: 1