diff options
author | rafan <rafan@FreeBSD.org> | 2008-03-09 12:45:39 +0800 |
---|---|---|
committer | rafan <rafan@FreeBSD.org> | 2008-03-09 12:45:39 +0800 |
commit | 00588e012c54a44b2deb516801022f4f37fe5747 (patch) | |
tree | b4a3ef236ac77ef8f20e668b98ec1dc249a33bb8 /net | |
parent | 55e036ad907d272b54fbe267228f11f3c6ab9530 (diff) | |
download | freebsd-ports-gnome-00588e012c54a44b2deb516801022f4f37fe5747.tar.gz freebsd-ports-gnome-00588e012c54a44b2deb516801022f4f37fe5747.tar.zst freebsd-ports-gnome-00588e012c54a44b2deb516801022f4f37fe5747.zip |
- Use fixed UID when WITH_SUPHP
- Use WWWDIR for PLIST_SUB and SUB_LIST
- Various port clean-up
PR: ports/120505
Submitted by: Matthew Seaman <m.seaman at infracaninophile.co.uk> (maintainer)
Diffstat (limited to 'net')
-rw-r--r-- | net/phpldapadmin/Makefile | 82 | ||||
-rw-r--r-- | net/phpldapadmin/files/pkg-deinstall.in | 10 | ||||
-rw-r--r-- | net/phpldapadmin/files/pkg-install.in | 124 | ||||
-rw-r--r-- | net/phpldapadmin/files/pkg-message.in | 13 | ||||
-rw-r--r-- | net/phpldapadmin/pkg-plist-chunk | 6 | ||||
-rw-r--r-- | net/phpldapadmin098/Makefile | 84 | ||||
-rw-r--r-- | net/phpldapadmin098/files/pkg-deinstall.in | 10 | ||||
-rw-r--r-- | net/phpldapadmin098/files/pkg-install.in | 124 | ||||
-rw-r--r-- | net/phpldapadmin098/files/pkg-message.in | 10 | ||||
-rw-r--r-- | net/phpldapadmin098/pkg-plist-chunk | 6 |
10 files changed, 273 insertions, 196 deletions
diff --git a/net/phpldapadmin/Makefile b/net/phpldapadmin/Makefile index a14f573eeb18..b9a8451f5cb8 100644 --- a/net/phpldapadmin/Makefile +++ b/net/phpldapadmin/Makefile @@ -7,6 +7,7 @@ PORTNAME= phpldapadmin PORTVERSION= 1.1.0.5 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= net www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} @@ -21,36 +22,54 @@ USE_PHP= gettext ldap openssl pcre session xml DEFAULT_PHP_VER= 5 IGNORE_WITH_PHP= 4 -.if defined(WITH_SUPHP) +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) PKGNAMESUFFIX+= -suphp RUN_DEPENDS+= ${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp WANT_PHP_CGI= yes -PLAUSR?= pldapadm - -SUB_LIST+= PLAUSR=${PLAUSR} \ - PLAGRP=${PLAGRP} -SUB_FILES+= pkg-install pkg-deinstall - .else WANT_PHP_WEB= yes .endif -# PLAUSR is only used WITH_SUPHP -PLADIR?= www/${PORTNAME} -PLAGRP?= ${WWWGRP} +# PLA_USR is only used WITH_SUPHP +PLA_GRP?= ${WWWGRP} +PLA_GID?= ${_PLA_GID} CFGDIR= config CFGFILE= config.php -SUB_LIST+= PKGNAME=${PKGNAME} \ - PLADIR=${PLADIR} +PLIST= ${WRKDIR}/plist +PLIST_SUB+= PLA_GRP=${PLA_GRP} + +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + +PLA_USR?= _pla +PLA_UID?= 636 +PLA_GCOS?= "phpLDAPAdmin Owner" +PLA_HOME?= /nonexistent +PLA_SHELL?= /usr/sbin/nologin + +SUB_LIST+= PLA_USR=${PLA_USR} \ + PLA_UID=${PLA_UID} \ + PLA_GRP=${PLA_GRP} \ + PLA_GID=${PLA_GID} \ + PLA_GCOS=${PLA_GCOS} \ + PLA_HOME=${PLA_HOME} \ + PLA_SHELL=${PLA_SHELL} +SUB_FILES+= pkg-install pkg-deinstall + +.endif + +SUB_LIST+= PKGNAME=${PKGNAME} SUB_FILES+= pkg-message -PLIST= ${WRKDIR}/plist -PLIST_SUB+= PLADIR=${PLADIR} PLAGRP=${PLAGRP} +.include <bsd.port.pre.mk> +_PLA_GID!= /usr/sbin/pw group show -n ${PLA_GRP} | ${CUT} -d : -f 3 +.if empty(_PLA_GID) +_PLA_GID= 80 +.endif .SILENT: @@ -64,16 +83,25 @@ pre-everything:: ${ECHO_MSG} "This port is PHP5 specific. If you need PHP4 support," ${ECHO_MSG} "please use the net/phpldapadmin098 port instead." ${ECHO_MSG} "" +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + @if /usr/sbin/pw show -n pldapadm >/dev/null 2>&1 ; then \ + ${ECHO_MSG} "===> WARNING ******************************" ; \ + ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \ + ${ECHO_MSG} "to ${PLA_USR} -- you should delete the old user:" ; \ + ${ECHO_MSG} " # /usr/sbin/pw user del -n pldapadm" ; \ + ${ECHO_MSG} "" ; \ + fi +.endif post-patch: - cd ${WRKSRC} ; \ + cd ${WRKSRC} ; \ ${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore | \ - ${SORT} | ${SED} -e "s!^\.!%%PLADIR%%!" >${PLIST} ; \ - ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ - ${FIND} . -type d | ${SORT} -r | ${SED} \ - -e 's!^\./${CFGDIR}$$!@dirrmtry %%PLADIR%%/${CFGDIR}!' \ - -e 's!^\.$$!@dirrmtry %%PLADIR%%!' \ - -e 's!^\.!@dirrm %%PLADIR%%!' >>${PLIST} + ${SORT} | ${SED} -e "s!^\.!%%WWWDIR%%!" >${PLIST} ; \ + ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ + ${FIND} . -type d | ${SORT} -r | ${SED} \ + -e 's!^\./${CFGDIR}$$!@dirrmtry %%WWWDIR%%/${CFGDIR}!' \ + -e 's!^\.$$!@dirrmtry %%WWWDIR%%!' \ + -e 's!^\.!@dirrm %%WWWDIR%%!' >>${PLIST} pre-install: .if defined(WITH_SUPHP) @@ -85,18 +113,18 @@ do-install: install-app install-conf install-app: cd ${WRKSRC} ; \ for src in $$( ${FIND} . ! -name .cvsignore ) ; do \ - dst=${PREFIX}/${PLADIR}$${src#.} ; \ + dst=${WWWDIR}$${src#.} ; \ if ${TEST} -d $$src ; then \ - ${MKDIR} $$dst ; \ + ${MKDIR} $$dst ; \ else \ - ${INSTALL_DATA} $$src $$dst ; \ + ${INSTALL_DATA} $$src $$dst ; \ fi \ done install-conf: - cd ${PREFIX}/${PLADIR}/${CFGDIR} ; \ + cd ${WWWDIR}/${CFGDIR} ; \ ${CHMOD} 0640 ${CFGFILE}.example ; \ - ${CHGRP} ${PLAGRP} ${CFGFILE}.example ; \ + ${CHGRP} ${PLA_GRP} ${CFGFILE}.example ; \ if ${TEST} ! -f ${CFGFILE} ; then \ ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \ fi @@ -107,4 +135,4 @@ post-install: .endif ${CAT} ${PKGMESSAGE} -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/net/phpldapadmin/files/pkg-deinstall.in b/net/phpldapadmin/files/pkg-deinstall.in index cca9c556093d..8c531f2ea1e7 100644 --- a/net/phpldapadmin/files/pkg-deinstall.in +++ b/net/phpldapadmin/files/pkg-deinstall.in @@ -1,6 +1,6 @@ #!/bin/sh # -# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin/files/pkg-deinstall.in,v 1.1 2005-12-11 23:51:12 lawrance Exp $ +# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin/files/pkg-deinstall.in,v 1.2 2008-03-09 04:45:38 rafan Exp $ # case $2 in @@ -9,13 +9,13 @@ case $2 in 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 %%PLA_USR%% account, which can be done with the following command: - # pw userdel %%PLAUSR%% + # pw userdel %%PLA_USR%% EOMSG - if [ -d %%PREFIX%%/%%PLADIR%% ] ; then - echo " # rm -rf %%PREFIX%%/%%PLADIR%%/" + if [ -d %%WWWDIR%% ] ; then + echo " # rm -rf %%WWWDIR%%/" fi echo ;; diff --git a/net/phpldapadmin/files/pkg-install.in b/net/phpldapadmin/files/pkg-install.in index b56e32ad6767..ec4c871acb11 100644 --- a/net/phpldapadmin/files/pkg-install.in +++ b/net/phpldapadmin/files/pkg-install.in @@ -1,70 +1,87 @@ #!/bin/sh # -# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin/files/pkg-install.in,v 1.1 2005-12-11 23:51:12 lawrance Exp $ +# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin/files/pkg-install.in,v 1.2 2008-03-09 04:45:38 rafan Exp $ # PATH=/usr/sbin:/usr/bin:/bin ; export PATH -pladir=%%PREFIX%%/%%PLADIR%% -plausr=%%PLAUSR%% -plagrp=%%PLAGRP%% +pla_dir=%%WWWDIR%% +pla_usr=%%PLA_USR%% +pla_uid=%%PLA_UID%% +pla_grp=%%PLA_GRP%% +pla_gid=%%PLA_GID%% -plagcos="phpLDAPadmin Owner" -plahome=/nonexistent -plashell=/sbin/nologin +pla_gcos="%%PLA_GCOS%%" +pla_home=%%PLA_HOME%% +pla_shell=%%PLA_SHELL%% create_group() { - local user group gcos home shell + local user uid group gid gcos home shell user=$1 - group=$2 - gcos=$3 - home=$4 - shell=$5 + uid=$2 + group=$3 + gid=$4 + gcos=$5 + home=$6 + shell=$7 - if pw groupadd -n $group ; then - echo "===> Group $group created" + + if pw group show -n $group >/dev/null 2>&1 ; then + echo "===> Using pre-existing group $group" 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 + if pw groupadd -n $group -g $gid ; 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 -g $gid + pw useradd -n $user -u $uid -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi fi + } create_user() { - local user group gcos home shell + local user uid group gid 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" + uid=$2 + group=$3 + gid=$4 + gcos=$5 + home=$6 + shell=$7 + + if pw user show -n $user >/dev/null 2>&1 ; then + echo "===> Using pre-existing user $user" else - cat <<-EOERRORMSG - *** Failed to create the $user user. + if pw useradd -n $user -u $uid -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: + Please add the $user user manually with the command: - pw useradd -n $user -g $group -c "$gcos" \\ - -d $home -s $shell -h - + pw useradd -n $user -u $uid -g $group -c "$gcos" \\ + -d $home -s $shell -h - - and retry installing this package. - EOERRORMSG - exit 1 + and retry installing this package. + EOERRORMSG + exit 1 + fi fi } @@ -73,23 +90,18 @@ 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 + create_group $pla_usr $pla_uid $pla_grp $pla_gid \ + "$pla_gcos" $pla_home $pla_shell + create_user $pla_usr $pla_uid $pla_grp $pla_gid \ + "$pla_gcos" $pla_home $pla_shell ;; + POST-INSTALL) - # Change ownership of the phpLDAPadmin directory + # Change ownership of the phpMyAdm directory - echo "===> Adjusting file ownership in $pladir" - chown -R $plausr:$plagrp $pladir || exit 1 + echo "===> Adjusting file ownership in $pla_dir" + chown -R $pla_usr:$pla_grp $pla_dir || exit 1 ;; esac diff --git a/net/phpldapadmin/files/pkg-message.in b/net/phpldapadmin/files/pkg-message.in index 2043e40b38b4..f1425b31beea 100644 --- a/net/phpldapadmin/files/pkg-message.in +++ b/net/phpldapadmin/files/pkg-message.in @@ -1,16 +1,16 @@ %%PKGNAME%% has been installed into: - %%PREFIX%%/%%PLADIR%% + %%WWWDIR%% Please edit config.php to suit your needs. To make phpLDAPadmin available through your web site, I suggest that -you add something like following to httpd.conf: +you add something like the following to httpd.conf: - Alias /phpldapadmin/ "%%PREFIX%%/%%PLADIR%%/htdocs" + Alias /phpldapadmin/ "%%WWWDIR%%/htdocs" - <Directory "%%PREFIX%%/%%PLADIR%%/htdocs"> + <Directory "%%WWWDIR%%/htdocs"> Options none AllowOverride none @@ -24,10 +24,9 @@ layout of the %%PKGNAME%% files has been completely reworked. You will need to modify your apache configuration and merge the settings from your original configuration file: - %%PREFIX%%/%%PLADIR%%/config.php + %%WWWDIR%%/config.php to - %%PREFIX%%/%%PLADIR%%/config/config.php - + %%WWWDIR%%/config/config.php diff --git a/net/phpldapadmin/pkg-plist-chunk b/net/phpldapadmin/pkg-plist-chunk index 8a9de645dd50..cde3f0c85ca3 100644 --- a/net/phpldapadmin/pkg-plist-chunk +++ b/net/phpldapadmin/pkg-plist-chunk @@ -1,7 +1,7 @@ @mode 640 -@group %%PLAGRP%% -@unexec if cmp -s %D/%%PLADIR%%/config/config.php.example %D/%%PLADIR%%/config/config.php ; then rm -f %D/%%PLADIR%%/config/config.php ; fi -%%PLADIR%%/config/config.php.example +@group %%PLA_GRP%% +@unexec if cmp -s %D/%%WWWDIR%%/config/config.php.example %D/%%WWWDIR%%/config/config.php ; then rm -f %D/%%WWWDIR%%/config/config.php ; fi +%%WWWDIR%%/config/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 b57ac62913bc..167eadbceba0 100644 --- a/net/phpldapadmin098/Makefile +++ b/net/phpldapadmin098/Makefile @@ -7,6 +7,7 @@ PORTNAME= phpldapadmin098 PORTVERSION= 0.9.8.4 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= net www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} @@ -20,38 +21,54 @@ NO_BUILD= yes USE_PHP= gettext ldap openssl pcre session DEFAULT_PHP_VER= 4 -.if defined(WITH_SUPHP) +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) PKGNAMESUFFIX+= -suphp RUN_DEPENDS+= ${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp WANT_PHP_CGI= yes -PLAUSR?= pldapadm - -SUB_LIST+= PLAUSR=${PLAUSR} \ - PLAGRP=${PLAGRP} -SUB_FILES+= pkg-install pkg-deinstall - .else WANT_PHP_WEB= yes .endif -# PLAUSR is only used WITH_SUPHP -PLADIR?= www/${PORTNAME} -PLADIRX?= ${PLADIR:S/098//} -PLAGRP?= ${WWWGRP} +# PLA_USR is only used WITH_SUPHP +PLA_GRP?= ${WWWGRP} +PLA_GID?= ${_PLA_GID} CFGDIR= config CFGFILE= config.php -SUB_LIST+= PKGNAME=${PKGNAME} \ - PLADIR=${PLADIR} \ - PLADIRX=${PLADIRX} +PLIST= ${WRKDIR}/plist +PLIST_SUB+= PLA_GRP=${PLA_GRP} + +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + +PLA_USR?= _pla +PLA_UID?= 636 +PLA_GCOS?= "phpLDAPAdmin Owner" +PLA_HOME?= /nonexistent +PLA_SHELL?= /usr/sbin/nologin + +SUB_LIST+= PLA_USR=${PLA_USR} \ + PLA_UID=${PLA_UID} \ + PLA_GRP=${PLA_GRP} \ + PLA_GID=${PLA_GID} \ + PLA_GCOS=${PLA_GCOS} \ + PLA_HOME=${PLA_HOME} \ + PLA_SHELL=${PLA_SHELL} +SUB_FILES+= pkg-install pkg-deinstall + +.endif + +SUB_LIST+= PKGNAME=${PKGNAME} SUB_FILES+= pkg-message -PLIST= ${WRKDIR}/plist -PLIST_SUB+= PLADIR=${PLADIR} PLAGRP=${PLAGRP} +.include <bsd.port.pre.mk> +_PLA_GID!= /usr/sbin/pw group show -n ${PLA_GRP} | ${CUT} -d : -f 3 +.if empty(_PLA_GID) +_PLA_GID= 80 +.endif .SILENT: @@ -66,16 +83,25 @@ pre-everything:: ${ECHO_MSG} "However, for best results with PHP5 please use the" ${ECHO_MSG} "net/phpldapadmin port instead." ${ECHO_MSG} "" +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + @if /usr/sbin/pw show -n pldapadm >/dev/null 2>&1 ; then \ + ${ECHO_MSG} "===> WARNING ******************************" ; \ + ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \ + ${ECHO_MSG} "to ${PLA_USR} -- you should delete the old user:" ; \ + ${ECHO_MSG} " # /usr/sbin/pw user del -n pldapadm" ; \ + ${ECHO_MSG} "" ; \ + fi +.endif post-patch: - cd ${WRKSRC} ; \ + cd ${WRKSRC} ; \ ${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore | \ - ${SORT} | ${SED} -e "s!^\.!%%PLADIR%%!" >${PLIST} ; \ - ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ - ${FIND} . -type d | ${SORT} -r | ${SED} \ - -e 's!^\./${CFGDIR}$$!@dirrmtry %%PLADIR%%/${CFGDIR}!' \ - -e 's!^\.$$!@dirrmtry %%PLADIR%%!' \ - -e 's!^\.!@dirrm %%PLADIR%%!' >>${PLIST} + ${SORT} | ${SED} -e "s!^\.!%%WWWDIR%%!" >${PLIST} ; \ + ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ + ${FIND} . -type d | ${SORT} -r | ${SED} \ + -e 's!^\./${CFGDIR}$$!@dirrmtry %%WWWDIR%%/${CFGDIR}!' \ + -e 's!^\.$$!@dirrmtry %%WWWDIR%%!' \ + -e 's!^\.!@dirrm %%WWWDIR%%!' >>${PLIST} pre-install: .if defined(WITH_SUPHP) @@ -87,18 +113,18 @@ do-install: install-app install-conf install-app: cd ${WRKSRC} ; \ for src in $$( ${FIND} . ! -name .cvsignore ) ; do \ - dst=${PREFIX}/${PLADIR}$${src#.} ; \ + dst=${WWWDIR}$${src#.} ; \ if ${TEST} -d $$src ; then \ - ${MKDIR} $$dst ; \ + ${MKDIR} $$dst ; \ else \ - ${INSTALL_DATA} $$src $$dst ; \ + ${INSTALL_DATA} $$src $$dst ; \ fi \ done install-conf: - cd ${PREFIX}/${PLADIR}/${CFGDIR} ; \ + cd ${WWWDIR}/${CFGDIR} ; \ ${CHMOD} 0640 ${CFGFILE}.example ; \ - ${CHGRP} ${PLAGRP} ${CFGFILE}.example ; \ + ${CHGRP} ${PLA_GRP} ${CFGFILE}.example ; \ if ${TEST} ! -f ${CFGFILE} ; then \ ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \ fi @@ -109,4 +135,4 @@ post-install: .endif ${CAT} ${PKGMESSAGE} -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/net/phpldapadmin098/files/pkg-deinstall.in b/net/phpldapadmin098/files/pkg-deinstall.in index 79aa1f894cc8..3231a32ddff6 100644 --- a/net/phpldapadmin098/files/pkg-deinstall.in +++ b/net/phpldapadmin098/files/pkg-deinstall.in @@ -1,6 +1,6 @@ #!/bin/sh # -# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin098/files/Attic/pkg-deinstall.in,v 1.1 2005-12-11 23:51:12 lawrance Exp $ +# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin098/files/Attic/pkg-deinstall.in,v 1.2 2008-03-09 04:45:39 rafan Exp $ # case $2 in @@ -9,13 +9,13 @@ case $2 in 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 %%PLA_USR%% account, which can be done with the following command: - # pw userdel %%PLAUSR%% + # pw userdel %%PLA_USR%% EOMSG - if [ -d %%PREFIX%%/%%PLADIR%% ] ; then - echo " # rm -rf %%PREFIX%%/%%PLADIR%%/" + if [ -d %%WWWDIR%% ] ; then + echo " # rm -rf %%WWWDIR%%/" fi echo ;; diff --git a/net/phpldapadmin098/files/pkg-install.in b/net/phpldapadmin098/files/pkg-install.in index 853f54b955e2..6a502261cfa1 100644 --- a/net/phpldapadmin098/files/pkg-install.in +++ b/net/phpldapadmin098/files/pkg-install.in @@ -1,70 +1,87 @@ #!/bin/sh # -# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin098/files/Attic/pkg-install.in,v 1.1 2005-12-11 23:51:12 lawrance Exp $ +# $FreeBSD: /tmp/pcvs/ports/net/phpldapadmin098/files/Attic/pkg-install.in,v 1.2 2008-03-09 04:45:39 rafan Exp $ # PATH=/usr/sbin:/usr/bin:/bin ; export PATH -pladir=%%PREFIX%%/%%PLADIR%% -plausr=%%PLAUSR%% -plagrp=%%PLAGRP%% +pla_dir=%%WWWDIR%% +pla_usr=%%PLA_USR%% +pla_uid=%%PLA_UID%% +pla_grp=%%PLA_GRP%% +pla_gid=%%PLA_GID%% -plagcos="phpLDAPadmin Owner" -plahome=/nonexistent -plashell=/sbin/nologin +pla_gcos="%%PLA_GCOS%%" +pla_home=%%PLA_HOME%% +pla_shell=%%PLA_SHELL%% create_group() { - local user group gcos home shell + local user uid group gid gcos home shell user=$1 - group=$2 - gcos=$3 - home=$4 - shell=$5 + uid=$2 + group=$3 + gid=$4 + gcos=$5 + home=$6 + shell=$7 - if pw groupadd -n $group ; then - echo "===> Group $group created" + + if pw group show -n $group >/dev/null 2>&1 ; then + echo "===> Using pre-existing group $group" 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 + if pw groupadd -n $group -g $gid ; 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 -g $gid + pw useradd -n $user -u $uid -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi fi + } create_user() { - local user group gcos home shell + local user uid group gid 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" + uid=$2 + group=$3 + gid=$4 + gcos=$5 + home=$6 + shell=$7 + + if pw user show -n $user >/dev/null 2>&1 ; then + echo "===> Using pre-existing user $user" else - cat <<-EOERRORMSG - *** Failed to create the $user user. + if pw useradd -n $user -u $uid -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: + Please add the $user user manually with the command: - pw useradd -n $user -g $group -c "$gcos" \\ - -d $home -s $shell -h - + pw useradd -n $user -u $uid -g $group -c "$gcos" \\ + -d $home -s $shell -h - - and retry installing this package. - EOERRORMSG - exit 1 + and retry installing this package. + EOERRORMSG + exit 1 + fi fi } @@ -73,23 +90,18 @@ 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 + create_group $pla_usr $pla_uid $pla_grp $pla_gid \ + "$pla_gcos" $pla_home $pla_shell + create_user $pla_usr $pla_uid $pla_grp $pla_gid \ + "$pla_gcos" $pla_home $pla_shell ;; + POST-INSTALL) - # Change ownership of the phpLDAPadmin directory + # Change ownership of the phpMyAdm directory - echo "===> Adjusting file ownership in $pladir" - chown -R $plausr:$plagrp $pladir || exit 1 + echo "===> Adjusting file ownership in $pla_dir" + chown -R $pla_usr:$pla_grp $pla_dir || exit 1 ;; esac diff --git a/net/phpldapadmin098/files/pkg-message.in b/net/phpldapadmin098/files/pkg-message.in index a181a6e0bda9..d6d09e0d44dc 100644 --- a/net/phpldapadmin098/files/pkg-message.in +++ b/net/phpldapadmin098/files/pkg-message.in @@ -1,16 +1,16 @@ %%PKGNAME%% has been installed into: - %%PREFIX%%/%%PLADIR%% + %%WWWDIR%% Please edit config.php to suit your needs. To make phpLDAPadmin available through your web site, I suggest that you add something like the following to httpd.conf: - Alias /phpldapadmin/ "%%PREFIX%%/%%PLADIR%%/htdocs" + Alias /phpldapadmin/ "%%WWWDIR%%/htdocs" - <Directory "%%PREFIX%%/%%PLADIR%%/htdocs"> + <Directory "%%WWWDIR%%/htdocs"> Options none AllowOverride none @@ -24,10 +24,10 @@ layout of the %%PKGNAME%% files has been completely reworked. You will need to modify your apache configuration and merge the settings from your original configuration file: - %%PREFIX%%/%%PLADIRX%%/config.php + %%WWWDIR%%/config.php to - %%PREFIX%%/%%PLADIR%%/config/config.php + %%WWWDIR%%/config/config.php diff --git a/net/phpldapadmin098/pkg-plist-chunk b/net/phpldapadmin098/pkg-plist-chunk index 8a9de645dd50..cde3f0c85ca3 100644 --- a/net/phpldapadmin098/pkg-plist-chunk +++ b/net/phpldapadmin098/pkg-plist-chunk @@ -1,7 +1,7 @@ @mode 640 -@group %%PLAGRP%% -@unexec if cmp -s %D/%%PLADIR%%/config/config.php.example %D/%%PLADIR%%/config/config.php ; then rm -f %D/%%PLADIR%%/config/config.php ; fi -%%PLADIR%%/config/config.php.example +@group %%PLA_GRP%% +@unexec if cmp -s %D/%%WWWDIR%%/config/config.php.example %D/%%WWWDIR%%/config/config.php ; then rm -f %D/%%WWWDIR%%/config/config.php ; fi +%%WWWDIR%%/config/config.php.example @exec [ ! -f %B/config.php ] && cp -p %B/%f %B/config.php || true @mode @group |