From 450d0be9dd16de6271e8aac017517f969d012b14 Mon Sep 17 00:00:00 2001 From: joerg Date: Tue, 9 Feb 2010 20:18:43 +0000 Subject: Fix overcomplicated install rules. Make sure to create the logfile at install time with the right permissions and don't make most of the templates group writeable. Bump revision. --- www/privoxy/Makefile | 14 ++--- www/privoxy/distinfo | 3 +- www/privoxy/patches/patch-ab | 118 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 10 deletions(-) create mode 100644 www/privoxy/patches/patch-ab (limited to 'www') diff --git a/www/privoxy/Makefile b/www/privoxy/Makefile index 9c26dccd5d7..c3b3cdabdad 100644 --- a/www/privoxy/Makefile +++ b/www/privoxy/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.41 2010/02/08 09:54:23 tnn Exp $ +# $NetBSD: Makefile,v 1.42 2010/02/09 20:18:43 joerg Exp $ # DISTNAME= ${PKGNAME_NOREV}-stable-src PKGNAME= privoxy-3.0.12 +PKGREVISION= 1 CATEGORIES= www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ijbswa/} @@ -10,10 +11,7 @@ MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://www.privoxy.org/ COMMENT= Web proxy with advanced filtering capabilities -# Package is not destdir ready: -# 1) install expects the privoxy user to exist and fails if it doesn't -# 2) unsafe use of ROOT_USER in post-install -#PKG_DESTDIR_SUPPORT= user-destdir +PKG_DESTDIR_SUPPORT= user-destdir .include "../../mk/bsd.prefs.mk" @@ -57,6 +55,7 @@ CONF_FILES_PERMS+= ${EGDIR}/${i} ${PKG_SYSCONFDIR}/${i} ${USER_GROUP} 0660 .endfor OWN_DIRS_PERMS+= /var/log/privoxy ${USER_GROUP} 0775 +CONF_FILES_PERMS+= /dev/null /var/log/privoxy/logfile ${USER_GROUP} 0660 FILES_SUBST+= PRIVOXY_USER=${PRIVOXY_USER:Q} @@ -65,13 +64,10 @@ SUBST_FILES.paths= config SUBST_SED.paths+= -e 's,@PKG_SYSCONFDIR@,${PKG_SYSCONFDIR},g' SUBST_STAGE.paths= post-patch + pre-configure: cd ${WRKSRC} && autoheader && autoconf -post-install: - ${CHOWN} -R ${ROOT_USER}:${ROOT_GROUP} ${DESTDIR}${EGDIR} - ${CHMOD} -R a+r ${DESTDIR}${EGDIR} - .include "../../devel/pcre/buildlink3.mk" .include "../../devel/zlib/buildlink3.mk" .include "../../mk/pthread.buildlink3.mk" diff --git a/www/privoxy/distinfo b/www/privoxy/distinfo index 891af5de628..e2f445b282f 100644 --- a/www/privoxy/distinfo +++ b/www/privoxy/distinfo @@ -1,8 +1,9 @@ -$NetBSD: distinfo,v 1.13 2009/04/07 14:02:06 mjl Exp $ +$NetBSD: distinfo,v 1.14 2010/02/09 20:18:43 joerg Exp $ SHA1 (privoxy-3.0.12-stable-src.tar.gz) = 1118d6a7b4980f26c9ad0902c0e6af5aaaf1a640 RMD160 (privoxy-3.0.12-stable-src.tar.gz) = 32509b897e073f1cc100b8a4a157d19a219b51cd Size (privoxy-3.0.12-stable-src.tar.gz) = 1811124 bytes SHA1 (patch-aa) = c263d2a4b9522a33613f82ab2bc18d5c2b554b21 +SHA1 (patch-ab) = 2e16792661d12d74231cb2deef2f343ae2dc1d66 SHA1 (patch-ac) = e39ffe694462b952c5ad66ac577a0acbee0a1d9f SHA1 (patch-ag) = fea1c2ef70a99ab6da3feab22c69f3b98c0e75d0 diff --git a/www/privoxy/patches/patch-ab b/www/privoxy/patches/patch-ab new file mode 100644 index 00000000000..eb2a860d3fe --- /dev/null +++ b/www/privoxy/patches/patch-ab @@ -0,0 +1,118 @@ +$NetBSD: patch-ab,v 1.5 2010/02/09 20:18:43 joerg Exp $ + +--- GNUmakefile.in.orig 2009-02-28 08:28:14.000000000 +0000 ++++ GNUmakefile.in +@@ -87,7 +87,7 @@ INSTALL = @INSTALL@ + # Binaries + BIN_MODE = 0755 + # Support files, docs, etc. +-RA_MODE = 0664 ++RA_MODE = 0644 + # Directory + DIR_MODE = 0755 + # Files daemon writes to. +@@ -1029,16 +1029,6 @@ install-strip: + # Perhaps the whole user/group validation should be done here, and simplified. + PROGRAM_V = Privoxy $(VERSION) $(CODE_STATUS) + install: CONF_DEST LOG_DEST PID_DEST check_doc GROUP_T +- @# Quick test for valid USER. +- @if [ -n "$(USER)" ]; then \ +- $(ID) $(USER) >/dev/null || exit 1;\ +- fi +- @# Test for valid group. FIXME. USER does not have to belong to GROUP +- @# for file ownership purposes. +-# if [ -n "$(GROUP_T)" ] && [ -n "$(USER)" ] && ! $(GROUPS) $(USER) | $(GREP) "\<$(GROUP_T)\>" >/dev/null; then \ +-# $(ECHO) Group $(GROUP_T) for User $(USER) is invalid && exit 1 ;\ +-# fi +- + @$(ECHO) "Creating directories, and preparing $(PROGRAM_V) installation" + $(CHMOD) $(DIR_MODE) $(MKDIR) + @$(MKDIR) $(DESTDIR)$(SBIN_DEST) $(DESTDIR)$(prefix) $(DESTDIR)$(CONF_DEST) \ +@@ -1106,41 +1096,6 @@ install: CONF_DEST LOG_DEST PID_DEST che + $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$(CONF_DEST)/templates ;\ + done + +- @# FIXME: group/user validation is overly convoluted. +- @# If superuser install ... we require a minimum of group ownership +- @# of those files the daemon writes to, to be non-root owned. +- @if [ "`$(ID) |sed 's/(.*//' |sed 's/.*=//'`" = "0" ] ;then\ +- if [ x$(USER) = x ] || [ $(USER) = root ]; then \ +- if [ x$(GROUP) = x ] || [ $(GROUP) = root ]; then \ +- if [ "`$(ID) privoxy`" ] && \ +- $(GROUPS) privoxy | $(SED) 's/^.*://' |$(GREP) "\" >/dev/null; then \ +- $(ECHO) "Warning: Setting group owner to privoxy";\ +- GROUP_T=privoxy ;\ +- else \ +- $(ECHO) "******************************************************************" ;\ +- $(ECHO) " WARNING! WARNING! installing config files as root!" ;\ +- $(ECHO) " It is strongly recommended to run $(PROGRAM) as a non-root user," ;\ +- $(ECHO) " and to install the config files as that user and/or group!" ;\ +- $(ECHO) " Please read INSTALL, and create a privoxy user and group!" ;\ +- $(ECHO) "*******************************************************************" ;\ +- exit 1 ;\ +- fi ;\ +- else \ +- GROUP_T=$(GROUP) ;\ +- fi ;\ +- INSTALL_CONF="$(INSTALL_R) -g $$GROUP_T " ;\ +- else \ +- $(ECHO) "Superuser install, installing config files as $(USER):$(GROUP_T)" ;\ +- INSTALL_CONF="$(INSTALL_R) -o $(USER) -g $(GROUP_T)" ;\ +- GROUP_T=$(GROUP_T) ;\ +- fi ;\ +- else \ +- if [ ! "`id $(USER)`" = "`id`" ] ;then \ +- $(ECHO) "** WARNING ** current install user different from configured user!!" ;\ +- $(ECHO) "Edit may fail." ;\ +- fi ;\ +- INSTALL_CONF="$(INSTALL_R)" ;\ +- fi ;\ + $(ECHO) Installing configuration files to $(DESTDIR)$(CONF_DEST);\ + for i in $(CONFIGS); do \ + if [ "$$i" = "default.action" ] || [ "$$i" = "default.filter" ] ; then \ +@@ -1159,45 +1114,6 @@ install: CONF_DEST LOG_DEST PID_DEST che + $(CHMOD) $(RWD_MODE) $(DESTDIR)$(CONF_DEST)/*.new || exit 1 ;\ + $(ECHO) "Warning: Older config files are preserved. Check new versions for changes!" ;\ + fi ;\ +- [ ! -f $(DESTDIR)$(LOG_DEST)/logfile ] && $(ECHO) Creating logfiles in $(DESTDIR)$(LOG_DEST) || \ +- $(ECHO) Checking logfiles in $(DESTDIR)$(LOG_DEST) ;\ +- $(TOUCH) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\ +- if [ x$$USER != x ]; then \ +- $(CHOWN) $$USER $(DESTDIR)$(LOG_DEST)/logfile || \ +- $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\ +- fi ;\ +- if [ x$$GROUP_T != x ]; then \ +- $(CHGRP) $$GROUP_T $(DESTDIR)$(LOG_DEST)/logfile || \ +- $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\ +- fi ;\ +- $(CHMOD) $(RWD_MODE) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\ +- if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \ +- if [ -f /etc/slackware-version ] && [ -d /etc/rc.d/ ] && [ -w /etc/rc.d/ ] ; then \ +- $(SED) 's+%PROGRAM%+$(PROGRAM)+' slackware/rc.privoxy.orig | \ +- $(SED) 's+%SBIN_DEST%+$(SBIN_DEST)+' | \ +- $(SED) 's+%CONF_DEST%+$(CONF_DEST)+' | \ +- $(SED) 's+%USER%+$(USER)+' | \ +- $(SED) 's+%GROUP%+$(GROUP_T)+' >slackware/rc.privoxy ;\ +- $(INSTALL) $(INSTALL_P) slackware/rc.privoxy $(DESTDIR)/etc/rc.d/ ;\ +- $(ECHO) "Installing for Slackware." ;\ +- $(ECHO) "Dont forget to add the rc.privoxy to rc.local if you want it started at every boot" ;\ +- elif [ -f /etc/redhat-release ] && [ -d /etc/rc.d/init.d/ ] && [ -w /etc/rc.d/init.d/ ] ; then \ +- $(ECHO) "Installing init script to /etc/rc.d/init.d/privoxy" ;\ +- $(SED) 's,^PRIVOXY_BIN=.*,PRIVOXY_BIN="/usr/local/sbin/$(PROGRAM)",' privoxy.init |\ +- $(SED) 's,^PRIVOXY_CONF=.*,PRIVOXY_CONF="$(CONF_DEST)/config",' |\ +- $(SED) "s,^PRIVOXY_USER=.*,PRIVOXY_USER=$$USER," > init.tmp ;\ +- $(INSTALL) $(INSTALL_P) init.tmp $(DESTDIR)/etc/rc.d/init.d/privoxy && $(RM) init.tmp;\ +- $(MKDIR) $(DESTDIR)/etc/logrotate.d/ ;\ +- $(ECHO) "Installing logrotate script to $(DESTDIR)/etc/logrotate.d/" ;\ +- $(INSTALL) -m 0644 privoxy.logrotate $(DESTDIR)/etc/logrotate.d/privoxy ;\ +- elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \ +- $(ECHO) "Installing generic init script to $(DESTDIR)/etc/init.d/privoxy" ;\ +- $(ECHO) "Please check that the PATHs are correct, and edit if needed." ;\ +- $(INSTALL) $(INSTALL_P) privoxy-generic.init $(DESTDIR)/etc/init.d/privoxy ;\ +- fi ;\ +- else \ +- $(ECHO) "No init script installed, install it manually if needed" ;\ +- fi + $(RM) config.base config.tmp + @# mmmmm, good. + @$(ECHO) "$(PROGRAM_V) installation succeeded!" -- cgit v1.2.3