diff options
author | edwin <edwin@FreeBSD.org> | 2008-09-23 09:59:14 +0800 |
---|---|---|
committer | edwin <edwin@FreeBSD.org> | 2008-09-23 09:59:14 +0800 |
commit | a7e9638333d3a17253abaf823ba0e83b4372f016 (patch) | |
tree | 40348ea12eb5ea19e7709712221484b7c8ec6a07 /www/squidguard | |
parent | ad325ceab726e0575446e5951bcd52e4847c2de4 (diff) | |
download | freebsd-ports-gnome-a7e9638333d3a17253abaf823ba0e83b4372f016.tar.gz freebsd-ports-gnome-a7e9638333d3a17253abaf823ba0e83b4372f016.tar.zst freebsd-ports-gnome-a7e9638333d3a17253abaf823ba0e83b4372f016.zip |
[patch] www/squidguard - improve Makefile
Redo Makefile:
- split pre-install in post-build with regarding to extracting
of blacklists.
- Make targets easier to read.
- Merge pkg-plist and pkg-plist.blacklist and use PLIST_SUB.
- Add files/pkg-message.in
PR: ports/126626
Approved by: maintainer timeout
Diffstat (limited to 'www/squidguard')
-rw-r--r-- | www/squidguard/Makefile | 107 | ||||
-rw-r--r-- | www/squidguard/files/pkg-message.in | 7 | ||||
-rw-r--r-- | www/squidguard/pkg-plist | 95 | ||||
-rw-r--r-- | www/squidguard/pkg-plist.blacklist | 58 |
4 files changed, 145 insertions, 122 deletions
diff --git a/www/squidguard/Makefile b/www/squidguard/Makefile index d828767d9672..3a679138d87d 100644 --- a/www/squidguard/Makefile +++ b/www/squidguard/Makefile @@ -15,8 +15,6 @@ COMMENT= A fast redirector for squid RUN_DEPENDS= ${LOCALBASE}/sbin/squid:${PORTSDIR}/www/squid -BROKEN= bad plist - USE_BDB= 3+ HAS_CONFIGURE= yes CONFIGURE_ARGS= --with-db-inc=${BDB_INCLUDE_DIR} \ @@ -32,10 +30,22 @@ SQUID_UID?= squid SQUID_GID?= squid DATADIR?= /var/db/${PORTNAME} +_DATADIR= ${WRKDIR}/data LOGDIR?= /var/log -PLIST:= ${WRKDIR}/PLIST -PLIST_SUB= DATADIR=${DATADIR} +SUB_FILES= pkg-message +SUB_LIST= PORTNAME=${PORTNAME} +PKGMESSAGE= ${WRKDIR}/pkg-message + +.include <bsd.port.pre.mk> + +.if !exists(${DATADIR}) +PLIST_SUB+= BLACKLIST="" +INSTALL_BL= yes +.else +PLIST_SUB+= BLACKLIST="@comment " +INSTALL_BL= no +.endif pre-fetch: @if [ ${SQUID_UID} = "squid" -o ${SQUID_GID} = "squid" ] ; then \ @@ -52,31 +62,39 @@ post-patch: ${WRKSRC}/configure ; \ fi -pre-install: - @${CP} ${PKGDIR}/pkg-plist ${PLIST} - -### Install blacklists +post-build: +.if ${INSTALL_BL} == "yes" + @${ECHO_MSG} "===> Building blacklists" + ${MKDIR} ${_DATADIR} + @${TAR} -C ${_DATADIR} --exclude *.diff -pxzf \ + ${WRKSRC}/samples/dest/blacklists.tar.gz + @${MV} -f ${_DATADIR}/blacklists/README ${WRKDIR}/README.blacklists + @${MV} -f ${_DATADIR}/blacklists/* ${_DATADIR}/ + @${RM} -r ${_DATADIR}/blacklists + @${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${_DATADIR} +.endif -.if !exists(${DATADIR}) +pre-install: +# +# Install blacklists +# +.if ${INSTALL_BL} == "yes" @${ECHO_MSG} "===> Installing blacklists" @${MKDIR} ${DATADIR} - @${TAR} -C ${DATADIR} --exclude *.diff -pxzf ${WRKSRC}/samples/dest/blacklists.tar.gz - @${MV} -f ${DATADIR}/blacklists/README ${WRKDIR}/README.blacklists - @${MV} -f ${DATADIR}/blacklists/* ${DATADIR}/ - @${RM} -r ${DATADIR}/blacklists - @${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${DATADIR} + @${CP} -Rpf ${_DATADIR}/* ${DATADIR}/ @${CHMOD} -R 550 ${DATADIR} - @${CAT} ${PKGDIR}/pkg-plist.blacklist >> ${PLIST} @${ECHO_MSG} " -> Blacklists installed in: ${DATADIR}" .else @${ECHO_MSG} "===> Found existing datadirectory - skipping blacklist installation" .endif -### Create sample configuration file - +# +# Create sample configuration file +# @if [ ! -f "${PREFIX}/etc/squid/${PORTNAME}.conf" ] ; then \ ${ECHO_MSG} "===> Installing sample configuration file" ; \ - BLACKLIST_DIRS=`(cd ${DATADIR} && ${FIND} . -type d | ${SED} '/^\.$$/d; s/^\.\//!/' | ${XARGS} ${ECHO_CMD})`; \ + BLACKLIST_DIRS=`(cd ${DATADIR} && ${FIND} . -type d | \ + ${SED} '/^\.$$/d; s/^\.\//!/' | ${XARGS} ${ECHO_CMD})`; \ for I in `${ECHO_CMD} $${BLACKLIST_DIRS} | ${SED} 's/!//g'`; do \ ${ECHO_CMD} "dest $${I} {"; \ ${TEST} -f ${DATADIR}/$${I}/domains && \ @@ -87,33 +105,38 @@ pre-install: ${ECHO_CMD} " expressionlist $${I}/expressions"; \ ${ECHO_CMD} "}"; \ done > ${WRKDIR}/${PORTNAME}.conf.dests ; \ - ${SED} "s|DATADIR|${DATADIR}|;s|LOGDIR|${LOGDIR}|;s|BLACKLIST_DIRS|$${BLACKLIST_DIRS}|;/DEST_CLASSES/r ${WRKDIR}/${PORTNAME}.conf.dests" \ + ${SED} -e "s|DATADIR|${DATADIR}|" -e "s|LOGDIR|${LOGDIR}|" \ + -e "s|BLACKLIST_DIRS|$${BLACKLIST_DIRS}|;" \ + -e "/DEST_CLASSES/r ${WRKDIR}/${PORTNAME}.conf.dests" \ ${CFGINPUT} | \ ${SED} "/DEST_CLASSES/d" > \ ${PREFIX}/etc/squid/${PORTNAME}.conf.sample ; \ - ${CHOWN} ${SQUID_UID}:${SQUID_GID} ${PREFIX}/etc/squid/${PORTNAME}.conf.sample ; \ + ${CHOWN} ${SQUID_UID}:${SQUID_GID} \ + ${PREFIX}/etc/squid/${PORTNAME}.conf.sample ; \ ${ECHO_MSG} " -> Sample configuration file installed in: ${PREFIX}/etc/squid" ; \ else \ ${ECHO_MSG} "===> Existing configuration file found - sample not installed" ; \ fi -### Create blacklist databases (assume fresh install if we only have a sample config) - - @if [ ! -f "${PREFIX}/etc/squid/${PORTNAME}.conf" -a \ - -f "${PREFIX}/etc/squid/${PORTNAME}.conf.sample" ] ; then \ - ${ECHO_MSG} "===> Creating blacklist databases" ; \ - ${WRKSRC}/src/${PORTNAME} -d -c ${PREFIX}/etc/squid/${PORTNAME}.conf.sample -C all ; \ - ${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${DATADIR} ; \ - ${FIND} ${DATADIR} -type f -name *.db -exec ${CHMOD} 660 {} \; ; \ - ${ECHO_MSG} " -> Blacklist databases installed in: ${DATADIR}" ; \ - else \ - ${ECHO_MSG} "===> Existing configuration file found - blacklist databases not created" ; \ - fi +# +# Create blacklist databases (assume fresh install if we only have a +# sample config) +# +.if ${INSTALL_BL} == "yes" + @${ECHO_MSG} "===> Creating blacklist databases" ; \ + ${WRKSRC}/src/${PORTNAME} -d -c \ + ${PREFIX}/etc/squid/${PORTNAME}.conf.sample -C all ; \ + ${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${DATADIR} ; \ + ${FIND} ${DATADIR} -type f -name *.db -exec ${CHMOD} 660 {} \; ; \ + ${ECHO_MSG} " -> Blacklist databases installed in: ${DATADIR}" +.else + ${ECHO_MSG} "===> Existing configuration file found - blacklist databases not created" +.endif post-install: - -### Install documentation - +# +# Install documentation +# .if !defined(NOPORTDOCS) @${ECHO_MSG} "===> Installing ${PORTNAME} documentation" -@${MKDIR} ${DOCSDIR} @@ -131,16 +154,6 @@ post-install: @${CHOWN} -R ${SQUID_UID}:${SQUID_GID} ${LOGDIR} .endif -### View short howto message - - @${ECHO_MSG} " " - @${ECHO_MSG} "===================================================================" - @${ECHO_MSG} "= In order to activate ${PORTNAME} you have to edit squid.conf" - @${ECHO_MSG} "= To the contain \"url_rewrite_program ${PREFIX}/bin/${PORTNAME}\"" - @${ECHO_MSG} "= and create a configuration file for ${PORTNAME}." - @${ECHO_MSG} "=" - @${ECHO_MSG} "= To activate the changes do a ${PREFIX}/sbin/squid -k reconfigure" - @${ECHO_MSG} "===================================================================" - @${ECHO_MSG} " " + @${CAT} ${PKGMESSAGE} -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/www/squidguard/files/pkg-message.in b/www/squidguard/files/pkg-message.in new file mode 100644 index 000000000000..94a91e8c7c72 --- /dev/null +++ b/www/squidguard/files/pkg-message.in @@ -0,0 +1,7 @@ +=================================================================== += In order to activate %%PORTNAME%% you have to edit squid.conf += To the contain "url_rewrite_program %%PREFIX%%/bin/%%PORTNAME%%" += and create a configuration file for %%PORTNAME%%. += += To activate the changes do a %%PREFIX%%/sbin/squid -k reconfigure +=================================================================== diff --git a/www/squidguard/pkg-plist b/www/squidguard/pkg-plist index 5ade6dfd6f90..9603c16cf13b 100644 --- a/www/squidguard/pkg-plist +++ b/www/squidguard/pkg-plist @@ -1,19 +1,80 @@ bin/squidGuard -share/doc/squidGuard/LDAPFlow.txt -share/doc/squidGuard/README -share/doc/squidGuard/configuration.html -share/doc/squidGuard/configuration.txt -share/doc/squidGuard/configure.html -share/doc/squidGuard/configure.txt -share/doc/squidGuard/extended.html -share/doc/squidGuard/extended.txt -share/doc/squidGuard/faq.html -share/doc/squidGuard/faq.txt -share/doc/squidGuard/index.html -share/doc/squidGuard/install.html -share/doc/squidGuard/install.txt -share/doc/squidGuard/installation.html -share/doc/squidGuard/installation.txt -share/doc/squidGuard/squidGuard.gif etc/squid/squidGuard.conf.sample -@dirrm share/doc/squidGuard +@dirrm squidGuard +%%PORTDOCS%%%%DOCSDIR%%/LDAPFlow.txt +%%PORTDOCS%%%%DOCSDIR%%/README +%%PORTDOCS%%%%DOCSDIR%%/configuration.html +%%PORTDOCS%%%%DOCSDIR%%/configuration.txt +%%PORTDOCS%%%%DOCSDIR%%/configure.html +%%PORTDOCS%%%%DOCSDIR%%/configure.txt +%%PORTDOCS%%%%DOCSDIR%%/extended.html +%%PORTDOCS%%%%DOCSDIR%%/extended.txt +%%PORTDOCS%%%%DOCSDIR%%/faq.html +%%PORTDOCS%%%%DOCSDIR%%/faq.txt +%%PORTDOCS%%%%DOCSDIR%%/index.html +%%PORTDOCS%%%%DOCSDIR%%/install.html +%%PORTDOCS%%%%DOCSDIR%%/install.txt +%%PORTDOCS%%%%DOCSDIR%%/installation.html +%%PORTDOCS%%%%DOCSDIR%%/installation.txt +%%PORTDOCS%%%%DOCSDIR%%/squidGuard.gif +%%PORTDOCS%%%%DOCSDIR%%/README.blacklists +%%PORTDOCS%%@dirrm %%DOCSDIR%% + +%%BLACKLIST%%@cwd %%DATADIR%% +%%BLACKLIST%%ads/domains +%%BLACKLIST%%ads/domains.db +%%BLACKLIST%%ads/urls +%%BLACKLIST%%ads/urls.db +%%BLACKLIST%%aggressive/domains +%%BLACKLIST%%aggressive/domains.db +%%BLACKLIST%%aggressive/urls +%%BLACKLIST%%aggressive/urls.db +%%BLACKLIST%%audio-video/domains +%%BLACKLIST%%audio-video/domains.db +%%BLACKLIST%%audio-video/urls +%%BLACKLIST%%audio-video/urls.db +%%BLACKLIST%%drugs/domains +%%BLACKLIST%%drugs/domains.db +%%BLACKLIST%%drugs/urls +%%BLACKLIST%%drugs/urls.db +%%BLACKLIST%%gambling/domains +%%BLACKLIST%%gambling/domains.db +%%BLACKLIST%%gambling/urls +%%BLACKLIST%%gambling/urls.db +%%BLACKLIST%%hacking/domains +%%BLACKLIST%%hacking/domains.db +%%BLACKLIST%%hacking/urls +%%BLACKLIST%%hacking/urls.db +%%BLACKLIST%%mail/domains +%%BLACKLIST%%mail/domains.db +%%BLACKLIST%%porn/domains +%%BLACKLIST%%porn/domains.db +%%BLACKLIST%%porn/urls +%%BLACKLIST%%porn/urls.db +%%BLACKLIST%%porn/expressions +%%BLACKLIST%%proxy/domains +%%BLACKLIST%%proxy/domains.db +%%BLACKLIST%%proxy/urls +%%BLACKLIST%%proxy/urls.db +%%BLACKLIST%%violence/domains +%%BLACKLIST%%violence/domains.db +%%BLACKLIST%%violence/urls +%%BLACKLIST%%violence/urls.db +%%BLACKLIST%%violence/expressions +%%BLACKLIST%%warez/domains +%%BLACKLIST%%warez/domains.db +%%BLACKLIST%%warez/urls +%%BLACKLIST%%warez/urls.db +%%BLACKLIST%%@dirrm ads +%%BLACKLIST%%@dirrm aggressive +%%BLACKLIST%%@dirrm audio-video +%%BLACKLIST%%@dirrm drugs +%%BLACKLIST%%@dirrm gambling +%%BLACKLIST%%@dirrm hacking +%%BLACKLIST%%@dirrm mail +%%BLACKLIST%%@dirrm porn +%%BLACKLIST%%@dirrm proxy +%%BLACKLIST%%@dirrm violence +%%BLACKLIST%%@dirrm warez +%%BLACKLIST%%@cwd / +%%BLACKLIST%%@dirrm %%DATADIR%% diff --git a/www/squidguard/pkg-plist.blacklist b/www/squidguard/pkg-plist.blacklist deleted file mode 100644 index f3ec880fda52..000000000000 --- a/www/squidguard/pkg-plist.blacklist +++ /dev/null @@ -1,58 +0,0 @@ -@cwd %%DATADIR%% -ads/domains -ads/domains.db -ads/urls -ads/urls.db -aggressive/domains -aggressive/domains.db -aggressive/urls -aggressive/urls.db -audio-video/domains -audio-video/domains.db -audio-video/urls -audio-video/urls.db -drugs/domains -drugs/domains.db -drugs/urls -drugs/urls.db -gambling/domains -gambling/domains.db -gambling/urls -gambling/urls.db -hacking/domains -hacking/domains.db -hacking/urls -hacking/urls.db -mail/domains -mail/domains.db -porn/domains -porn/domains.db -porn/urls -porn/urls.db -porn/expressions -proxy/domains -proxy/domains.db -proxy/urls -proxy/urls.db -violence/domains -violence/domains.db -violence/urls -violence/urls.db -violence/expressions -warez/domains -warez/domains.db -warez/urls -warez/urls.db -@dirrm ads -@dirrm aggressive -@dirrm audio-video -@dirrm drugs -@dirrm gambling -@dirrm hacking -@dirrm mail -@dirrm porn -@dirrm proxy -@dirrm violence -@dirrm warez -@cwd / -@dirrm %%DATADIR%% |