From owner-freebsd-ports-bugs@FreeBSD.ORG Mon May 17 07:50:14 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CA6416A4CE for ; Mon, 17 May 2004 07:50:14 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8078C43D46 for ; Mon, 17 May 2004 07:50:12 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i4HEoCWE073301 for ; Mon, 17 May 2004 07:50:12 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i4HEoCA2073300; Mon, 17 May 2004 07:50:12 -0700 (PDT) (envelope-from gnats) Resent-Date: Mon, 17 May 2004 07:50:12 -0700 (PDT) Resent-Message-Id: <200405171450.i4HEoCA2073300@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Matthew Seaman Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B40FE16A4CE for ; Mon, 17 May 2004 07:40:37 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id B88FA43D2D for ; Mon, 17 May 2004 07:40:34 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) i4HEeOiC088963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 17 May 2004 15:40:24 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id i4HEeOa1088962; Mon, 17 May 2004 15:40:24 +0100 (BST) (envelope-from matthew) Message-Id: <200405171440.i4HEeOa1088962@happy-idiot-talk.infracaninophile.co.uk> Date: Mon, 17 May 2004 15:40:24 +0100 (BST) From: Matthew Seaman To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/66758: [Maintainer update] net/phpldapadmin config file handling, WITH_SUPHP X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Matthew Seaman List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2004 14:50:14 -0000 >Number: 66758 >Category: ports >Synopsis: [Maintainer update] net/phpldapadmin config file handling, WITH_SUPHP >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Mon May 17 07:50:12 PDT 2004 >Closed-Date: >Last-Modified: >Originator: Matthew Seaman >Release: FreeBSD 4.10-PRERELEASE i386 >Organization: Infracaninophile >Environment: System: FreeBSD happy-idiot-talk.infracaninophile.co.uk 4.10-PRERELEASE FreeBSD 4.10-PRERELEASE #68: Thu May 6 09:25:01 BST 2004 root@happy-idiot-talk.infracaninophile.co.uk:/usr/obj/usr/src/sys/HAPPY-IDIOT-TALK i386 >Description: Apply some ideas developed for use with the phpmyadmin port over to phpldapadmin: - Improve handling of config files, making them not world readable by default. - Add a WITH_SUPHP option. WITH_SUPHP gives a RUN_DEPENDS on www/suphp, and causes all of the web content to be installed with pldapadm:www ownership. Files added: pkg-deinstall-suphp pkg-install-suphp pkg-plist-chunk Files modified Makefile pkg-message >How-To-Repeat: >Fix: --- phpldapadmin.diff begins here --- diff -Nur /usr/ports/net/phpldapadmin/Makefile phpldapadmin/Makefile --- /usr/ports/net/phpldapadmin/Makefile Sat May 15 09:19:04 2004 +++ phpldapadmin/Makefile Mon May 17 15:20:44 2004 @@ -7,6 +7,7 @@ PORTNAME= phpldapadmin PORTVERSION= 0.9.4b +PORTREVISION= 1 CATEGORIES= net www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= phpldapadmin @@ -14,33 +15,80 @@ MAINTAINER= m.seaman@infracaninophile.co.uk COMMENT= A set of PHP-scripts to administer LDAP servers over the web +NO_BUILD= yes + +.if defined(WITH_SUPHP) + +RUN_DEPENDS= ${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp +PKGNAMESUFFIX= -suphp +PKGINST_SKEL= ${PKGDIR}/pkg-install${PKGNAMESUFFIX} +PKGINSTALL= ${WRKDIR}/pkg-install${PKGNAMESUFFIX} +PKGDEINST_SKEL= ${PKGDIR}/pkg-deinstall${PKGNAMESUFFIX} +PKGDEINSTALL= ${WRKDIR}/pkg-deinstall${PKGNAMESUFFIX} + +PLAUSR?= pldapadm + +SED_SCRIPT= -e 's,%%PREFIX%%,${PREFIX},g' \ + -e 's,%%PLADIR%%,${PLADIR},g' \ + -e 's,%%PLAUSR%%,${PLAUSR},g' \ + -e 's,%%PLAGRP%%,${PLAGRP},g' + +.else + USE_PHP= yes WANT_PHP_WEB= yes -NO_BUILD= yes -WWWDIR?= www/${PORTNAME} +.endif MSG_SKEL= ${PKGDIR}/pkg-message PKGMESSAGE= ${WRKDIR}/pkg-message + +# PLAUSR is only used WITH_SUPHP +PLADIR?= www/${PORTNAME} +PLAGRP?= ${WWWGRP} +CFGFILE= config.php + PLIST= ${WRKDIR}/plist -PLIST_SUB+= WWWDIR=${WWWDIR} +PLIST_SUB+= PLADIR=${PLADIR} PLAGRP=${PLAGRP} .SILENT: +pre-everything:: + ${ECHO_MSG} "" + ${ECHO_MSG} "You may use the following build options:" + ${ECHO_MSG} "" + ${ECHO_MSG} " WITH_SUPHP=yes Install appropriately for use with" + ${ECHO_MSG} " the www/suphp port [default: no]" + ${ECHO_MSG} "" + post-patch: ${RM} -f ${PLIST} cd ${WRKSRC} ; \ - ${FIND} . ! -type d ! -name .cvsignore | ${SORT} | \ - ${SED} "s,^.,%%WWWDIR%%," >${PLIST} ; \ - ${FIND} . -type d | ${SORT} -r | \ - ${SED} "s,^.,@dirrm %%WWWDIR%%," >>${PLIST} - ${SED} -e 's,%%WWWDIR%%,${WWWDIR},g' \ - -e 's,%%PREFIX%%,${PREFIX},g' ${MSG_SKEL} > ${PKGMESSAGE} + ${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore | \ + ${SORT} | ${SED} "s,^\.,%%PLADIR%%," >${PLIST} ; \ + ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ + ${FIND} . -type d | ${SORT} -r | ${SED} \ + -e "s,^\.$$,@unexec rmdir %D/%%PLADIR%% 2>/dev/null || true," \ + -e "s,^\.,@dirrm %%PLADIR%%," >>${PLIST} + ${SED} -e 's,%%PKGNAME%%,${PKGNAME},g' \ + -e 's,%%PREFIX%%,${PREFIX},g' \ + -e 's,%%PLADIR%%,${PLADIR},g' ${MSG_SKEL} > ${PKGMESSAGE} +.if defined(WITH_SUPHP) + ${SED} ${SED_SCRIPT} ${PKGINST_SKEL} > ${PKGINSTALL} + ${SED} ${SED_SCRIPT} ${PKGDEINST_SKEL} > ${PKGDEINSTALL} +.endif + +pre-install: +.if defined(WITH_SUPHP) + ${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL +.endif -do-install: +do-install: install-app install-conf + +install-app: cd ${WRKSRC} ; \ for src in $$( ${FIND} . ! -name .cvsignore ) ; do \ - dst=${PREFIX}/${WWWDIR}$${src#.} ; \ + dst=${PREFIX}/${PLADIR}$${src#.} ; \ if ${TEST} -d $$src ; then \ ${MKDIR} $$dst ; \ else \ @@ -48,9 +96,18 @@ fi \ done +install-conf: + cd ${PREFIX}/${PLADIR} ; \ + ${CHMOD} 0640 ${CFGFILE}.example ; \ + ${CHGRP} ${PLAGRP} ${CFGFILE}.example ; \ + if ${TEST} ! -f ${CFGFILE} ; then \ + ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \ + fi + post-install: - ${ECHO_MSG} +.if defined(WITH_SUPHP) + ${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL +.endif ${CAT} ${PKGMESSAGE} - ${ECHO_MSG} .include diff -Nur /usr/ports/net/phpldapadmin/pkg-deinstall-suphp phpldapadmin/pkg-deinstall-suphp --- /usr/ports/net/phpldapadmin/pkg-deinstall-suphp Thu Jan 1 01:00:00 1970 +++ phpldapadmin/pkg-deinstall-suphp Mon May 17 15:22:06 2004 @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +case $2 in + POST-DEINSTALL) + cat < Group $group created" + else + cat <<-EOERRORMSG + *** Failed to create the $group group. + + Please add the $user user and $group group + manually with the commands: + + pw groupadd -n $group + pw useradd -n $user -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi +} + + +create_user() { + local user group gcos home shell + + user=$1 + group=$2 + gcos=$3 + home=$4 + shell=$5 + + if pw useradd -n $user -g $group -c "$gcos" -d $home -s $shell -h - ; then + echo "===> Created $user user" + else + cat <<-EOERRORMSG + *** Failed to create the $user user. + + Please add the $user user manually with the command: + + pw useradd -n $user -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi +} + + +case $2 in + PRE-INSTALL) + + # Create the pla user and group if they do not already exist + + if pw user show -n $plausr >/dev/null 2>&1 ; then + echo "===> Using pre-existing user $plausr" + else + if ! pw group show -n $plagrp >/dev/null 2>&1 ; then + create_group $plausr $plagrp "$plagcos" $plahome \ + $plashell + fi + create_user $plausr $plagrp "$plagcos" $plahome $plashell + fi + ;; + POST-INSTALL) + + # Change ownership of the phpLDAPadmin directory + + echo "===> Adjusting file ownership in $pladir" + chown -R $plausr:$plagrp $pladir || exit 1 + ;; +esac + +# +# That's All Folks! +# diff -Nur /usr/ports/net/phpldapadmin/pkg-message phpldapadmin/pkg-message --- /usr/ports/net/phpldapadmin/pkg-message Sat May 15 09:19:04 2004 +++ phpldapadmin/pkg-message Mon May 17 14:39:31 2004 @@ -1,17 +1,15 @@ - phpLDAPadmin has been installed into: +%%PKGNAME%% has been installed into: - %%PREFIX%%/%%WWWDIR%% + %%PREFIX%%/%%PLADIR%% - Please copy config.php.example to config.php and edit to suit - your needs. +Please edit config.php and edit to suit your needs. - To make phpLDAPadmin available through your web site, I suggest - that you add the following to httpd.conf: +To make phpLDAPadmin available through your web site, +I suggest that you add the following to httpd.conf: - Alias /phpldapadmin/ "%%PREFIX%%/%%WWWDIR%%/" + Alias /phpldapadmin/ "%%PREFIX%%/%%PLADIR%%/" - You will need a version of PHP with LDAP functionality enabled, - which is not the default. If necessary, enable the 'OPENLDAP' - option in the www/mod_php4 port's configuration screen and - reinstall PHP. +You will need a version of PHP with LDAP functionality enabled, +which is not the default. If necessary, enable the 'OPENLDAP' +option in the PHP port's configuration screen and reinstall. diff -Nur /usr/ports/net/phpldapadmin/pkg-plist-chunk phpldapadmin/pkg-plist-chunk --- /usr/ports/net/phpldapadmin/pkg-plist-chunk Thu Jan 1 01:00:00 1970 +++ phpldapadmin/pkg-plist-chunk Mon May 17 14:53:54 2004 @@ -0,0 +1,7 @@ +@mode 640 +@group %%PLAGRP%% +@unexec if cmp -s %D/%%PLADIR%%/config.php.example %D/%%PLADIR%%/config.php ; then rm -f %D/%%PLADIR%%/config.php ; fi +%%PLADIR%%/config.php.example +@exec [ ! -f %B/config.php ] && cp -p %B/%f %B/config.php || true +@mode +@group --- phpldapadmin.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: