View | Details | Raw Unified | Return to bug 141804
Collapse All | Expand All

(-)phpldapadmin098/Makefile (-57 / +28 lines)
Lines 19-24 Link Here
19
USE_PHP=	gettext ldap openssl pcre session
19
USE_PHP=	gettext ldap openssl pcre session
20
DEFAULT_PHP_VER=	4
20
DEFAULT_PHP_VER=	4
21
21
22
OPTIONS=	SUPHP	"suPHP support"	off
23
24
.include <bsd.port.options.mk>
25
22
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
26
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
23
27
24
PKGNAMESUFFIX+=	-suphp
28
PKGNAMESUFFIX+=	-suphp
Lines 31-60 Link Here
31
35
32
.endif
36
.endif
33
37
34
# PLA_USR is only used WITH_SUPHP
38
# USERS is only used WITH_SUPHP
35
PLA_GRP?=	${WWWGRP}
39
GROUPS?=	${WWWGRP}
36
PLA_GID?=	${_PLA_GID}
37
CFGDIR=		config
40
CFGDIR=		config
38
CFGFILE=	config.php
41
CFGFILE=	config.php
39
42
40
PLIST=		${WRKDIR}/plist
43
PLIST=		${WRKDIR}/plist
41
PLIST_SUB+=	PLA_GRP=${PLA_GRP}
44
PLIST_SUB+=	PLA_GRP=${GROUPS}
42
45
43
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
46
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
44
47
45
PLA_USR?=	_pla
48
USERS?=		_pla
46
PLA_UID?=	636
49
47
PLA_GCOS?=	"phpLDAPAdmin Owner"
50
SUB_LIST+=	PLA_USR=${USERS}  \
48
PLA_HOME?=	/nonexistent
51
		PLA_GRP=${GROUPS}
49
PLA_SHELL?=	/usr/sbin/nologin
50
51
SUB_LIST+=	PLA_USR=${PLA_USR}    \
52
		PLA_UID=${PLA_UID}    \
53
		PLA_GRP=${PLA_GRP}    \
54
		PLA_GID=${PLA_GID}    \
55
		PLA_GCOS=${PLA_GCOS}  \
56
		PLA_HOME=${PLA_HOME}  \
57
		PLA_SHELL=${PLA_SHELL}
58
SUB_FILES+=	pkg-install pkg-deinstall
52
SUB_FILES+=	pkg-install pkg-deinstall
59
53
60
.endif
54
.endif
Lines 62-129 Link Here
62
SUB_LIST+=	PKGNAME=${PKGNAME}
56
SUB_LIST+=	PKGNAME=${PKGNAME}
63
SUB_FILES+=	pkg-message
57
SUB_FILES+=	pkg-message
64
58
65
.include <bsd.port.pre.mk>
66
_PLA_GID!=	${PW} group show -n ${PLA_GRP} | ${CUT} -d : -f 3
67
.if empty(_PLA_GID)
68
_PLA_GID=	80
69
.endif
70
71
.SILENT:
59
.SILENT:
72
60
73
pre-everything::
61
pre-everything::
74
	${ECHO_MSG} ""
62
	${ECHO_MSG} ""
75
	${ECHO_MSG} "You may use the following build options:"
76
	${ECHO_MSG} ""
77
	${ECHO_MSG} "    WITH_SUPHP=yes   Install appropriately for use with"
78
	${ECHO_MSG} "                     the www/suphp port [default: no]"
79
	${ECHO_MSG} ""
80
	${ECHO_MSG} "This port will operate with either PHP4 or PHP5."
63
	${ECHO_MSG} "This port will operate with either PHP4 or PHP5."
81
	${ECHO_MSG} "However, for best results with PHP5 please use the"
64
	${ECHO_MSG} "However, for best results with PHP5 please use the"
82
	${ECHO_MSG} "net/phpldapadmin port instead."
65
	${ECHO_MSG} "net/phpldapadmin port instead."
83
	${ECHO_MSG} ""
66
	${ECHO_MSG} ""
84
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
85
	@if ${PW} show -n pldapadm >/dev/null 2>&1 ; then	              \
86
	    ${ECHO_MSG} "===> WARNING ******************************" ;	      \
87
	    ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \
88
	    ${ECHO_MSG} "to ${PLA_USR} -- you should delete the old user:" ;  \
89
	    ${ECHO_MSG} "  # ${PW} user del -n pldapadm" ;	              \
90
	    ${ECHO_MSG} "" ;						      \
91
	fi
92
.endif
93
67
94
post-patch:
68
post-patch:
95
	cd ${WRKSRC} ;							    \
69
	cd ${WRKSRC} ;							    \
96
	${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore | \
70
	${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore   \
97
	    ${SORT} | ${SED} -e "s!^\.!%%WWWDIR%%!"		>${PLIST} ; \
71
	    ! -name .gitignore | ${SORT} | ${SED} -e "s!^\.!%%WWWDIR%%!"    \
72
								>${PLIST} ; \
98
	${CAT} ${PKGDIR}/pkg-plist-chunk		       >>${PLIST} ; \
73
	${CAT} ${PKGDIR}/pkg-plist-chunk		       >>${PLIST} ; \
99
	${FIND} . -type d | ${SORT} -r | ${SED}				    \
74
	${FIND} . -type d | ${SORT} -r | ${SED}				    \
100
	    -e 's!^\./${CFGDIR}$$!@dirrmtry %%WWWDIR%%/${CFGDIR}!'	    \
75
	    -e 's!^\./${CFGDIR}$$!@dirrmtry %%WWWDIR%%/${CFGDIR}!'	    \
101
	    -e 's!^\.$$!@dirrmtry %%WWWDIR%%!'				    \
76
	    -e 's!^\.$$!@dirrmtry %%WWWDIR%%!'				    \
102
	    -e 's!^\.!@dirrm %%WWWDIR%%!'		       >>${PLIST}
77
	    -e 's!^\.!@dirrm %%WWWDIR%%!'		       >>${PLIST}
103
78
104
pre-install:
105
.if defined(WITH_SUPHP)
106
	${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
107
.endif
108
109
do-install: install-app install-conf
79
do-install: install-app install-conf
110
80
111
install-app:
81
install-app:
112
	cd ${WRKSRC} ; \
82
	cd ${WRKSRC} ;				    \
113
	for src in $$( ${FIND} . ! -name .cvsignore  ) ; do \
83
	for src in $$( ${FIND} . ! -name .cvsignore \
114
	    dst=${WWWDIR}$${src#.} ; \
84
			! -name .gitignore ) ; do   \
115
	    if ${TEST} -d $$src ; then \
85
	    dst=${WWWDIR}$${src#.} ;		    \
116
		${MKDIR} $$dst ; \
86
	    if ${TEST} -d $$src ; then		    \
117
	    else \
87
		${MKDIR} $$dst ;		    \
118
		${INSTALL_DATA} $$src $$dst ; \
88
	    else				    \
119
	    fi \
89
		${INSTALL_DATA} $$src $$dst ;	    \
90
	    fi					    \
120
	done
91
	done
121
92
122
install-conf:
93
install-conf:
123
	cd ${WWWDIR}/${CFGDIR} ; \
94
	cd ${WWWDIR}/${CFGDIR} ;		     \
124
	${CHMOD} 0640 ${CFGFILE}.example ; \
95
	${CHMOD} 0640 ${CFGFILE}.example ;	     \
125
	${CHGRP} ${PLA_GRP} ${CFGFILE}.example ; \
96
	${CHGRP} ${GROUPS} ${CFGFILE}.example ;	     \
126
	if ${TEST} ! -f ${CFGFILE} ; then \
97
	if ${TEST} ! -f ${CFGFILE} ; then	     \
127
	    ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \
98
	    ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \
128
	fi
99
	fi
129
100
Lines 133-136 Link Here
133
.endif
104
.endif
134
	${CAT} ${PKGMESSAGE}
105
	${CAT} ${PKGMESSAGE}
135
106
136
.include <bsd.port.post.mk>
107
.include <bsd.port.mk>
(-)phpldapadmin098/files/pkg-install.in (-87 / +1 lines)
Lines 7-104 Link Here
7
7
8
pla_dir=%%WWWDIR%%
8
pla_dir=%%WWWDIR%%
9
pla_usr=%%PLA_USR%%
9
pla_usr=%%PLA_USR%%
10
pla_uid=%%PLA_UID%%
11
pla_grp=%%PLA_GRP%%
10
pla_grp=%%PLA_GRP%%
12
pla_gid=%%PLA_GID%%
13
14
pla_gcos="%%PLA_GCOS%%"
15
pla_home=%%PLA_HOME%%
16
pla_shell=%%PLA_SHELL%%
17
18
create_group() {
19
    local user uid group gid gcos home shell
20
21
    user=$1
22
    uid=$2
23
    group=$3
24
    gid=$4
25
    gcos=$5
26
    home=$6
27
    shell=$7
28
29
30
    if pw group show -n $group >/dev/null 2>&1 ; then
31
	echo "===> Using pre-existing group $group"
32
    else
33
	if pw groupadd -n $group -g $gid ; then
34
	    echo "===> Group $group created"
35
	else
36
	    cat <<-EOERRORMSG
37
 		*** Failed to create the $group group.
38
39
		Please add the $user user and $group group
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 -
45
46
		and retry installing this package.
47
		EOERRORMSG
48
	    exit 1
49
	fi
50
    fi
51
52
}
53
54
55
create_user() {
56
    local user uid group gid gcos home shell
57
58
    user=$1
59
    uid=$2
60
    group=$3
61
    gid=$4
62
    gcos=$5
63
    home=$6
64
    shell=$7
65
66
    if pw user show -n $user >/dev/null 2>&1 ; then
67
	echo "===> Using pre-existing user $user"
68
    else
69
	if pw useradd -n $user -u $uid -g $group -c "$gcos" \
70
	    -d $home -s $shell -h - ; then
71
	    echo "===> Created $user user"
72
	else
73
	    cat <<-EOERRORMSG
74
		*** Failed to create the $user user.
75
76
		Please add the $user user manually with the command:
77
78
		    pw useradd -n $user -u $uid -g $group -c "$gcos" \\
79
		       -d $home -s $shell -h -
80
81
		and retry installing this package.
82
		EOERRORMSG
83
	    exit 1
84
	fi
85
    fi
86
}
87
88
11
89
case $2 in
12
case $2 in
90
    PRE-INSTALL)
91
92
        # Create the pla user and group if they do not already exist
93
	create_group $pla_usr $pla_uid $pla_grp $pla_gid \
94
                     "$pla_gcos" $pla_home $pla_shell
95
	create_user  $pla_usr $pla_uid $pla_grp $pla_gid \
96
                     "$pla_gcos" $pla_home $pla_shell
97
	;;
98
99
    POST-INSTALL)
13
    POST-INSTALL)
100
14
101
    	# Change ownership of the phpMyAdm directory
15
    	# Change ownership of the phpldapadm directory
102
16
103
        echo "===> Adjusting file ownership in $pla_dir"
17
        echo "===> Adjusting file ownership in $pla_dir"
104
        chown -R $pla_usr:$pla_grp $pla_dir || exit 1
18
        chown -R $pla_usr:$pla_grp $pla_dir || exit 1
(-)phpldapadmin098/files/pkg-message.in (-12 lines)
Lines 19-33 Link Here
19
        Allow from 127.0.0.1 .example.com
19
        Allow from 127.0.0.1 .example.com
20
    </Directory>
20
    </Directory>
21
21
22
Please note: if you are upgrading from version 0.9.7 or earlier, the
23
layout of the %%PKGNAME%% files has been completely reworked. You will
24
need to modify your apache configuration and merge the settings from
25
your original configuration file:
26
27
    %%WWWDIR%%/config.php
28
29
 to
30
31
    %%WWWDIR%%/config/config.php
32
33

Return to bug 141804