#!/bin/sh

# don't run if this package is removed but not purged
if [ ! -f /usr/sbin/popularity-contest ]; then
	exit 0
fi

# get configuration information
. /etc/popularity-contest.conf

# don't run if MAILTO address is blank!
if [ -z "$MAILTO" ]; then
	exit 0
fi

# generate and transmit the popularity contest data
( echo 'From: <nobody@debian.org>';
  echo 'Subject: popularity-contest submission';
  echo;
  popularity-contest ) | sendmail -oi -f nobody@debian.org "$MAILTO"
