1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00

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]
This commit is contained in:
Muhammad Moinur Rahman 2023-04-21 17:48:13 +02:00
parent 04c7d1e4a8
commit 127744ca10
2 changed files with 23 additions and 26 deletions

View File

@ -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}

View File

@ -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