- fix periodic script(s) [1] [2]

- use ports framework to create user/group
 - add pkg-install script to create links and directories
   so they are created during package install
 - use COPYTREE_SHARE instead of fix permissions and use INSTALL_DATA
 - fix order of pkg-plist
 - bump PORTREVISION

PR:		[1] ports/152365 [2] ports/153350 (maintainer)
Submitted by:	[1] Marco Walraven [2] Rusty Nejdl (maintainer)
This commit is contained in:
Olli Hauer 2011-01-06 16:26:53 +00:00
parent f8dd90e6de
commit 93a605385b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=267459
6 changed files with 48 additions and 51 deletions

View file

@ -7,8 +7,10 @@
PORTNAME= assp
PORTVERSION= 1.8.1.6
PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= SF/${PORTNAME}/ASSP%20Installation/${PORTNAME:U}%20${PORTVERSION}/
MASTER_SITES= SF
MASTER_SITE_SUBDIR=${PORTNAME}/ASSP%20Installation/${PORTNAME:U}%20${PORTVERSION}/
DISTNAME= ${PORTNAME:U}_${PORTVERSION}-Install
MAINTAINER= rnejdl@ringofsaturn.com
@ -22,14 +24,14 @@ MAN8= assp.8 assplog.8
ASSP_USER= assp
ASSP_GROUP= assp
ASSP_UID= 587
ASSP_GID= 587
USERS= ${ASSP_USER}
GROUPS= ${ASSP_GROUP}
ASSP_HOME= /var/db/assp
ASSP_LOG= /var/log/assp
PLIST_SUB= ASSP_HOME="${ASSP_HOME}" ASSP_LOG="${ASSP_LOG}"
SUB_FILES= assp.8 assplog.8 assplog.pl periodic-assp
SUB_FILES= assp.8 assplog.8 assplog.pl periodic-assp pkg-install
SUB_LIST= ASSP_USER="${ASSP_USER}" ASSP_GROUP="${ASSP_GROUP}" \
ASSP_HOME="${ASSP_HOME}" ASSP_LOG="${ASSP_LOG}" \
DATADIR="${DATADIR}" PERL="${PERL}"
@ -129,57 +131,23 @@ RUN_DEPENDS+= ${SITE_PERL}/IO/Socket/INET6.pm:${PORTSDIR}/net/p5-IO-Socket-INET6
EXTRACT_AFTER_ARGS= -d ${PORTNAME}-${PORTVERSION}
post-extract:
@echo "===> Removing incorrect group/other write permissions"
@${FIND} ${WRKDIR}/${PORTNAME}-${PORTVERSION} -type d -exec ${CHMOD} go-w {} \;
@${FIND} ${WRKDIR}/${PORTNAME}-${PORTVERSION} -type f -exec ${CHMOD} a-wx {} \;
post-patch:
@${REINPLACE_CMD} -e 's|/usr/bin/perl|${PERL}|' ${WRKSRC}/*.pl
pre-install:
if ! /usr/sbin/pw groupshow ${ASSP_GROUP}; then \
/usr/sbin/pw groupadd ${ASSP_GROUP} -g ${ASSP_GID}; \
else \
${ECHO_CMD} "Using exsing ${ASSP_GROUP} group"; \
fi; \
if ! /usr/sbin/pw usershow ${ASSP_USER}; then \
/usr/sbin/pw useradd ${ASSP_USER} -g ${ASSP_GROUP} -u ${ASSP_UID} -h - -d ${ASSP_HOME} -s /usr/sbin/nologin -c "ASSP Anti-Spam Proxy"; \
else \
${ECHO_CMD} "Using exsing ${ASSP_USER} user"; \
fi
do-install:
${MKDIR} ${DATADIR}
${INSTALL_SCRIPT} ${WRKSRC}/assp.pl ${DATADIR}
${INSTALL_SCRIPT} ${WRKSRC}/rebuildspamdb.pl ${DATADIR}
${INSTALL_SCRIPT} ${WRKSRC}/stat.pl ${DATADIR}
${MKDIR} ${DATADIR}/files
${INSTALL_DATA} ${WRKSRC}/files/* ${DATADIR}/files
${MKDIR} ${DATADIR}/images
${INSTALL_DATA} ${WRKSRC}/images/* ${DATADIR}/images
${MKDIR} ${DATADIR}/reports
${INSTALL_DATA} ${WRKSRC}/reports/* ${DATADIR}/reports
${LN} -s ${DATADIR}/assp.pl ${PREFIX}/sbin/assp
( cd ${WRKSRC} && ${COPYTREE_SHARE} "files images reports" \
${DATADIR}/ "! -name '*.orig' ! -name '*.bak'" )
${INSTALL_SCRIPT} ${WRKDIR}/assplog.pl ${PREFIX}/sbin/assplog
${INSTALL_MAN} ${WRKDIR}/assp.8 ${MAN8PREFIX}/man/man8
${INSTALL_MAN} ${WRKDIR}/assplog.8 ${MAN8PREFIX}/man/man8
${MKDIR} ${ASSP_LOG}
${CHOWN} ${ASSP_USER}:${ASSP_GROUP} ${ASSP_LOG}
${CHMOD} 750 ${ASSP_LOG}
${MKDIR} ${ASSP_HOME}
${CHOWN} ${ASSP_USER}:${ASSP_GROUP} ${ASSP_HOME}
${CHMOD} 700 ${ASSP_HOME}
${LN} -s ${DATADIR}/files ${ASSP_HOME}
${LN} -s ${DATADIR}/images ${ASSP_HOME}
${LN} -s ${DATADIR}/reports ${ASSP_HOME}
${LN} -s ${ASSP_LOG} ${ASSP_HOME}/logs
${MKDIR} ${PREFIX}/etc/periodic/daily
${INSTALL_SCRIPT} ${WRKDIR}/periodic-assp ${PREFIX}/etc/periodic/daily/510.assp
@ -188,4 +156,11 @@ do-install:
${INSTALL_DATA} ${WRKSRC}/docs/*.htm ${DOCSDIR}
.endif
post-install:
@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
# XXX Workaround: for PR ports/152498. Remove if PR ports/152498 is fixed!
@${EGREP} -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} > ${WRKDIR}/.PLIST.ugid
@${EGREP} -v -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} >> ${WRKDIR}/.PLIST.ugid
@${MV} ${WRKDIR}/.PLIST.ugid ${TMPPLIST}
.include <bsd.port.post.mk>

View file

@ -15,6 +15,7 @@ else
echo ""
echo "Running ASSP rebuildspamdb.pl:"
%%PERL%% %%DATADIR%%/rebuildspamdb.pl && rc_spamdb=0 || rc_spamdb=3
chown -R %%ASSP_USER%%:%%ASSP_GROUP%% %%ASSP_HOME%%
fi
. /etc/rc.subr

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/mail/assp/files/Attic/periodic-assp.in,v 1.1 2010-12-12 01:09:48 pgollucci Exp $
# $FreeBSD: /tmp/pcvs/ports/mail/assp/files/Attic/periodic-assp.in,v 1.2 2011-01-06 16:26:53 ohauer Exp $
#
# Run ASSP's nightly housekeeping script, rebuildspamdb.pl
# Delete old ASSP log files
@ -15,7 +15,7 @@ else
echo ""
echo "Running ASSP rebuildspamdb.pl:"
%%PERL%% %%DATADIR%%/rebuildspamdb.pl && rc_spamdb=0 || rc_spamdb=3
chown -R assp:assp %%DATADIR%%
chown -R %%ASSP_USER%%:%%ASSP_GROUP%% %%ASSP_HOME%%
fi
. /etc/rc.subr

View file

@ -15,6 +15,7 @@ else
echo ""
echo "Running ASSP rebuildspamdb.pl:"
%%PERL%% %%DATADIR%%/rebuildspamdb.pl && rc_spamdb=0 || rc_spamdb=3
chown -R %%ASSP_USER%%:%%ASSP_GROUP%% %%ASSP_HOME%%
fi
. /etc/rc.subr

View file

@ -0,0 +1,20 @@
#!/bin/sh
# $FreeBSD$
if [ "${2}" = "POST-INSTALL" ]; then
ASSP_USER=%%ASSP_USER%%
ASSP_GROUP=%%ASSP_GROUP%%
ASSP_HOME=%%ASSP_HOME%%
ASSP_LOG=%%ASSP_LOG%%
DATADIR=${PKG_PREFIX}/share/assp
ln -sf ${DATADIR}/assp.pl ${PKG_PREFIX}/sbin/assp
install -d -m 750 -o ${ASSP_USER} -g ${ASSP_GROUP} ${ASSP_LOG}
install -d -m 700 -o ${ASSP_USER} -g ${ASSP_GROUP} ${ASSP_HOME}
ln -sf ${DATADIR}/files ${ASSP_HOME}
ln -sf ${DATADIR}/images ${ASSP_HOME}
ln -sf ${DATADIR}/reports ${ASSP_HOME}
ln -sf ${ASSP_LOG} ${ASSP_HOME}/logs
fi

View file

@ -1,15 +1,15 @@
etc/periodic/daily/510.assp
@dirrmtry etc/periodic/daily
@dirrmtry etc/periodic
sbin/assp
sbin/assplog
%%DATADIR%%/assp.pl
%%DATADIR%%/files/URIBLCCTLDS.txt
%%DATADIR%%/files/blackaddresses.txt
%%DATADIR%%/files/blackdomains.txt
%%DATADIR%%/files/blackre.txt
%%DATADIR%%/files/blackre.txt
%%DATADIR%%/files/blockreportlist.txt
%%DATADIR%%/files/bombheaderre.txt
%%DATADIR%%/files/bombsenderre.txt
%%DATADIR%%/files/bombre.txt
%%DATADIR%%/files/bombsenderre.txt
%%DATADIR%%/files/charsets.txt
%%DATADIR%%/files/deny.txt
%%DATADIR%%/files/denyalways.txt
@ -74,15 +74,15 @@ etc/periodic/daily/510.assp
%%DATADIR%%/reports/whiteremovereport.txt
%%DATADIR%%/reports/whitereport.txt
%%DATADIR%%/stat.pl
%%PORTDOCS%%%%DOCSDIR%%/Legacy - ASSP Documentation.htm
%%PORTDOCS%%%%DOCSDIR%%/Regular Expression Tutorial.htm
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@dirrm %%DATADIR%%/reports
@dirrm %%DATADIR%%/images
@dirrm %%DATADIR%%/files
@dirrm %%DATADIR%%
sbin/assp
sbin/assplog
%%PORTDOCS%%%%DOCSDIR%%/Legacy - ASSP Documentation.htm
%%PORTDOCS%%%%DOCSDIR%%/Regular Expression Tutorial.htm
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@dirrmtry etc/periodic/daily
@dirrmtry etc/periodic
@unexec rm %%ASSP_HOME%%/logs
@unexec rm %%ASSP_HOME%%/reports
@unexec rm %%ASSP_HOME%%/images