diff options
author | miwi <miwi@FreeBSD.org> | 2008-01-21 18:58:20 +0800 |
---|---|---|
committer | miwi <miwi@FreeBSD.org> | 2008-01-21 18:58:20 +0800 |
commit | 8b52b838abd5934e0d829d2a1fbc99fb18b15ea8 (patch) | |
tree | 158d49484c7011f22a1020d24a4fe75b00e7f953 /databases | |
parent | da7449ba638c8f29715e83753dc4fe52d2b4b627 (diff) | |
download | freebsd-ports-gnome-8b52b838abd5934e0d829d2a1fbc99fb18b15ea8.tar.gz freebsd-ports-gnome-8b52b838abd5934e0d829d2a1fbc99fb18b15ea8.tar.zst freebsd-ports-gnome-8b52b838abd5934e0d829d2a1fbc99fb18b15ea8.zip |
Changes:
* When installed using WITH_SUPHP use a fix username/UID from
/usr/ports/UIDs. There's no equivalent /usr/ports/GIDs entry
because it defaults to group 'www'.
* Consequently change the default username from phpmyadm to _pma
and add an entry to /usr/ports/UIDs:
_pma:*:336:80:phpMyAdmin Owner:/nonexistent:/sbin/nologin
* Use the standard $WWWDIR for PLIST_SUB and SUB_LIST, instead of
rolling my own equivalent.
* Various internal code changes and clean-up
* Bump PORTREVISION
Note: the changes here mostly affect compilation with WITH_SUPHP
defined. If you're not a suPHP user, then there's very little
ultimately that has changed.
PR: 119825
Submitted by: Matthew Seaman <m.seaman@infracaninophile.co.uk> (maintainer)
Diffstat (limited to 'databases')
-rw-r--r-- | databases/phpmyadmin/Makefile | 76 | ||||
-rw-r--r-- | databases/phpmyadmin/files/pkg-deinstall.in | 8 | ||||
-rw-r--r-- | databases/phpmyadmin/files/pkg-install.in | 116 | ||||
-rw-r--r-- | databases/phpmyadmin/files/pkg-message.in | 6 | ||||
-rw-r--r-- | databases/phpmyadmin/pkg-plist-chunk | 6 | ||||
-rw-r--r-- | databases/phpmyadmin211/Makefile | 76 | ||||
-rw-r--r-- | databases/phpmyadmin211/files/pkg-deinstall.in | 8 | ||||
-rw-r--r-- | databases/phpmyadmin211/files/pkg-install.in | 116 | ||||
-rw-r--r-- | databases/phpmyadmin211/files/pkg-message.in | 6 | ||||
-rw-r--r-- | databases/phpmyadmin211/pkg-plist-chunk | 6 |
10 files changed, 254 insertions, 170 deletions
diff --git a/databases/phpmyadmin/Makefile b/databases/phpmyadmin/Makefile index fdc12db6fdfd..79b048557ec7 100644 --- a/databases/phpmyadmin/Makefile +++ b/databases/phpmyadmin/Makefile @@ -7,6 +7,7 @@ PORTNAME= phpMyAdmin DISTVERSION= 2.11.4 +PORTREVISION= 1 CATEGORIES= databases www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= phpmyadmin @@ -21,10 +22,6 @@ NO_BUILD= yes USE_PHP= ctype mysql pcre session .endif -SUB_LIST+= "MYADMDIR=${MYADMDIR}" \ - "PKGNAME=${PKGNAME}" -SUB_FILES= pkg-message - # Unfortunately can't make WITH_SUPHP part of the OPTIONS selection, # since it has to be processed before just about anything else. @@ -34,18 +31,43 @@ PKGNAMESUFFIX= -suphp RUN_DEPENDS+= ${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp WANT_PHP_CGI= yes -MYADMUSR?= phpmyadm - -SUB_LIST+= "MYADMUSR=${MYADMUSR}" \ - "MYADMGRP=${MYADMGRP}" -SUB_FILES+= pkg-install pkg-deinstall - .else WANT_PHP_WEB= yes .endif +# PMA_USR is only used WITH_SUPHP + +PMA_GRP?= ${WWWGRP} +PMA_GID?= ${_PMA_GID} +CFGFILE= config.inc.php + +PLIST= ${WRKDIR}/plist +PLIST_SUB+= PMA_GRP=${PMA_GRP} + +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + +PMA_USR?= _pma +PMA_UID?= 336 +PMA_GCOS?= "phpMyAdmin Owner" +PMA_HOME?= /nonexistent +PMA_SHELL?= /sbin/nologin + +SUB_LIST+= PMA_USR=${PMA_USR} \ + PMA_UID=${PMA_UID} \ + PMA_GRP=${PMA_GRP} \ + PMA_GID=${PMA_GID} \ + PMA_GCOS=${PMA_GCOS} \ + PMA_HOME=${PMA_HOME} \ + PMA_SHELL=${PMA_SHELL} +SUB_FILES+= pkg-install pkg-deinstall + +.endif + +SUB_LIST+= PKGNAME=${PKGNAME} +SUB_FILES+= pkg-message + # Copy the way lang/php{4,5}-extensions deals with its OPTIONS -- avoids # problems with include of bsd.port.pre.mk @@ -82,13 +104,12 @@ USE_PHP+= ${opt:L} .endfor .endif -# MYADMUSR is only used WITH_SUPHP -MYADMDIR?= www/phpMyAdmin -MYADMGRP?= ${WWWGRP} -CFGFILE= config.inc.php +.include <bsd.port.pre.mk> -PLIST= ${WRKDIR}/plist -PLIST_SUB+= MYADMDIR=${MYADMDIR} MYADMGRP=${MYADMGRP} +_PMA_GID!= /usr/sbin/pw group show -n ${PMA_GRP} | ${CUT} -d : -f 3 +.if empty(_PMA_GID) +_PMA_GID= 80 +.endif .SILENT: @@ -109,6 +130,15 @@ pre-everything:: ${ECHO_MSG} "install lang/php4 before attempting to install" ${ECHO_MSG} "databases/phpmyadmin" ${ECHO_MSG} "" +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + @if /usr/sbin/pw show -n phpmyadm >/dev/null 2>&1 ; then \ + ${ECHO_MSG} "===> WARNING ******************************" ; \ + ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \ + ${ECHO_MSG} "to ${PMA_USR} -- you should delete the old user:" ; \ + ${ECHO_MSG} " # /usr/sbin/pw user del -n phpmyadm" ; \ + ${ECHO_MSG} "" ; \ + fi +.endif # When creating a package, empty directories will not be generated # from the pkg tarball. Therefore make sure no directories are empty. @@ -121,11 +151,11 @@ post-patch: ${CP} ${FILESDIR}/${CFGFILE}.sample ${WRKSRC}/${CFGFILE}.sample cd ${WRKSRC} ; \ ${FIND} . ! -type d ! -name ${CFGFILE}.sample | ${SORT} | \ - ${SED} -e "s,^\.,%%MYADMDIR%%," >${PLIST} ; \ + ${SED} -e "s,^\.,%%WWWDIR%%," >${PLIST} ; \ ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ ${FIND} . -type d | ${SORT} -r | ${SED} \ - -e "s,^\.$$,@dirrmtry %%MYADMDIR%%," \ - -e "s,^\.,@dirrm %%MYADMDIR%%," >>${PLIST} + -e "s,^\.$$,@dirrmtry %%WWWDIR%%," \ + -e "s,^\.,@dirrm %%WWWDIR%%," >>${PLIST} pre-install: .if defined(WITH_SUPHP) @@ -137,7 +167,7 @@ do-install: install-app install-conf install-app: cd ${WRKSRC} ; \ for src in $$( ${FIND} . ! -name .cvsignore ) ; do \ - dst=${PREFIX}/${MYADMDIR}$${src#.} ; \ + dst=${WWWDIR}$${src#.} ; \ if ${TEST} -d $$src ; then \ ${MKDIR} $$dst ; \ else \ @@ -146,9 +176,9 @@ install-app: done install-conf: install-app - cd ${PREFIX}/${MYADMDIR} ; \ + cd ${WWWDIR} ; \ ${CHMOD} 0640 ${CFGFILE}.sample ; \ - ${CHGRP} ${MYADMGRP} ${CFGFILE}.sample ; \ + ${CHGRP} ${PMA_GRP} ${CFGFILE}.sample ; \ if ${TEST} ! -f ${CFGFILE} ; then \ ${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \ fi @@ -159,4 +189,4 @@ post-install: .endif ${CAT} ${PKGMESSAGE} -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/databases/phpmyadmin/files/pkg-deinstall.in b/databases/phpmyadmin/files/pkg-deinstall.in index 4962506b4e26..83204b698c11 100644 --- a/databases/phpmyadmin/files/pkg-deinstall.in +++ b/databases/phpmyadmin/files/pkg-deinstall.in @@ -9,13 +9,13 @@ case $2 in The phpMyAdmin-suphp port has been deleted. If you are not upgrading and don't intend to use phpMyAdmin any more then you may wish to delete -the %%MYADMUSR%% account, which can be done with +the %%PMA_USR%% account, which can be done with the following command: - # pw userdel %%MYADMUSR%% + # pw userdel %%PMA_USR%% EOMSG - if [ -d %%PREFIX%%/%%MYADMDIR%% ] ; then - echo " # rm -rf %%PREFIX%%/%%MYADMDIR%%/" + if [ -d %%WWWDIR%% ] ; then + echo " # rm -rf %%WWWDIR%%/" fi echo ;; diff --git a/databases/phpmyadmin/files/pkg-install.in b/databases/phpmyadmin/files/pkg-install.in index bb4180b2660f..b8adfb92959b 100644 --- a/databases/phpmyadmin/files/pkg-install.in +++ b/databases/phpmyadmin/files/pkg-install.in @@ -5,66 +5,83 @@ PATH=/usr/sbin:/usr/bin:/bin ; export PATH -myadmdir=%%PREFIX%%/%%MYADMDIR%% -myadmusr=%%MYADMUSR%% -myadmgrp=%%MYADMGRP%% +pma_dir=%%WWWDIR%% +pma_usr=%%PMA_USR%% +pma_uid=%%PMA_UID%% +pma_grp=%%PMA_GRP%% +pma_gid=%%PMA_GID%% -myadmgcos="phpMyAdmin Owner" -myadmhome=/nonexistent -myadmshell=/sbin/nologin +pma_gcos="%%PMA_GCOS%%" +pma_home=%%PMA_HOME%% +pma_shell=%%PMA_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. + 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: + 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 - + 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 + 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 } @@ -72,24 +89,19 @@ create_user() { case $2 in PRE-INSTALL) - # Create the myadm user and group if they do not already exist - - if pw user show -n $myadmusr >/dev/null 2>&1 ; then - echo "===> Using pre-existing user $myadmusr" - else - if ! pw group show -n $myadmgrp >/dev/null 2>&1 ; then - create_group $myadmusr $myadmgrp "$myadmgcos" $myadmhome \ - $myadmshell - fi - create_user $myadmusr $myadmgrp "$myadmgcos" $myadmhome $myadmshell - fi + # Create the pma user and group if they do not already exist + create_group $pma_usr $pma_uid $pma_grp $pma_gid \ + "$pma_gcos" $pma_home $pma_shell + create_user $pma_usr $pma_uid $pma_grp $pma_gid \ + "$pma_gcos" $pma_home $pma_shell ;; + POST-INSTALL) # Change ownership of the phpMyAdm directory - echo "===> Adjusting file ownership in $myadmdir" - chown -R $myadmusr:$myadmgrp $myadmdir || exit 1 + echo "===> Adjusting file ownership in $pma_dir" + chown -R $pma_usr:$pma_grp $pma_dir || exit 1 ;; esac diff --git a/databases/phpmyadmin/files/pkg-message.in b/databases/phpmyadmin/files/pkg-message.in index 34fbb55d1919..152f150c8762 100644 --- a/databases/phpmyadmin/files/pkg-message.in +++ b/databases/phpmyadmin/files/pkg-message.in @@ -1,16 +1,16 @@ %%PKGNAME%% has been installed into: - %%PREFIX%%/%%MYADMDIR%% + %%WWWDIR%% Please edit config.inc.php to suit your needs. To make phpMyAdmin available through your web site, I suggest that you add something like the following to httpd.conf: - Alias /phpmyadmin/ "%%PREFIX%%/%%MYADMDIR%%/" + Alias /phpmyadmin/ "%%WWWDIR%%/" - <Directory "%%PREFIX%%/%%MYADMDIR%%/"> + <Directory "%%WWWDIR%%/"> Options none AllowOverride Limit diff --git a/databases/phpmyadmin/pkg-plist-chunk b/databases/phpmyadmin/pkg-plist-chunk index 271eb110d237..3c6168e40dd6 100644 --- a/databases/phpmyadmin/pkg-plist-chunk +++ b/databases/phpmyadmin/pkg-plist-chunk @@ -1,7 +1,7 @@ @mode 640 -@group %%MYADMGRP%% -@unexec if cmp -s %D/%%MYADMDIR%%/config.inc.php.sample %D/%%MYADMDIR%%/config.inc.php ; then rm -f %D/%%MYADMDIR%%/config.inc.php ; fi -%%MYADMDIR%%/config.inc.php.sample +@group %%PMA_GRP%% +@unexec if cmp -s %D/%%WWWDIR%%/config.inc.php.sample %D/%%WWWDIR%%/config.inc.php ; then rm -f %D/%%WWWDIR%%/config.inc.php ; fi +%%WWWDIR%%/config.inc.php.sample @exec [ ! -f %B/config.inc.php ] && cp -p %B/%f %B/config.inc.php || true @mode @group diff --git a/databases/phpmyadmin211/Makefile b/databases/phpmyadmin211/Makefile index fdc12db6fdfd..79b048557ec7 100644 --- a/databases/phpmyadmin211/Makefile +++ b/databases/phpmyadmin211/Makefile @@ -7,6 +7,7 @@ PORTNAME= phpMyAdmin DISTVERSION= 2.11.4 +PORTREVISION= 1 CATEGORIES= databases www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= phpmyadmin @@ -21,10 +22,6 @@ NO_BUILD= yes USE_PHP= ctype mysql pcre session .endif -SUB_LIST+= "MYADMDIR=${MYADMDIR}" \ - "PKGNAME=${PKGNAME}" -SUB_FILES= pkg-message - # Unfortunately can't make WITH_SUPHP part of the OPTIONS selection, # since it has to be processed before just about anything else. @@ -34,18 +31,43 @@ PKGNAMESUFFIX= -suphp RUN_DEPENDS+= ${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp WANT_PHP_CGI= yes -MYADMUSR?= phpmyadm - -SUB_LIST+= "MYADMUSR=${MYADMUSR}" \ - "MYADMGRP=${MYADMGRP}" -SUB_FILES+= pkg-install pkg-deinstall - .else WANT_PHP_WEB= yes .endif +# PMA_USR is only used WITH_SUPHP + +PMA_GRP?= ${WWWGRP} +PMA_GID?= ${_PMA_GID} +CFGFILE= config.inc.php + +PLIST= ${WRKDIR}/plist +PLIST_SUB+= PMA_GRP=${PMA_GRP} + +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + +PMA_USR?= _pma +PMA_UID?= 336 +PMA_GCOS?= "phpMyAdmin Owner" +PMA_HOME?= /nonexistent +PMA_SHELL?= /sbin/nologin + +SUB_LIST+= PMA_USR=${PMA_USR} \ + PMA_UID=${PMA_UID} \ + PMA_GRP=${PMA_GRP} \ + PMA_GID=${PMA_GID} \ + PMA_GCOS=${PMA_GCOS} \ + PMA_HOME=${PMA_HOME} \ + PMA_SHELL=${PMA_SHELL} +SUB_FILES+= pkg-install pkg-deinstall + +.endif + +SUB_LIST+= PKGNAME=${PKGNAME} +SUB_FILES+= pkg-message + # Copy the way lang/php{4,5}-extensions deals with its OPTIONS -- avoids # problems with include of bsd.port.pre.mk @@ -82,13 +104,12 @@ USE_PHP+= ${opt:L} .endfor .endif -# MYADMUSR is only used WITH_SUPHP -MYADMDIR?= www/phpMyAdmin -MYADMGRP?= ${WWWGRP} -CFGFILE= config.inc.php +.include <bsd.port.pre.mk> -PLIST= ${WRKDIR}/plist -PLIST_SUB+= MYADMDIR=${MYADMDIR} MYADMGRP=${MYADMGRP} +_PMA_GID!= /usr/sbin/pw group show -n ${PMA_GRP} | ${CUT} -d : -f 3 +.if empty(_PMA_GID) +_PMA_GID= 80 +.endif .SILENT: @@ -109,6 +130,15 @@ pre-everything:: ${ECHO_MSG} "install lang/php4 before attempting to install" ${ECHO_MSG} "databases/phpmyadmin" ${ECHO_MSG} "" +.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP) + @if /usr/sbin/pw show -n phpmyadm >/dev/null 2>&1 ; then \ + ${ECHO_MSG} "===> WARNING ******************************" ; \ + ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \ + ${ECHO_MSG} "to ${PMA_USR} -- you should delete the old user:" ; \ + ${ECHO_MSG} " # /usr/sbin/pw user del -n phpmyadm" ; \ + ${ECHO_MSG} "" ; \ + fi +.endif # When creating a package, empty directories will not be generated # from the pkg tarball. Therefore make sure no directories are empty. @@ -121,11 +151,11 @@ post-patch: ${CP} ${FILESDIR}/${CFGFILE}.sample ${WRKSRC}/${CFGFILE}.sample cd ${WRKSRC} ; \ ${FIND} . ! -type d ! -name ${CFGFILE}.sample | ${SORT} | \ - ${SED} -e "s,^\.,%%MYADMDIR%%," >${PLIST} ; \ + ${SED} -e "s,^\.,%%WWWDIR%%," >${PLIST} ; \ ${CAT} ${PKGDIR}/pkg-plist-chunk >>${PLIST} ; \ ${FIND} . -type d | ${SORT} -r | ${SED} \ - -e "s,^\.$$,@dirrmtry %%MYADMDIR%%," \ - -e "s,^\.,@dirrm %%MYADMDIR%%," >>${PLIST} + -e "s,^\.$$,@dirrmtry %%WWWDIR%%," \ + -e "s,^\.,@dirrm %%WWWDIR%%," >>${PLIST} pre-install: .if defined(WITH_SUPHP) @@ -137,7 +167,7 @@ do-install: install-app install-conf install-app: cd ${WRKSRC} ; \ for src in $$( ${FIND} . ! -name .cvsignore ) ; do \ - dst=${PREFIX}/${MYADMDIR}$${src#.} ; \ + dst=${WWWDIR}$${src#.} ; \ if ${TEST} -d $$src ; then \ ${MKDIR} $$dst ; \ else \ @@ -146,9 +176,9 @@ install-app: done install-conf: install-app - cd ${PREFIX}/${MYADMDIR} ; \ + cd ${WWWDIR} ; \ ${CHMOD} 0640 ${CFGFILE}.sample ; \ - ${CHGRP} ${MYADMGRP} ${CFGFILE}.sample ; \ + ${CHGRP} ${PMA_GRP} ${CFGFILE}.sample ; \ if ${TEST} ! -f ${CFGFILE} ; then \ ${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \ fi @@ -159,4 +189,4 @@ post-install: .endif ${CAT} ${PKGMESSAGE} -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/databases/phpmyadmin211/files/pkg-deinstall.in b/databases/phpmyadmin211/files/pkg-deinstall.in index 4962506b4e26..83204b698c11 100644 --- a/databases/phpmyadmin211/files/pkg-deinstall.in +++ b/databases/phpmyadmin211/files/pkg-deinstall.in @@ -9,13 +9,13 @@ case $2 in The phpMyAdmin-suphp port has been deleted. If you are not upgrading and don't intend to use phpMyAdmin any more then you may wish to delete -the %%MYADMUSR%% account, which can be done with +the %%PMA_USR%% account, which can be done with the following command: - # pw userdel %%MYADMUSR%% + # pw userdel %%PMA_USR%% EOMSG - if [ -d %%PREFIX%%/%%MYADMDIR%% ] ; then - echo " # rm -rf %%PREFIX%%/%%MYADMDIR%%/" + if [ -d %%WWWDIR%% ] ; then + echo " # rm -rf %%WWWDIR%%/" fi echo ;; diff --git a/databases/phpmyadmin211/files/pkg-install.in b/databases/phpmyadmin211/files/pkg-install.in index bb4180b2660f..b8adfb92959b 100644 --- a/databases/phpmyadmin211/files/pkg-install.in +++ b/databases/phpmyadmin211/files/pkg-install.in @@ -5,66 +5,83 @@ PATH=/usr/sbin:/usr/bin:/bin ; export PATH -myadmdir=%%PREFIX%%/%%MYADMDIR%% -myadmusr=%%MYADMUSR%% -myadmgrp=%%MYADMGRP%% +pma_dir=%%WWWDIR%% +pma_usr=%%PMA_USR%% +pma_uid=%%PMA_UID%% +pma_grp=%%PMA_GRP%% +pma_gid=%%PMA_GID%% -myadmgcos="phpMyAdmin Owner" -myadmhome=/nonexistent -myadmshell=/sbin/nologin +pma_gcos="%%PMA_GCOS%%" +pma_home=%%PMA_HOME%% +pma_shell=%%PMA_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. + 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: + 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 - + 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 + 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 } @@ -72,24 +89,19 @@ create_user() { case $2 in PRE-INSTALL) - # Create the myadm user and group if they do not already exist - - if pw user show -n $myadmusr >/dev/null 2>&1 ; then - echo "===> Using pre-existing user $myadmusr" - else - if ! pw group show -n $myadmgrp >/dev/null 2>&1 ; then - create_group $myadmusr $myadmgrp "$myadmgcos" $myadmhome \ - $myadmshell - fi - create_user $myadmusr $myadmgrp "$myadmgcos" $myadmhome $myadmshell - fi + # Create the pma user and group if they do not already exist + create_group $pma_usr $pma_uid $pma_grp $pma_gid \ + "$pma_gcos" $pma_home $pma_shell + create_user $pma_usr $pma_uid $pma_grp $pma_gid \ + "$pma_gcos" $pma_home $pma_shell ;; + POST-INSTALL) # Change ownership of the phpMyAdm directory - echo "===> Adjusting file ownership in $myadmdir" - chown -R $myadmusr:$myadmgrp $myadmdir || exit 1 + echo "===> Adjusting file ownership in $pma_dir" + chown -R $pma_usr:$pma_grp $pma_dir || exit 1 ;; esac diff --git a/databases/phpmyadmin211/files/pkg-message.in b/databases/phpmyadmin211/files/pkg-message.in index 34fbb55d1919..152f150c8762 100644 --- a/databases/phpmyadmin211/files/pkg-message.in +++ b/databases/phpmyadmin211/files/pkg-message.in @@ -1,16 +1,16 @@ %%PKGNAME%% has been installed into: - %%PREFIX%%/%%MYADMDIR%% + %%WWWDIR%% Please edit config.inc.php to suit your needs. To make phpMyAdmin available through your web site, I suggest that you add something like the following to httpd.conf: - Alias /phpmyadmin/ "%%PREFIX%%/%%MYADMDIR%%/" + Alias /phpmyadmin/ "%%WWWDIR%%/" - <Directory "%%PREFIX%%/%%MYADMDIR%%/"> + <Directory "%%WWWDIR%%/"> Options none AllowOverride Limit diff --git a/databases/phpmyadmin211/pkg-plist-chunk b/databases/phpmyadmin211/pkg-plist-chunk index 271eb110d237..3c6168e40dd6 100644 --- a/databases/phpmyadmin211/pkg-plist-chunk +++ b/databases/phpmyadmin211/pkg-plist-chunk @@ -1,7 +1,7 @@ @mode 640 -@group %%MYADMGRP%% -@unexec if cmp -s %D/%%MYADMDIR%%/config.inc.php.sample %D/%%MYADMDIR%%/config.inc.php ; then rm -f %D/%%MYADMDIR%%/config.inc.php ; fi -%%MYADMDIR%%/config.inc.php.sample +@group %%PMA_GRP%% +@unexec if cmp -s %D/%%WWWDIR%%/config.inc.php.sample %D/%%WWWDIR%%/config.inc.php ; then rm -f %D/%%WWWDIR%%/config.inc.php ; fi +%%WWWDIR%%/config.inc.php.sample @exec [ ! -f %B/config.inc.php ] && cp -p %B/%f %B/config.inc.php || true @mode @group |