1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00

- Update to 6.3.4 [1]

- Add rcNG script. See $PREFIX/etc/rc.d/fetchmail for
  instructions. Inspired by [2] and ports/www/apache22.

PR:		ports/96987 [1], ports/96079
Submitted by:	Rob MacGregor <freebsd.macgregor@blueyonder.co.uk> [1],
		Martin Jackson <mhjacks@swbell.net>
This commit is contained in:
Simon Barner 2006-05-12 16:58:48 +00:00
parent 2207dd33a8
commit f9884d1c0e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=162186
8 changed files with 216 additions and 20 deletions

View File

@ -6,6 +6,20 @@ You should get into the habit of checking this file for changes each
time you update your ports collection, before attempting any port
upgrades.
20060512:
AFFECTS: users of mail/fetchmail
AUTHOR: barner@FreeBSD.org
Fetchmail now has a rcNG script. It supports two modes:
- one fetchmail instance per user: Set the `fetchmail_users'
variable to a list of users for which you want to start
fetchmail.
- a global system wide daemon (runs per default as user
`fetchmail')
See $PREFIX/etc/rc.d/fetchmail for details.
20060509:
AFFECTS: users of net-im/sulci
AUTHOR: Denis Shaposhnikov <dsh@vlink.ru>

View File

@ -10,8 +10,7 @@
# want fetchmailconf to work, define WITH_X11
PORTNAME= fetchmail
PORTVERSION= 6.3.2
PORTREVISION= 1
PORTVERSION= 6.3.4
CATEGORIES= mail ipv6
MASTER_SITES= http://download.berlios.de/%SUBDIR%/ \
http://home.pages.de/~mandree/%SUBDIR%/ \
@ -23,6 +22,9 @@ COMMENT= Batch mail retrieval utility for IMAP/POP2/POP3/ETRN/ODMR
RUN_DEPENDS= ${LOCALBASE}/share/certs/ca-root.crt:${PORTSDIR}/security/ca-roots
USE_RC_SUBR= fetchmail
FETCHMAILRC= ${PREFIX}/etc//fetchmailrc
USE_BZIP2= yes
USE_GMAKE= yes
GNU_CONFIGURE= yes
@ -98,6 +100,9 @@ pre-configure:
@${ECHO_CMD} "You can use -DWITHOUT_NLS to suppress national language support (NLS)."
.endif
pre-install:
@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
.if !defined(NOPORTDOCS)
${INSTALL} -d -m 555 -o ${DOCOWN} -g ${DOCGRP} ${DOCSDIR}
@ -106,5 +111,10 @@ post-install:
${INSTALL_SCRIPT} ${WRKDIR}/fetchmailconf ${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/fetchmailconf.py ${PREFIX}/libexec
${INSTALL} -d -m 755 -o fetchmail -g fetchmail /var/run/fetchmail
${INSTALL} -m 644 -o fetchmail -g fetchmail ${FILESDIR}/fetchmailrc.sample ${PREFIX}/etc/fetchmailrc.sample
if [ ! -f ${PREFIX}/etc/fetchmailrc ]; then \
${CP} -p ${PREFIX}/etc/fetchmailrc.sample ${PREFIX}/etc/fetchmailrc ; \
fi
.include <bsd.port.post.mk>

View File

@ -1,3 +1,3 @@
MD5 (fetchmail-6.3.2.tar.bz2) = a532134a5e3b35b4f8b78a8184439837
SHA256 (fetchmail-6.3.2.tar.bz2) = 4fbb779c0fddf74af8267a8e8a68bc276c7afc2c854e04b754ca7ebbab2f876e
SIZE (fetchmail-6.3.2.tar.bz2) = 1190838
MD5 (fetchmail-6.3.4.tar.bz2) = 35ded0414fcff79b492d6ade2ce48911
SHA256 (fetchmail-6.3.4.tar.bz2) = a090cfc47949e4ea5eebd46c82e82be35cdc743488e6d7258089591521b5db4f
SIZE (fetchmail-6.3.4.tar.bz2) = 1210405

View File

@ -0,0 +1,135 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: fetchmail
# REQUIRE: mail
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable fetchmail:
#
# fetchmail_enable="YES"
#
# There are two modes:
#
# * Single system-wide fetchmail daemon:
# - It is run as user `fetchmail_user' (default: fetchmail)
# - All configuration is contained in one global file
# `fetchmail_config' (default: %%PREFIX/etc/fetchmailrc),
# that must be owned by `fetchmail_user' (mode 700)
# - The fetchmail daemon awakes to fetch mail every
# `fetchmail_polling_interval' seconds (default: 900).
#
# * Per-user daemon
# - Users for which a fetchmail daemon is to be started must be
# listed in `fetchmail_users', e.g. fetchmail_users="user1 user2"
# - The config files for the individual users must be located at
# ${fetchmail_home_prefix}/${user}/${fetchmail_config_name}. The
# default for `fetchmail_home_prefix' is "/home", and that for
# `fetchmail_config_name' is ".fetchmailrc".
# - Note that "${fetchmail_home_prefix}/${user}" must be writable
# for ${user} since it is used to store the per-user PID files!
# - There are user-specific versions of `fetchmail_config' and
# `fetchmail_polling_interval' that can be used to override the
# defaults, i.e. for the user `user1' there are variables
# `fetchmail_user1_config' and `fetchmail_user1_polling_interval'
# - All commands (e.g. start, stop, awaken (see below)) can be either
# passed to all instances of the daemon (if %%PREFIX/etc/rc.d/fetchmail)
# is run as root), or just to the instance belonging to the respective
# user.
#
# Extra commands:
#
# * `awaken': Sends a signal to the daemon(s) to check for new mail
# immediately
. /etc/rc.subr
name=fetchmail
rcvar=`set_rcvar`
command=%%PREFIX%%/bin/${name}
pidfile=/var/run/${name}.pid
extra_commands="awaken"
awaken_cmd="fetchmail_awaken"
# read settings, set default values
load_rc_config "$name"
: ${fetchmail_enable="NO"}
: ${fetchmail_config="%%PREFIX%%/etc/fetchmailrc"}
: ${fetchmail_polling_interval="900"}
: ${fetchmail_home_prefix="/home"}
: ${fetchmail_config_name=".fetchmailrc"}
# send signal to fetchmail process(es) to check for new mail immediately
fetchmail_awaken()
{
if [ $rc_pid ]; then
echo "Forcing fetchmail to check mailbox(es)..."
kill -USR1 $rc_pid
else
echo "$name not running? (check $pidfile)"
fi
return
}
if [ -n "$2" ]; then
# perform action for an instance of fetchmail daemon
user="$2"
if [ "x${fetchmail_users}" != "x" -o "x$3" = "xGLOBALCONFIG" ]; then
if [ "x${fetchmail_users}" != "x" ]; then
# multiuser setup: determine user specific config and pid file
eval fetchmail_config="\${fetchmail_${user}_config:-${fetchmail_home_prefix}/${user}}/${fetchmail_config_name}"
eval pidfile="${fetchmail_home_prefix}/${user}/.fetchmail.pid"
eval fetchmail_user=$user
else
eval fetchmail_user=fetchmail
eval pidfile=/var/run/fetchmail/fetchmail.pid
fi
required_files=${fetchmail_config}
eval fetchmail_polling_interval="\${fetchmail_${user}_polling_interval:-${fetchmail_polling_interval}}"
fetchmail_flags="-f ${fetchmail_config} \
--pidfile ${pidfile} \
-d ${fetchmail_polling_interval} \
--syslog"
else
echo "$0: extra argument ignored"
fi
else
uid=`id -u`
if [ "x${fetchmail_users}" != "x" -a "x$1" != "x" -a "$uid" = "0" ]; then
# root mode: multiple user profiles are handled by recursive
# calls of this script
for user in ${fetchmail_users}; do
echo "===> fetchmail user: ${user}"
%%PREFIX%%/etc/rc.d/fetchmail $1 ${user}
retcode="$?"
if [ "0${retcode}" -ne 0 ]; then
failed="${user} (${retcode}) ${failed:-}"
else
success="${user} ${success:-}"
fi
done
exit 0
else
if [ "x${fetchmail_users}" = "x" ]; then
# There is only one global configuration file
globalconfig=GLOBALCONFIG
fi
%%PREFIX%%/etc/rc.d/fetchmail $1 `id -u -n` $globalconfig
retcode="$?"
if [ "0${retcode}" -ne 0 ]; then
failed="${user} (${retcode}) ${failed:-}"
else
success="${user} ${success:-}"
fi
exit 0
fi
fi
# actually execute the fetchmail program
run_rc_command "$1"

View File

@ -0,0 +1 @@
# Sample

View File

@ -1,15 +0,0 @@
--- netrc.c (Revision 4683)
+++ netrc.c (Revision 4684)
@@ -314,8 +314,10 @@
free_netrc(netrc_entry *a) {
while(a) {
netrc_entry *n = a->next;
- memset(a->password, 0x55, strlen(a->password));
- xfree(a->password);
+ if (a->password != NULL) {
+ memset(a->password, 0x55, strlen(a->password));
+ free(a->password);
+ }
xfree(a->login);
xfree(a->host);
xfree(a);

View File

@ -0,0 +1,44 @@
#!/bin/sh
#
# $FreeBSD$
#
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
if [ -x /usr/sbin/nologin ]; then
NOLOGIN=/usr/sbin/nologin
else
NOLOGIN=/sbin/nologin
fi
if [ x"$2" = xPRE-INSTALL ]; then
USER=fetchmail
UID=124
GROUP=fetchmail
GID=124
if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
echo "You already have a group \"${GROUP}\", so I will use it."
else
if /usr/sbin/pw groupadd ${GROUP} -g ${GID}
then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
echo "Please create it, and try again."
exit 1
fi
fi
if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
echo "You already have a user \"${USER}\", so I will use it."
else
if /usr/sbin/pw useradd ${USER} -u ${UID} -g ${GROUP} -h - -d /var/run/fetchmail -s ${NOLOGIN} -c "Fetchmail mail-retrieval daemon"; then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
echo "Please create it, and try again."
exit 1
fi
fi
fi

View File

@ -23,3 +23,10 @@ libexec/fetchmailconf.py
%%NLS%%share/locale/pl/LC_MESSAGES/fetchmail.mo
%%NLS%%share/locale/ru/LC_MESSAGES/fetchmail.mo
%%NLS%%share/locale/sq/LC_MESSAGES/fetchmail.mo
%%NLS%%share/locale/vi/LC_MESSAGES/fetchmail.mo
@unexec if cmp -s %D/etc/fetchmailrc.sample %D/etc/fetchmailrc; then rm -f %D/etc/fetchmailrc; fi
etc/fetchmailrc.sample
@exec if [ ! -f %D/etc/fetchmailrc ] ; then cp -p %D/%F %B/fetchmailrc; fi
@cwd /
@unexec rm -f /var/run/fetchmail/fetchmail.pid 2>/dev/null || true
@dirrm /var/run/fetchmail