Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 2023 19:37:26 GMT
From:      Muhammad Moinur Rahman <bofh@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 127744ca1015 - main - sysutils/ldap-account-manager: Refactor
Message-ID:  <202304211937.33LJbQTk046196@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=127744ca10156ef3e1807a56b65415328b83d417

commit 127744ca10156ef3e1807a56b65415328b83d417
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-04-21 15:48:13 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-04-21 19:37:16 +0000

    sysutils/ldap-account-manager: Refactor
    
    - Replace SED with SHEBANG_FILES
    - Replace @preexec/@postexec with relevant keywords [1]
    - Change pkg-message to respect PREFIX
    
    Reported by:    bapt [1]
---
 sysutils/ldap-account-manager/Makefile             | 45 ++++++++++------------
 .../{pkg-message => files/pkg-message.in}          |  4 +-
 2 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/sysutils/ldap-account-manager/Makefile b/sysutils/ldap-account-manager/Makefile
index a1de8d4d0f8e..6c8b680a69dd 100644
--- a/sysutils/ldap-account-manager/Makefile
+++ b/sysutils/ldap-account-manager/Makefile
@@ -13,47 +13,44 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 RUN_DEPENDS=	p5-perl-ldap>=0:net/p5-perl-ldap \
 		p5-Quota>=0:sysutils/p5-Quota
 
-USES=		perl5 php:web tar:bzip2
+USES=		perl5 php:web shebangfix tar:bzip2
 USE_PHP=	curl filter gd gettext gmp iconv ldap mbstring \
 		session simplexml xml xmlreader xmlwriter zip
 
+SHEBANG_FILES=	lib/lamdaemon.pl
+
 WWWDIR=		${PREFIX}/www/${SHORTNAME}
 NO_ARCH=	yes
 NO_BUILD=	yes
+SUB_FILES=	pkg-message
 
-SHORTNAME=	lam
 PORTDOCS=	COPYING HISTORY README copyright docs
-LAMDATA=	config graphics help lib locale sess style templates tmp \
-		VERSION index.html pwa_worker.js .htaccess
-WRITEABLES=	config sess tmp
-
-OPTIONS_DEFINE+=	DOCS
-OPTIONS_DEFAULT=	DOCS
+OPTIONS_DEFINE=	DOCS
 
 DOCS_DESC=	Install documentation and dhcp.schema
 
-.include <bsd.port.options.mk>
+LAMDATA=	config graphics help lib locale sess style templates tmp \
+		VERSION index.html pwa_worker.js .htaccess
+SHORTNAME=	lam
 
 do-install:
-	@${ECHO_CMD} '@preexec if [ -f %D/${WWWDIR_REL}/config/shells ]; then ${RM} %D/${WWWDIR_REL}/config/shells; fi' >> ${TMPPLIST}
-	@${ECHO_CMD} '@sample ${WWWDIR_REL}/config/addressbook.sample.conf ${WWWDIR_REL}/config/addressbook.conf' >> ${TMPPLIST}
-	@${ECHO_CMD} '@sample ${WWWDIR_REL}/config/config.cfg.sample ${WWWDIR_REL}/config/config.cfg' >> ${TMPPLIST}
-	@${ECHO_CMD} '@sample ${WWWDIR_REL}/config/samba3.sample.conf ${WWWDIR_REL}/config/samba3.conf' >> ${TMPPLIST}
-	@${ECHO_CMD} '@sample ${WWWDIR_REL}/config/unix.sample.conf ${WWWDIR_REL}/config/lam.conf' >> ${TMPPLIST}
-	@${ECHO_CMD} '@sample ${WWWDIR_REL}/config/windows_samba4.sample.conf ${WWWDIR_REL}/config/windows_samba4.conf' >> ${TMPPLIST}
+	@${ECHO_CMD} '@rmtry ${WWWDIR_REL}/config/shells' >> ${TMPPLIST}
+	@${ECHO_CMD} '@sample(${WWWOWN},,) ${WWWDIR_REL}/config/addressbook.sample.conf ${WWWDIR_REL}/config/addressbook.conf' >> ${TMPPLIST}
+	@${ECHO_CMD} '@sample(${WWWOWN},,) ${WWWDIR_REL}/config/config.cfg.sample ${WWWDIR_REL}/config/config.cfg' >> ${TMPPLIST}
+	@${ECHO_CMD} '@sample(${WWWOWN},,) ${WWWDIR_REL}/config/samba3.sample.conf ${WWWDIR_REL}/config/samba3.conf' >> ${TMPPLIST}
+	@${ECHO_CMD} '@sample(${WWWOWN},,) ${WWWDIR_REL}/config/unix.sample.conf ${WWWDIR_REL}/config/lam.conf' >> ${TMPPLIST}
+	@${ECHO_CMD} '@sample(${WWWOWN},,) ${WWWDIR_REL}/config/windows_samba4.sample.conf ${WWWDIR_REL}/config/windows_samba4.conf' >> ${TMPPLIST}
 .for I in ${LAMDATA}
-	@${FIND} -s ${WRKSRC}/${I} -type f -not -name 'config.cfg.sample' -not -name '*.sample.conf' | ${SED} -e 's,^${WRKSRC},${WWWDIR_REL},' >> ${TMPPLIST}
-	@${FIND} -ds ${WRKSRC}/${I} -type d | ${SED} -e 's,^${WRKSRC},@dir ${WWWDIR_REL},' >> ${TMPPLIST}
+	@${FIND} -s ${WRKSRC}/${I} -type f -not -name 'config.cfg.sample' -not -name '*.sample.conf' | \
+		${SED} -e 's#^${WRKSRC}#${WWWDIR_REL}#' | \
+		${SED} -E -e '/lib\/lamdaemon.pl$$/ s#^#@(${WWWOWN},,0544) #; \
+			/\/config|\/sess|\/tmp/ s#^#@(${WWWOWN},,) #;' >> ${TMPPLIST}
+	@${FIND} -ds ${WRKSRC}/${I} -type d | \
+		${SED} -e 's,^${WRKSRC},@dir ${WWWDIR_REL},' | \
+		${SED} -E -e '/\/config\/|\/sess\/|\/tmp\// s#@dir #@dir(${WWWOWN},,0755) #' >> ${TMPPLIST}
 .endfor
 	@${ECHO_CMD} '@dir ${WWWDIR_REL}' >> ${TMPPLIST}
 	@cd ${WRKSRC} && ${COPYTREE_SHARE} "${LAMDATA}" ${STAGEDIR}${WWWDIR}
-.for DIR in ${WRITEABLES}
-	@${ECHO_CMD} '@postexec ${CHOWN} -R ${WWWOWN} %D/${WWWDIR_REL}/${DIR}' >> ${TMPPLIST}
-	@${ECHO_CMD} '@postexec ${CHMOD} -R u+w %D/${WWWDIR_REL}/${DIR}' >> ${TMPPLIST}
-.endfor
-	@${SED} -i '' 's|usr/bin/perl|usr/local/bin/perl|g' ${WRKSRC}/lib/lamdaemon.pl
-	@${ECHO_CMD} '@postexec ${CHOWN} ${WWWOWN} %D/${WWWDIR_REL}/${DIR}/lib/lamdaemon.pl' >> ${TMPPLIST}
-	@${ECHO_CMD} '@postexec ${CHMOD} u+x %D/${WWWDIR_REL}/${DIR}/lib/lamdaemon.pl' >> ${TMPPLIST}
 
 do-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
diff --git a/sysutils/ldap-account-manager/pkg-message b/sysutils/ldap-account-manager/files/pkg-message.in
similarity index 86%
rename from sysutils/ldap-account-manager/pkg-message
rename to sysutils/ldap-account-manager/files/pkg-message.in
index 72daeaa0e4f1..0e16516c75a0 100644
--- a/sysutils/ldap-account-manager/pkg-message
+++ b/sysutils/ldap-account-manager/files/pkg-message.in
@@ -6,9 +6,9 @@
 
 You should add the following to your Apache configuration file:
 
-Alias /lam /usr/local/www/lam
+Alias /lam %%PREFIX%%/www/lam
 
-<Directory /usr/local/www/lam>
+<Directory %%PREFIX%%/www/lam>
   Options +FollowSymLinks
   AllowOverride All
   Require all granted



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304211937.33LJbQTk046196>