Fix a deinstallation problem noted on dosirak

+ utilize USE_APACHE and let it run smoothly with Apache2
+ utilize PORTDOCS
+ display a clean PKGMESSAGE when installing a package.

Approved by:	mat (mentor).
This commit is contained in:
Thierry Thomas 2004-04-16 10:59:29 +00:00
parent b6adcb2390
commit c86ae03555
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=107213
4 changed files with 34 additions and 19 deletions

View File

@ -14,20 +14,23 @@ EXTRACT_SUFX= .tgz
MAINTAINER= thierry@pompo.net
COMMENT= Logiciel de facturation pour P.M.I. & P.M.E.
BUILD_DEPENDS= ${LOCALBASE}/sbin/apxs:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS= ${LOCALBASE}/sbin/apxs:${PORTSDIR}/${APACHE_PORT} \
${LOCALBASE}/bin/htmldoc:${PORTSDIR}/textproc/htmldoc \
RUN_DEPENDS= ${LOCALBASE}/bin/htmldoc:${PORTSDIR}/textproc/htmldoc \
${PBASE}/${PERL_ARCH}/Mysql.pm:${PORTSDIR}/databases/p5-Mysql \
${PBASE}/Tie/IxHash.pm:${PORTSDIR}/devel/p5-Tie-IxHash
WRKSRC= ${WRKDIR}/${PORTNAME}
NO_BUILD= yes
USE_APACHE= yes
USE_PERL5_RUN= yes
USE_REINPLACE= yes
APACHE_PORT?= www/apache13
APACHE_CNFDIR?= ${LOCALBASE}/etc/apache
.if defined(WITH_APACHE2)
APACHE_CNFDIR= ${LOCALBASE}/etc/apache2
.else
APACHE_CNFDIR= ${LOCALBASE}/etc/apache
.endif
APACHE_CONF= ${APACHE_CNFDIR}/httpd.conf
PBASE= ${SITE_PERL}
@ -45,7 +48,9 @@ PLIST_SUB= FACT_REP=${LFACT_REP}
SS_REPS= cgi-bin html lib log sql
REINPLACE_ARGS= -i.beforeFacturier
DOCS= COPYING README.txt todo.txt
PORTDOCS= COPYING README.txt todo.txt
PKGMESSAGE= ${WRKDIR}/pkg-message
pre-everything::
@${ECHO_MSG} ""
@ -96,21 +101,23 @@ do-install:
${ECHO_CMD} "# Le Facturier's cgi-bin directory" >> ${APACHE_CONF} ; \
${ECHO_CMD} "Include ${FACT_INC}" >> ${APACHE_CONF} ; \
fi)
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for FILE in ${DOCS}
@${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR}
.for doc in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}
.endfor
@${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}."
.endif
post-install:
@${ECHO_MSG}
@${CAT} ${PKGMESSAGE} | \
${SED} -e "s:/usr/local/www/facturier:${FACT_REP}:" \
@${SED} -e "s:/usr/local/www/facturier:${FACT_REP}:" \
-e "s:/usr/local/share/doc/facturier:${DOCSDIR}:" \
-e "s:%%DBOWN%%:${DBOWN}:;s:%%DBPWD%%:${DBPWD}:" \
-e "s:%%DBSERV%%:${DBSERV}:"
-e "s:%%DBSERV%%:${DBSERV}:" \
${FILESDIR}/pkg-message.in > ${PKGMESSAGE}
@${CAT} ${PKGMESSAGE}
@${ECHO_MSG}
.include <bsd.port.mk>

View File

@ -8,12 +8,20 @@ if [ x$2 != xDEINSTALL ]; then
exit
fi
if [ -f ${PKG_PREFIX}/etc/apache/httpd.conf.beforeFacturier ] ; then
if [ -d ${PKG_PREFIX}/etc/apache2 ] ; then
AP_CNF=${PKG_PREFIX}/etc/apache2/httpd.conf
else
AP_CNF=${PKG_PREFIX}/etc/apache/httpd.conf
fi
if [ -f ${AP_CNF}.beforeFacturier ] ; then
echo "Restoring httpd.conf..."
cp ${PKG_PREFIX}/etc/apache/httpd.conf ${PKG_PREFIX}/etc/apache/httpd.conf.deinstFacturier
cp ${AP_CNF} ${AP_CNF}.deinstFacturier
sed -i.tmp -e "s:Include ${PKG_PREFIX}/etc/facturier:# Include ${PKG_PREFIX}/etc/facturier:" \
${PKG_PREFIX}/etc/apache/httpd.conf
rm ${PKG_PREFIX}/etc/apache/httpd.conf.tmp
${AP_CNF}
rm ${AP_CNF}.tmp
if ! [ -z "${PACKAGE_BUILDING}" ]; then
rm ${AP_CNF}.deinstFacturier
fi
fi
# Backup Le Facturier's config files, if needed.
@ -34,4 +42,8 @@ if [ -z "${PACKAGE_BUILDING}" ]; then
*) # not found?
;;
esac
else
if [ -f ${AP_CNF}.beforeFacturier ] ; then
rm ${AP_CNF}.beforeFacturier
fi
fi

View File

@ -1,7 +1,4 @@
etc/facturier/httpd.conf.facturier
%%PORTDOCS%%share/doc/facturier/COPYING
%%PORTDOCS%%share/doc/facturier/README.txt
%%PORTDOCS%%share/doc/facturier/todo.txt
%%FACT_REP%%/cgi-bin/cherchcontact.cgi
%%FACT_REP%%/cgi-bin/clientmodif.cgi
%%FACT_REP%%/cgi-bin/clients.cgi
@ -320,7 +317,6 @@ etc/facturier/httpd.conf.facturier
%%FACT_REP%%/sql/majpropal.sql
%%FACT_REP%%/sql/majvers2_0tovers2_1.sql
@dirrm etc/facturier
%%PORTDOCS%%@dirrm share/doc/facturier
@dirrm %%FACT_REP%%/cgi-bin
@dirrm %%FACT_REP%%/html/temp
@dirrm %%FACT_REP%%/html/UNGI/lang