aboutsummaryrefslogtreecommitdiff
path: root/databases/phpmyadmin211
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2008-01-21 10:58:20 +0000
committerMartin Wilke <miwi@FreeBSD.org>2008-01-21 10:58:20 +0000
commit784cf429418a5d41f90a1541851fa5c86f51f402 (patch)
tree6c732b6232a9ef6d529e62641a7558613dd54c36 /databases/phpmyadmin211
parentb6a7e8059227098bbbdc6ea2b970f6a4e14791a3 (diff)
downloadports-784cf429418a5d41f90a1541851fa5c86f51f402.tar.gz
ports-784cf429418a5d41f90a1541851fa5c86f51f402.zip
Notes
Diffstat (limited to 'databases/phpmyadmin211')
-rw-r--r--databases/phpmyadmin211/Makefile76
-rw-r--r--databases/phpmyadmin211/files/pkg-deinstall.in8
-rw-r--r--databases/phpmyadmin211/files/pkg-install.in116
-rw-r--r--databases/phpmyadmin211/files/pkg-message.in6
-rw-r--r--databases/phpmyadmin211/pkg-plist-chunk6
5 files changed, 127 insertions, 85 deletions
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