- minor update to version 2.1

- tweak pkg/MESSAGE
- mirror the distfiles since the main server can be capricious sometimes
- use the apache-module framework; work done by simon@ (big thank to him)

"looks good" simon@
This commit is contained in:
ajacoutot 2007-06-21 10:58:37 +00:00
parent 5784787920
commit 587e14846b
6 changed files with 57 additions and 72 deletions

View File

@ -1,22 +1,22 @@
# $OpenBSD: Makefile,v 1.3 2007/06/01 07:36:32 ajacoutot Exp $ # $OpenBSD: Makefile,v 1.4 2007/06/21 10:58:37 ajacoutot Exp $
# This port currently only works with archs supporting dynamic loading COMMENT= bandwidth limiter for Apache
# and has Apache that supports DSO's.
SHARED_ONLY= Yes
COMMENT= "bandwidth limiter for Apache" V= 2.1
DISTFILES= mod_bandwidth.c cleanlink.pl:0
V= 2.0.6
DISTFILES= mod_bandwidth.c cleanlink.pl
DISTNAME= mod_bandwidth-${V} DISTNAME= mod_bandwidth-${V}
PKGNAME= ${DISTNAME}p0
CATEGORIES= www CATEGORIES= www
MASTER_SITES= ftp://ftp.cohprog.com/pub/apache/module/ MASTER_SITES= ftp://ftp.cohprog.com/pub/apache/module/1.3.0/ \
http://www.obsd.fr/OpenBSD/distfiles/mod_bandwidth/1.3.0/
MASTER_SITES0= ftp://ftp.cohprog.com/pub/apache/module/ \
http://www.obsd.fr/OpenBSD/distfiles/mod_bandwidth/
HOMEPAGE= http://www.cohprog.com/mod_bandwidth.html HOMEPAGE= http://www.cohprog.com/mod_bandwidth.html
MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org> MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>
MODULES+= apache-module
# Apache Group licence # Apache Group licence
PERMIT_PACKAGE_CDROM= Yes PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes PERMIT_PACKAGE_FTP= Yes
@ -27,26 +27,26 @@ SUBST_VARS= PKGNAME HOMEPAGE
DIST_SUBDIR= ${DISTNAME:S/-${V}//} DIST_SUBDIR= ${DISTNAME:S/-${V}//}
NO_REGRESS= Yes NO_REGRESS= Yes
MODAPACHE_NAME= bandwidth
do-extract: do-extract:
mkdir ${WRKSRC} @mkdir ${WRKSRC}
.for i in ${DISTFILES} .for i in ${DISTFILES:S/:0//}
cp ${DISTDIR}/${DIST_SUBDIR}/${i} ${WRKSRC} @cp ${DISTDIR}/${DIST_SUBDIR}/${i} ${WRKSRC}
.endfor .endfor
do-build: do-build:
cd ${WRKSRC} && /usr/sbin/apxs -Wc,"${CFLAGS}" -c mod_bandwidth.c \ cd ${WRKSRC} && /usr/sbin/apxs -Wc,"${CFLAGS}" -c mod_bandwidth.c \
-o ${WRKBUILD}/mod_bandwidth.so -o ${WRKBUILD}/mod_bandwidth.so
sed 's,!!PREFIX!!,${PREFIX},' \ @perl -pi -e "s,\/usr\/local\/bin\/perl,\/usr\/bin\/perl,g" ${WRKSRC}/cleanlink.pl
< ${FILESDIR}/mod_bandwidth-enable > ${WRKBUILD}/mod_bandwidth-enable @perl -pi -e "s,\/tmp\/apachebw,\/var\/www\/tmp\/apachebw,g" ${WRKSRC}/cleanlink.pl
perl -pi -e "s,\/usr\/local\/bin\/perl,\/usr\/bin\/perl,g" ${WRKSRC}/cleanlink.pl @${MODAPACHE_CREATE_ENABLE_SCRIPT}
perl -pi -e "s,\/tmp\/apachebw,\/var\/www\/tmp\/apachebw,g" ${WRKSRC}/cleanlink.pl
do-install: do-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mod_bandwidth ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mod_bandwidth
${INSTALL_DATA} ${WRKBUILD}/mod_bandwidth.so ${PREFIX}/lib
${INSTALL_SCRIPT} ${WRKBUILD}/mod_bandwidth-enable ${PREFIX}/sbin
${INSTALL_SCRIPT} ${WRKBUILD}/cleanlink.pl ${PREFIX}/sbin ${INSTALL_SCRIPT} ${WRKBUILD}/cleanlink.pl ${PREFIX}/sbin
@head -376 ${WRKSRC}/mod_bandwidth.c \ @head -378 ${WRKSRC}/mod_bandwidth.c \
> ${PREFIX}/share/doc/mod_bandwidth/README.mod_bandwidth > ${PREFIX}/share/doc/mod_bandwidth/README.mod_bandwidth
${MODAPACHE_INSTALL}
.include <bsd.port.mk> .include <bsd.port.mk>

View File

@ -1,10 +1,10 @@
MD5 (mod_bandwidth/cleanlink.pl) = SQS4arapL2N3gQliKkbUvA== MD5 (mod_bandwidth/cleanlink.pl) = SQS4arapL2N3gQliKkbUvA==
MD5 (mod_bandwidth/mod_bandwidth.c) = i6srnJeAcvY6DKZOHQ+D5Q== MD5 (mod_bandwidth/mod_bandwidth.c) = Yrm7x0F7gqtWIq/mqZUeuQ==
RMD160 (mod_bandwidth/cleanlink.pl) = d5+SwIYToWsIFKtKPP8JqWuydoU= RMD160 (mod_bandwidth/cleanlink.pl) = d5+SwIYToWsIFKtKPP8JqWuydoU=
RMD160 (mod_bandwidth/mod_bandwidth.c) = HCMZt7ekyWgAFZU/35U4AurA5vc= RMD160 (mod_bandwidth/mod_bandwidth.c) = uKVUSsnaaR+VtJlGMdcBr1kgtHU=
SHA1 (mod_bandwidth/cleanlink.pl) = i/LnMrRhoYTDtCTiiG0zpNdqGro= SHA1 (mod_bandwidth/cleanlink.pl) = i/LnMrRhoYTDtCTiiG0zpNdqGro=
SHA1 (mod_bandwidth/mod_bandwidth.c) = sY3Dv1FQYBLraSEsyPVKl9sLXoA= SHA1 (mod_bandwidth/mod_bandwidth.c) = DLN1N2V7q0RXmY5rP+4zesEVgcQ=
SHA256 (mod_bandwidth/cleanlink.pl) = 6M5qC2hiG8mM6wPpA5HHFCbqbdMpswg5AYB7CEB5wNw= SHA256 (mod_bandwidth/cleanlink.pl) = 6M5qC2hiG8mM6wPpA5HHFCbqbdMpswg5AYB7CEB5wNw=
SHA256 (mod_bandwidth/mod_bandwidth.c) = 4s+o6+U0DNCiogxwSLLUnu1x08n/02L+Mleb/t8JQQ0= SHA256 (mod_bandwidth/mod_bandwidth.c) = g6eDNOhzN3sNpzq1mV5MQhsqgsVdKjBY1WJSbySDcbY=
SIZE (mod_bandwidth/cleanlink.pl) = 1009 SIZE (mod_bandwidth/cleanlink.pl) = 1009
SIZE (mod_bandwidth/mod_bandwidth.c) = 44217 SIZE (mod_bandwidth/mod_bandwidth.c) = 45481

View File

@ -1,17 +0,0 @@
#!/bin/sh
# $OpenBSD: mod_bandwidth-enable,v 1.1.1.1 2006/10/18 14:58:30 ajacoutot Exp $
MODULE=!!PREFIX!!/lib/mod_bandwidth.so
if [ `id -u` -ne 0 ]; then
echo "You must be root to run this script."
exit
fi
if [ ! -f ${MODULE} ]; then
echo "Cannot find mod_bandwidth module (${MODULE})"
exit 1
else
echo "Enabling Bandwidth module..."
/usr/sbin/apxs -i -a -n bandwidth ${MODULE}
fi

View File

@ -1,30 +1,30 @@
$OpenBSD: patch-mod_bandwidth_c,v 1.1.1.1 2006/10/18 14:58:30 ajacoutot Exp $ $OpenBSD: patch-mod_bandwidth_c,v 1.2 2007/06/21 10:58:38 ajacoutot Exp $
--- mod_bandwidth.c.orig Fri Sep 22 08:50:16 2006 --- mod_bandwidth.c.orig Thu Jun 21 09:46:46 2007
+++ mod_bandwidth.c Fri Sep 22 08:59:52 2006 +++ mod_bandwidth.c Thu Jun 21 09:48:12 2007
@@ -144,11 +144,15 @@ @@ -145,11 +145,15 @@
* /==== by Awesome Walrus <walrus@amur.ru> =====================\ * /==== by Awesome Walrus <walrus@amur.ru> =====================\
* - BandWidthDataDir * - BandWidthDataDir
* Syntax : BandWidthDataDir <directory> * Syntax : BandWidthDataDir <directory>
- * Default : "/tmp/apachebw" - * Default : "/tmp/apachebw"
+ * Default : "tmp/apachebw" + * Default : "tmp/apachebw"
* Context : server config * Context : server config
* *
* Sets the name of the directory used by mod_bandwidth to store * Sets the name of the directory used by mod_bandwidth to store
* its internal temporary information. * its internal temporary information.
+ * If Apache is running in a chroot(2), this directive must be + * If Apache is running in a chroot(2), this directive must be
+ * set relatively to ServerRoot ("tmp/apachebw"). + * set relatively to ServerRoot ("tmp/apachebw").
+ * If Apache is running in an "unsecure" not chroot(2)ed mode, + * If Apache is running in an "unsecure" not chroot(2)ed mode,
+ * then the absolute path is needed ("/var/www/tmp/apachebw") + * then the absolute path is needed ("/var/www/tmp/apachebw")
* \==== by Awesome Walrus <walrus@amur.ru> =====================/ * \==== by Awesome Walrus <walrus@amur.ru> =====================/
* *
* - BandWidthModule * - BandWidthModule
@@ -496,7 +500,8 @@ static const char *bandwidthmodule(cmd_p @@ -500,7 +504,8 @@ static const char *bandwidthmodule(cmd_parms *cmd, ban
static const char *set_bandwidth_data_dir(cmd_parms *cmd, void *dummy, char *arg) { static const char *set_bandwidth_data_dir(cmd_parms *cmd, void *dummy, char *arg) {
arg = ap_os_canonical_filename(cmd->pool, arg); arg = ap_os_canonical_filename(cmd->pool, arg);
- if (!ap_is_directory(arg)) { - if (!ap_is_directory(arg)) {
+ const char *fpath = ap_server_root_relative(cmd->pool, arg); + const char *fpath = ap_server_root_relative(cmd->pool, arg);
+ if (!ap_is_directory(fpath)) { + if (!ap_is_directory(fpath)) {
return "BandWidthDataDir must be a valid directory"; return "BandWidthDataDir must be a valid directory";
} }
ap_cpystrn(bandwidth_data_dir, arg, sizeof(bandwidth_data_dir)); ap_cpystrn(bandwidth_data_dir, arg, sizeof(bandwidth_data_dir));

View File

@ -1,13 +1,14 @@
To finish the install of ${PKGNAME}, you need To finish the install of ${PKGNAME}, you need
to enable the module using the following command to enable the module using the following command
${PREFIX}/sbin/mod_bandwidth-enable ${PREFIX}/sbin/${MODAPACHE_ENABLE}
If you already have Apache running on your machine, If you already have Apache running on your machine,
you should not use "apachectl restart" - instead, you should not use "apachectl restart" - instead,
you should fully stop and then start the server. you should fully stop and then start the server.
Help is available in: Make sure you created the master/ and link/ directories before starting
the server. Help is available in:
${PREFIX}/share/doc/mod_bandwidth/README.mod_bandwidth ${PREFIX}/share/doc/mod_bandwidth/README.mod_bandwidth
For correct results, it is important that there aren't any "dead" links For correct results, it is important that there aren't any "dead" links

View File

@ -1,7 +1,8 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2006/10/18 14:58:30 ajacoutot Exp $ @comment $OpenBSD: PLIST,v 1.2 2007/06/21 10:58:38 ajacoutot Exp $
lib/mod_bandwidth.so lib/${MODAPACHE_MODULE}
@exec-update test -f ${MODAPACHE_FINAL} && cp -fp %D/%F ${MODAPACHE_FINAL}
sbin/cleanlink.pl sbin/cleanlink.pl
sbin/mod_bandwidth-enable sbin/${MODAPACHE_ENABLE}
share/doc/mod_bandwidth/ share/doc/mod_bandwidth/
share/doc/mod_bandwidth/README.mod_bandwidth share/doc/mod_bandwidth/README.mod_bandwidth
@unexec rm -f /usr/lib/apache/modules/mod_bandwidth.so @unexec-delete rm -f ${MODAPACHE_FINAL}