diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/phpldapadmin/Makefile | 85 | ||||
-rw-r--r-- | net/phpldapadmin/pkg-deinstall-suphp | 26 | ||||
-rw-r--r-- | net/phpldapadmin/pkg-install-suphp | 98 | ||||
-rw-r--r-- | net/phpldapadmin/pkg-message | 20 | ||||
-rw-r--r-- | net/phpldapadmin/pkg-plist-chunk | 7 | ||||
-rw-r--r-- | net/phpldapadmin098/Makefile | 85 | ||||
-rw-r--r-- | net/phpldapadmin098/pkg-deinstall-suphp | 26 | ||||
-rw-r--r-- | net/phpldapadmin098/pkg-install-suphp | 98 | ||||
-rw-r--r-- | net/phpldapadmin098/pkg-message | 20 | ||||
-rw-r--r-- | net/phpldapadmin098/pkg-plist-chunk | 7 |
10 files changed, 422 insertions, 50 deletions
diff --git a/net/phpldapadmin/Makefile b/net/phpldapadmin/Makefile index e6d92f49e342..6729dbf81bac 100644 --- a/net/phpldapadmin/Makefile +++ b/net/phpldapadmin/Makefile @@ -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 @@ MASTER_SITE_SUBDIR= phpldapadmin 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} - -do-install: + ${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: 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 @@ do-install: 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 <bsd.port.mk> diff --git a/net/phpldapadmin/pkg-deinstall-suphp b/net/phpldapadmin/pkg-deinstall-suphp new file mode 100644 index 000000000000..3e29ddb5febb --- /dev/null +++ b/net/phpldapadmin/pkg-deinstall-suphp @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +case $2 in + POST-DEINSTALL) + cat <<EOMSG +The phpldapadmin-suphp port has been deleted. +If you are not upgrading and don't intend to use +phpLDAPadmin any more then you may wish to delete +the %%PLAUSR%% account, which can be done with +the following command: + + # pw userdel %%PLAUSR%% +EOMSG + if [ -d %%PREFIX%%/%%PLADIR%% ] ; then + echo " # rm -rf %%PREFIX%%/%%PLADIR%%/" + fi + echo + ;; +esac + +# +# That's All Folks! +# diff --git a/net/phpldapadmin/pkg-install-suphp b/net/phpldapadmin/pkg-install-suphp new file mode 100644 index 000000000000..6348afacd7a6 --- /dev/null +++ b/net/phpldapadmin/pkg-install-suphp @@ -0,0 +1,98 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PATH=/usr/sbin:/usr/bin:/bin ; export PATH + +pladir=%%PREFIX%%/%%PLADIR%% +plausr=%%PLAUSR%% +plagrp=%%PLAGRP%% + +plagcos="phpLDAPadmin Owner" +plahome=/nonexistent +plashell=/sbin/nologin + +create_group() { + local user group gcos home shell + + user=$1 + group=$2 + gcos=$3 + home=$4 + shell=$5 + + if pw groupadd -n $group ; then + echo "===> 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 --git a/net/phpldapadmin/pkg-message b/net/phpldapadmin/pkg-message index f820d15624b0..d205563482e6 100644 --- a/net/phpldapadmin/pkg-message +++ b/net/phpldapadmin/pkg-message @@ -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 --git a/net/phpldapadmin/pkg-plist-chunk b/net/phpldapadmin/pkg-plist-chunk new file mode 100644 index 000000000000..29ae43a7b280 --- /dev/null +++ b/net/phpldapadmin/pkg-plist-chunk @@ -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 diff --git a/net/phpldapadmin098/Makefile b/net/phpldapadmin098/Makefile index e6d92f49e342..6729dbf81bac 100644 --- a/net/phpldapadmin098/Makefile +++ b/net/phpldapadmin098/Makefile @@ -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 @@ MASTER_SITE_SUBDIR= phpldapadmin 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} - -do-install: + ${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: 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 @@ do-install: 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 <bsd.port.mk> diff --git a/net/phpldapadmin098/pkg-deinstall-suphp b/net/phpldapadmin098/pkg-deinstall-suphp new file mode 100644 index 000000000000..3e29ddb5febb --- /dev/null +++ b/net/phpldapadmin098/pkg-deinstall-suphp @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +case $2 in + POST-DEINSTALL) + cat <<EOMSG +The phpldapadmin-suphp port has been deleted. +If you are not upgrading and don't intend to use +phpLDAPadmin any more then you may wish to delete +the %%PLAUSR%% account, which can be done with +the following command: + + # pw userdel %%PLAUSR%% +EOMSG + if [ -d %%PREFIX%%/%%PLADIR%% ] ; then + echo " # rm -rf %%PREFIX%%/%%PLADIR%%/" + fi + echo + ;; +esac + +# +# That's All Folks! +# diff --git a/net/phpldapadmin098/pkg-install-suphp b/net/phpldapadmin098/pkg-install-suphp new file mode 100644 index 000000000000..6348afacd7a6 --- /dev/null +++ b/net/phpldapadmin098/pkg-install-suphp @@ -0,0 +1,98 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PATH=/usr/sbin:/usr/bin:/bin ; export PATH + +pladir=%%PREFIX%%/%%PLADIR%% +plausr=%%PLAUSR%% +plagrp=%%PLAGRP%% + +plagcos="phpLDAPadmin Owner" +plahome=/nonexistent +plashell=/sbin/nologin + +create_group() { + local user group gcos home shell + + user=$1 + group=$2 + gcos=$3 + home=$4 + shell=$5 + + if pw groupadd -n $group ; then + echo "===> 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 --git a/net/phpldapadmin098/pkg-message b/net/phpldapadmin098/pkg-message index f820d15624b0..d205563482e6 100644 --- a/net/phpldapadmin098/pkg-message +++ b/net/phpldapadmin098/pkg-message @@ -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 --git a/net/phpldapadmin098/pkg-plist-chunk b/net/phpldapadmin098/pkg-plist-chunk new file mode 100644 index 000000000000..29ae43a7b280 --- /dev/null +++ b/net/phpldapadmin098/pkg-plist-chunk @@ -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 |