View | Details | Raw Unified | Return to bug 119825 | Differences between
and this patch

Collapse All | Expand All

(-)phpmyadmin/Makefile (-23 / +53 lines)
Lines 7-12 Link Here
7
7
8
PORTNAME=	phpMyAdmin
8
PORTNAME=	phpMyAdmin
9
DISTVERSION=	2.11.4
9
DISTVERSION=	2.11.4
10
PORTREVISION=	1
10
CATEGORIES=	databases www
11
CATEGORIES=	databases www
11
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
12
MASTER_SITE_SUBDIR=	phpmyadmin
13
MASTER_SITE_SUBDIR=	phpmyadmin
Lines 21-30 Link Here
21
USE_PHP=	ctype mysql pcre session
22
USE_PHP=	ctype mysql pcre session
22
.endif
23
.endif
23
24
24
SUB_LIST+=	"MYADMDIR=${MYADMDIR}" \
25
		"PKGNAME=${PKGNAME}"
26
SUB_FILES=	pkg-message
27
28
# Unfortunately can't make WITH_SUPHP part of the OPTIONS selection,
25
# Unfortunately can't make WITH_SUPHP part of the OPTIONS selection,
29
# since it has to be processed before just about anything else.
26
# since it has to be processed before just about anything else.
30
27
Lines 34-51 Link Here
34
RUN_DEPENDS+=	${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp
31
RUN_DEPENDS+=	${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp
35
WANT_PHP_CGI=	yes
32
WANT_PHP_CGI=	yes
36
33
37
MYADMUSR?=	phpmyadm
38
39
SUB_LIST+=	"MYADMUSR=${MYADMUSR}" \
40
		"MYADMGRP=${MYADMGRP}"
41
SUB_FILES+=	pkg-install pkg-deinstall
42
43
.else
34
.else
44
35
45
WANT_PHP_WEB=	yes
36
WANT_PHP_WEB=	yes
46
37
47
.endif
38
.endif
48
39
40
# PMA_USR is only used WITH_SUPHP
41
42
PMA_GRP?=	${WWWGRP}
43
PMA_GID?=	${_PMA_GID}
44
CFGFILE=	config.inc.php
45
46
PLIST=		${WRKDIR}/plist
47
PLIST_SUB+=	PMA_GRP=${PMA_GRP}
48
49
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
50
51
PMA_USR?=	_pma
52
PMA_UID?=	336
53
PMA_GCOS?=	"phpMyAdmin Owner"
54
PMA_HOME?=	/nonexistent
55
PMA_SHELL?=	/sbin/nologin
56
57
SUB_LIST+=	PMA_USR=${PMA_USR}    \
58
		PMA_UID=${PMA_UID}    \
59
		PMA_GRP=${PMA_GRP}    \
60
		PMA_GID=${PMA_GID}    \
61
		PMA_GCOS=${PMA_GCOS}  \
62
		PMA_HOME=${PMA_HOME}  \
63
		PMA_SHELL=${PMA_SHELL}
64
SUB_FILES+=	pkg-install pkg-deinstall
65
66
.endif
67
68
SUB_LIST+=	PKGNAME=${PKGNAME}
69
SUB_FILES+=	pkg-message
70
49
# Copy the way lang/php{4,5}-extensions deals with its OPTIONS -- avoids
71
# Copy the way lang/php{4,5}-extensions deals with its OPTIONS -- avoids
50
# problems with include of bsd.port.pre.mk
72
# problems with include of bsd.port.pre.mk
51
73
Lines 82-94 Link Here
82
.endfor
104
.endfor
83
.endif
105
.endif
84
106
85
# MYADMUSR is only used WITH_SUPHP
107
.include <bsd.port.pre.mk>
86
MYADMDIR?=	www/phpMyAdmin
87
MYADMGRP?=	${WWWGRP}
88
CFGFILE=	config.inc.php
89
108
90
PLIST=		${WRKDIR}/plist
109
_PMA_GID!=	/usr/sbin/pw group show -n ${PMA_GRP} | ${CUT} -d : -f 3
91
PLIST_SUB+=	MYADMDIR=${MYADMDIR} MYADMGRP=${MYADMGRP}
110
.if empty(_PMA_GID)
111
_PMA_GID=	80
112
.endif
92
113
93
.SILENT:
114
.SILENT:
94
115
Lines 109-114 Link Here
109
	${ECHO_MSG} "install lang/php4 before attempting to install"
130
	${ECHO_MSG} "install lang/php4 before attempting to install"
110
	${ECHO_MSG} "databases/phpmyadmin"
131
	${ECHO_MSG} "databases/phpmyadmin"
111
	${ECHO_MSG} ""
132
	${ECHO_MSG} ""
133
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
134
	@if /usr/sbin/pw show -n phpmyadm >/dev/null 2>&1 ; then              \
135
	    ${ECHO_MSG} "===> WARNING ******************************" ;       \
136
	    ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \
137
	    ${ECHO_MSG} "to ${PMA_USR} -- you should delete the old user:" ;  \
138
	    ${ECHO_MSG} "  # /usr/sbin/pw user del -n phpmyadm" ;             \
139
	    ${ECHO_MSG} "" ;                                                  \
140
	fi
141
.endif
112
142
113
# When creating a package, empty directories will not be generated
143
# When creating a package, empty directories will not be generated
114
# from the pkg tarball.  Therefore make sure no directories are empty.
144
# from the pkg tarball.  Therefore make sure no directories are empty.
Lines 121-131 Link Here
121
	${CP} ${FILESDIR}/${CFGFILE}.sample ${WRKSRC}/${CFGFILE}.sample
151
	${CP} ${FILESDIR}/${CFGFILE}.sample ${WRKSRC}/${CFGFILE}.sample
122
	cd ${WRKSRC} ; \
152
	cd ${WRKSRC} ; \
123
	${FIND} . ! -type d ! -name ${CFGFILE}.sample | ${SORT} | \
153
	${FIND} . ! -type d ! -name ${CFGFILE}.sample | ${SORT} | \
124
	    ${SED} -e "s,^\.,%%MYADMDIR%%,"           >${PLIST} ; \
154
	    ${SED} -e "s,^\.,%%WWWDIR%%,"             >${PLIST} ; \
125
	${CAT} ${PKGDIR}/pkg-plist-chunk             >>${PLIST} ; \
155
	${CAT} ${PKGDIR}/pkg-plist-chunk             >>${PLIST} ; \
126
	${FIND} . -type d | ${SORT} -r | ${SED} \
156
	${FIND} . -type d | ${SORT} -r | ${SED} \
127
	     -e "s,^\.$$,@dirrmtry %%MYADMDIR%%," \
157
	     -e "s,^\.$$,@dirrmtry %%WWWDIR%%," \
128
	     -e "s,^\.,@dirrm %%MYADMDIR%%,"         >>${PLIST}
158
	     -e "s,^\.,@dirrm %%WWWDIR%%,"           >>${PLIST}
129
159
130
pre-install:
160
pre-install:
131
.if defined(WITH_SUPHP)
161
.if defined(WITH_SUPHP)
Lines 137-143 Link Here
137
install-app:
167
install-app:
138
	cd ${WRKSRC} ; \
168
	cd ${WRKSRC} ; \
139
	for src in $$( ${FIND} . ! -name .cvsignore ) ; do \
169
	for src in $$( ${FIND} . ! -name .cvsignore ) ; do \
140
	    dst=${PREFIX}/${MYADMDIR}$${src#.} ; \
170
	    dst=${WWWDIR}$${src#.} ; \
141
	    if ${TEST} -d $$src ; then \
171
	    if ${TEST} -d $$src ; then \
142
	        ${MKDIR} $$dst ; \
172
	        ${MKDIR} $$dst ; \
143
	    else \
173
	    else \
Lines 146-154 Link Here
146
	done
176
	done
147
177
148
install-conf: install-app
178
install-conf: install-app
149
	cd ${PREFIX}/${MYADMDIR} ; \
179
	cd ${WWWDIR} ; \
150
	${CHMOD} 0640 ${CFGFILE}.sample ; \
180
	${CHMOD} 0640 ${CFGFILE}.sample ; \
151
	${CHGRP} ${MYADMGRP} ${CFGFILE}.sample ; \
181
	${CHGRP} ${PMA_GRP} ${CFGFILE}.sample ; \
152
	if ${TEST} ! -f ${CFGFILE} ; then \
182
	if ${TEST} ! -f ${CFGFILE} ; then \
153
	    ${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \
183
	    ${CP} -p ${CFGFILE}.sample ${CFGFILE} ; \
154
	fi
184
	fi
Lines 159-162 Link Here
159
.endif
189
.endif
160
	${CAT} ${PKGMESSAGE}
190
	${CAT} ${PKGMESSAGE}
161
191
162
.include <bsd.port.mk>
192
.include <bsd.port.post.mk>
(-)phpmyadmin/files/pkg-deinstall.in (-4 / +4 lines)
Lines 9-21 Link Here
9
The phpMyAdmin-suphp port has been deleted.
9
The phpMyAdmin-suphp port has been deleted.
10
If you are not upgrading and don't intend to use
10
If you are not upgrading and don't intend to use
11
phpMyAdmin any more then you may wish to delete
11
phpMyAdmin any more then you may wish to delete
12
the %%MYADMUSR%% account, which can be done with
12
the %%PMA_USR%% account, which can be done with
13
the following command:
13
the following command:
14
14
15
    # pw userdel %%MYADMUSR%%
15
    # pw userdel %%PMA_USR%%
16
EOMSG
16
EOMSG
17
    if [ -d %%PREFIX%%/%%MYADMDIR%% ] ; then
17
    if [ -d %%WWWDIR%% ] ; then
18
	echo "    # rm -rf %%PREFIX%%/%%MYADMDIR%%/"
18
	echo "    # rm -rf %%WWWDIR%%/"
19
    fi
19
    fi
20
    echo
20
    echo
21
    ;;
21
    ;;
(-)phpmyadmin/files/pkg-install.in (-53 / +65 lines)
Lines 5-70 Link Here
5
5
6
PATH=/usr/sbin:/usr/bin:/bin ; export PATH
6
PATH=/usr/sbin:/usr/bin:/bin ; export PATH
7
7
8
myadmdir=%%PREFIX%%/%%MYADMDIR%%
8
pma_dir=%%WWWDIR%%
9
myadmusr=%%MYADMUSR%%
9
pma_usr=%%PMA_USR%%
10
myadmgrp=%%MYADMGRP%%
10
pma_uid=%%PMA_UID%%
11
11
pma_grp=%%PMA_GRP%%
12
myadmgcos="phpMyAdmin Owner"
12
pma_gid=%%PMA_GID%%
13
myadmhome=/nonexistent
13
14
myadmshell=/sbin/nologin
14
pma_gcos="%%PMA_GCOS%%"
15
pma_home=%%PMA_HOME%%
16
pma_shell=%%PMA_SHELL%%
15
17
16
create_group() {
18
create_group() {
17
    local user group gcos home shell
19
    local user uid group gid gcos home shell
18
20
19
    user=$1
21
    user=$1
20
    group=$2
22
    uid=$2
21
    gcos=$3
23
    group=$3
22
    home=$4
24
    gid=$4
23
    shell=$5
25
    gcos=$5
26
    home=$6
27
    shell=$7
24
28
25
    if pw groupadd -n $group ; then
29
26
	echo "===> Group $group created"
30
    if pw group show -n $group >/dev/null 2>&1 ; then
31
	echo "===> Using pre-existing group $group"
27
    else
32
    else
28
	cat <<-EOERRORMSG
33
	if pw groupadd -n $group -g $gid ; then
29
	*** Failed to create the $group group.
34
	    echo "===> Group $group created"
35
	else
36
	    cat <<-EOERRORMSG
37
 		*** Failed to create the $group group.
30
38
31
	Please add the $user user and $group group
39
		Please add the $user user and $group group
32
	manually with the commands:
40
		manually with the commands:
41
42
		    pw groupadd -n $group -g $gid
43
		    pw useradd -n $user -u $uid -g $group -c "$gcos" \\
44
		        -d $home -s $shell -h -
33
45
34
	    pw groupadd -n $group
46
		and retry installing this package.
35
	    pw useradd -n $user -g $group -c "$gcos" \\
47
		EOERRORMSG
36
	        -d $home -s $shell -h -
48
	    exit 1
37
49
	fi
38
	and retry installing this package.
39
	EOERRORMSG
40
	exit 1
41
    fi
50
    fi
51
42
}
52
}
43
53
44
54
45
create_user() {
55
create_user() {
46
    local user group gcos home shell
56
    local user uid group gid gcos home shell
47
57
48
    user=$1
58
    user=$1
49
    group=$2
59
    uid=$2
50
    gcos=$3
60
    group=$3
51
    home=$4
61
    gid=$4
52
    shell=$5
62
    gcos=$5
63
    home=$6
64
    shell=$7
53
65
54
    if pw useradd -n $user -g $group -c "$gcos" -d $home -s $shell -h - ; then
66
    if pw user show -n $user >/dev/null 2>&1 ; then
55
	echo "===> Created $user user"
67
	echo "===> Using pre-existing user $user"
56
    else
68
    else
57
	cat <<-EOERRORMSG
69
	if pw useradd -n $user -u $uid -g $group -c "$gcos" \
58
	*** Failed to create the $user user.
70
	    -d $home -s $shell -h - ; then
71
	    echo "===> Created $user user"
72
	else
73
	    cat <<-EOERRORMSG
74
		*** Failed to create the $user user.
59
75
60
	Please add the $user user manually with the command:
76
		Please add the $user user manually with the command:
61
77
62
	    pw useradd -n $user -g $group -c "$gcos" \\
78
		    pw useradd -n $user -u $uid -g $group -c "$gcos" \\
63
		        -d $home -s $shell -h -
79
		       -d $home -s $shell -h -
64
80
65
	and retry installing this package.
81
		and retry installing this package.
66
	EOERRORMSG
82
		EOERRORMSG
67
	exit 1
83
	    exit 1
84
	fi
68
    fi
85
    fi
69
}
86
}
70
87
Lines 72-95 Link Here
72
case $2 in
89
case $2 in
73
    PRE-INSTALL)
90
    PRE-INSTALL)
74
91
75
        # Create the myadm user and group if they do not already exist
92
        # Create the pma user and group if they do not already exist
76
93
	create_group $pma_usr $pma_uid $pma_grp $pma_gid \
77
        if pw user show -n $myadmusr >/dev/null 2>&1 ; then
94
                     "$pma_gcos" $pma_home $pma_shell
78
	    echo "===> Using pre-existing user $myadmusr"
95
	create_user  $pma_usr $pma_uid $pma_grp $pma_gid \
79
	else
96
                     "$pma_gcos" $pma_home $pma_shell
80
	    if ! pw group show -n $myadmgrp >/dev/null 2>&1 ; then
81
		create_group $myadmusr $myadmgrp "$myadmgcos" $myadmhome \
82
		    $myadmshell
83
	    fi
84
	    create_user $myadmusr $myadmgrp "$myadmgcos" $myadmhome $myadmshell
85
	fi
86
	;;
97
	;;
98
87
    POST-INSTALL)
99
    POST-INSTALL)
88
100
89
    	# Change ownership of the phpMyAdm directory
101
    	# Change ownership of the phpMyAdm directory
90
102
91
        echo "===> Adjusting file ownership in $myadmdir"
103
        echo "===> Adjusting file ownership in $pma_dir"
92
        chown -R $myadmusr:$myadmgrp $myadmdir || exit 1
104
        chown -R $pma_usr:$pma_grp $pma_dir || exit 1
93
	;;
105
	;;
94
esac
106
esac
95
107
(-)phpmyadmin/files/pkg-message.in (-3 / +3 lines)
Lines 1-16 Link Here
1
1
2
%%PKGNAME%% has been installed into:
2
%%PKGNAME%% has been installed into:
3
3
4
    %%PREFIX%%/%%MYADMDIR%%
4
    %%WWWDIR%%
5
5
6
Please edit config.inc.php to suit your needs.
6
Please edit config.inc.php to suit your needs.
7
7
8
To make phpMyAdmin available through your web site, I suggest
8
To make phpMyAdmin available through your web site, I suggest
9
that you add something like the following to httpd.conf:
9
that you add something like the following to httpd.conf:
10
10
11
    Alias /phpmyadmin/ "%%PREFIX%%/%%MYADMDIR%%/"
11
    Alias /phpmyadmin/ "%%WWWDIR%%/"
12
12
13
    <Directory "%%PREFIX%%/%%MYADMDIR%%/">
13
    <Directory "%%WWWDIR%%/">
14
	Options none
14
	Options none
15
	AllowOverride Limit
15
	AllowOverride Limit
16
	
16
	
(-)phpmyadmin/pkg-plist-chunk (-3 / +3 lines)
Lines 1-7 Link Here
1
@mode 640
1
@mode 640
2
@group %%MYADMGRP%%
2
@group %%PMA_GRP%%
3
@unexec if cmp -s %D/%%MYADMDIR%%/config.inc.php.sample %D/%%MYADMDIR%%/config.inc.php ; then rm -f %D/%%MYADMDIR%%/config.inc.php ; fi
3
@unexec if cmp -s %%WWWDIR%%/config.inc.php.sample %%WWWDIR%%/config.inc.php ; then rm -f %%WWWDIR%%/config.inc.php ; fi
4
%%MYADMDIR%%/config.inc.php.sample
4
%%WWWDIR%%/config.inc.php.sample
5
@exec [ ! -f %B/config.inc.php ] && cp -p %B/%f %B/config.inc.php || true
5
@exec [ ! -f %B/config.inc.php ] && cp -p %B/%f %B/config.inc.php || true
6
@mode
6
@mode
7
@group
7
@group

Return to bug 119825