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

(-)phpldapadmin/Makefile (-57 / +28 lines)
Lines 21-26 Link Here
21
DEFAULT_PHP_VER=	5
21
DEFAULT_PHP_VER=	5
22
IGNORE_WITH_PHP=	4
22
IGNORE_WITH_PHP=	4
23
23
24
OPTIONS=	SUPHP	"suPHP support" off
25
26
.include <bsd.port.options.mk>
27
24
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
28
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
25
29
26
PKGNAMESUFFIX+=	-suphp
30
PKGNAMESUFFIX+=	-suphp
Lines 33-62 Link Here
33
37
34
.endif
38
.endif
35
39
36
# PLA_USR is only used WITH_SUPHP
40
# USERS is only used WITH_SUPHP
37
PLA_GRP?=	${WWWGRP}
41
GROUPS?=	${WWWGRP}
38
PLA_GID?=	${_PLA_GID}
39
CFGDIR=		config
42
CFGDIR=		config
40
CFGFILE=	config.php
43
CFGFILE=	config.php
41
44
42
PLIST=		${WRKDIR}/plist
45
PLIST=		${WRKDIR}/plist
43
PLIST_SUB+=	PLA_GRP=${PLA_GRP}
46
PLIST_SUB+=	PLA_GRP=${GROUPS}
44
47
45
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
48
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
46
49
47
PLA_USR?=	_pla
50
USERS?=		_pla
48
PLA_UID?=	636
51
49
PLA_GCOS?=	"phpLDAPAdmin Owner"
52
SUB_LIST+=	PLA_USR=${USERS}  \
50
PLA_HOME?=	/nonexistent
53
		PLA_GRP=${GROUPS}
51
PLA_SHELL?=	/usr/sbin/nologin
52
53
SUB_LIST+=	PLA_USR=${PLA_USR}    \
54
		PLA_UID=${PLA_UID}    \
55
		PLA_GRP=${PLA_GRP}    \
56
		PLA_GID=${PLA_GID}    \
57
		PLA_GCOS=${PLA_GCOS}  \
58
		PLA_HOME=${PLA_HOME}  \
59
		PLA_SHELL=${PLA_SHELL}
60
SUB_FILES+=	pkg-install pkg-deinstall
54
SUB_FILES+=	pkg-install pkg-deinstall
61
55
62
.endif
56
.endif
Lines 64-130 Link Here
64
SUB_LIST+=	PKGNAME=${PKGNAME}
58
SUB_LIST+=	PKGNAME=${PKGNAME}
65
SUB_FILES+=	pkg-message
59
SUB_FILES+=	pkg-message
66
60
67
.include <bsd.port.pre.mk>
68
_PLA_GID!=	${PW} group show -n ${PLA_GRP} | ${CUT} -d : -f 3
69
.if empty(_PLA_GID)
70
_PLA_GID=	80
71
.endif
72
73
.SILENT:
61
.SILENT:
74
62
75
pre-everything::
63
pre-everything::
76
	${ECHO_MSG} ""
64
	${ECHO_MSG} ""
77
	${ECHO_MSG} "You may use the following build options:"
78
	${ECHO_MSG} ""
79
	${ECHO_MSG} "    WITH_SUPHP=yes   Install appropriately for use with"
80
	${ECHO_MSG} "                     the www/suphp port [default: no]"
81
	${ECHO_MSG} ""
82
	${ECHO_MSG} "This port is PHP5 specific. If you need PHP4 support,"
65
	${ECHO_MSG} "This port is PHP5 specific. If you need PHP4 support,"
83
	${ECHO_MSG} "please use the net/phpldapadmin098 port instead."
66
	${ECHO_MSG} "please use the net/phpldapadmin098 port instead."
84
	${ECHO_MSG} ""
67
	${ECHO_MSG} ""
85
.if defined(WITH_SUPHP) && !defined(WITHOUT_SUPHP)
86
	@if ${PW} show -n pldapadm >/dev/null 2>&1 ; then	              \
87
	    ${ECHO_MSG} "===> WARNING ******************************" ;	      \
88
	    ${ECHO_MSG} "The default username used by ${PKNAME} has changed"; \
89
	    ${ECHO_MSG} "to ${PLA_USR} -- you should delete the old user:" ;  \
90
	    ${ECHO_MSG} "  # ${PW} user del -n pldapadm" ;	              \
91
	    ${ECHO_MSG} "" ;						      \
92
	fi
93
.endif
94
68
95
post-patch:
69
post-patch:
96
	cd ${WRKSRC} ;							    \
70
	cd ${WRKSRC} ;							    \
97
	${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore | \
71
	${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore   \
98
	    ${SORT} | ${SED} -e "s!^\.!%%WWWDIR%%!"		>${PLIST} ; \
72
	    ! -name .gitignore | ${SORT} | ${SED} -e "s!^\.!%%WWWDIR%%!"    \
73
								>${PLIST} ; \
99
	${CAT} ${PKGDIR}/pkg-plist-chunk		       >>${PLIST} ; \
74
	${CAT} ${PKGDIR}/pkg-plist-chunk		       >>${PLIST} ; \
100
	${FIND} . -type d | ${SORT} -r | ${SED}				    \
75
	${FIND} . -type d | ${SORT} -r | ${SED}				    \
101
	    -e 's!^\./${CFGDIR}$$!@dirrmtry %%WWWDIR%%/${CFGDIR}!'	    \
76
	    -e 's!^\./${CFGDIR}$$!@dirrmtry %%WWWDIR%%/${CFGDIR}!'	    \
102
	    -e 's!^\.$$!@dirrmtry %%WWWDIR%%!'				    \
77
	    -e 's!^\.$$!@dirrmtry %%WWWDIR%%!'				    \
103
	    -e 's!^\.!@dirrm %%WWWDIR%%!'		       >>${PLIST}
78
	    -e 's!^\.!@dirrm %%WWWDIR%%!'		       >>${PLIST}
104
79
105
pre-install:
106
.if defined(WITH_SUPHP)
107
	${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
108
.endif
109
110
do-install: install-app install-conf
80
do-install: install-app install-conf
111
81
112
install-app:
82
install-app:
113
	cd ${WRKSRC} ; \
83
	cd ${WRKSRC} ;				    \
114
	for src in $$( ${FIND} . ! -name .cvsignore  ) ; do \
84
	for src in $$( ${FIND} . ! -name .cvsignore \
115
	    dst=${WWWDIR}$${src#.} ; \
85
			 ! -name .gitignore  ) ; do \
116
	    if ${TEST} -d $$src ; then \
86
	    dst=${WWWDIR}$${src#.} ;		    \
117
		${MKDIR} $$dst ; \
87
	    if ${TEST} -d $$src ; then		    \
118
	    else \
88
		${MKDIR} $$dst ;		    \
119
		${INSTALL_DATA} $$src $$dst ; \
89
	    else				    \
120
	    fi \
90
		${INSTALL_DATA} $$src $$dst ;	    \
91
	    fi					    \
121
	done
92
	done
122
93
123
install-conf:
94
install-conf:
124
	cd ${WWWDIR}/${CFGDIR} ; \
95
	cd ${WWWDIR}/${CFGDIR} ;		     \
125
	${CHMOD} 0640 ${CFGFILE}.example ; \
96
	${CHMOD} 0640 ${CFGFILE}.example ;	     \
126
	${CHGRP} ${PLA_GRP} ${CFGFILE}.example ; \
97
	${CHGRP} ${GROUPS} ${CFGFILE}.example ;	     \
127
	if ${TEST} ! -f ${CFGFILE} ; then \
98
	if ${TEST} ! -f ${CFGFILE} ; then	     \
128
	    ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \
99
	    ${CP} -p ${CFGFILE}.example ${CFGFILE} ; \
129
	fi
100
	fi
130
101
Lines 134-137 Link Here
134
.endif
105
.endif
135
	${CAT} ${PKGMESSAGE}
106
	${CAT} ${PKGMESSAGE}
136
107
137
.include <bsd.port.post.mk>
108
.include <bsd.port.mk>
(-)phpldapadmin/files/pkg-deinstall.in (-1 / +1 lines)
Lines 8-14 Link Here
8
    cat <<EOMSG
8
    cat <<EOMSG
9
The phpldapadmin-suphp port has been deleted.
9
The phpldapadmin-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
phpLDAPadmin any more then you may wish to delete
11
phpldapadmin any more then you may wish to delete
12
the %%PLA_USR%% account, which can be done with
12
the %%PLA_USR%% account, which can be done with
13
the following command:
13
the following command:
14
14
(-)phpldapadmin/files/pkg-install.in (-86 / +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
11
88
12
89
case $2 in
13
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)
14
    POST-INSTALL)
100
15
101
    	# Change ownership of the phpMyAdm directory
16
    	# Change ownership of the phpldapadmin directory
102
17
103
        echo "===> Adjusting file ownership in $pla_dir"
18
        echo "===> Adjusting file ownership in $pla_dir"
104
        chown -R $pla_usr:$pla_grp $pla_dir || exit 1
19
        chown -R $pla_usr:$pla_grp $pla_dir || exit 1

Return to bug 141803