Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Dec 2010 02:10:42 GMT
From:      chris petrik <c.petrik.sosa@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/153449: [PATCH] fix www/awstats awstats_configure.pl to run on BSD
Message-ID:  <201012260210.oBQ2AguZ043690@red.freebsd.org>
Resent-Message-ID: <201012260220.oBQ2K8Cv044855@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         153449
>Category:       ports
>Synopsis:       [PATCH] fix www/awstats awstats_configure.pl to run on BSD
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 26 02:20:08 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     chris petrik
>Release:        FreeBSD 8.2-PRE
>Organization:
none
>Environment:
N/A
>Description:
awstats_configure does not work in BSD due to it trying to edit the awstats_model.conf file in wwwroot. This dir does not exist. I managed to fix this on my VPS symlinking www/awstats www/awstats/wwwroot but this is not a valid fix. 

Added some example config files for BSD, due to the way bsd.apache.mk works I could make it detect which version based on APACHE_VER so I added apache(13,22)
>How-To-Repeat:
cd /usr/ports/www/awstats ; make install clean && ./usr/local/www/awstats/tools/awstats_configure.pl will die on the 4-5th step.
>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
RCS file: /usr/local/freebsdcvs/ports/www/awstats/Makefile,v
retrieving revision 1.44
diff -u -r1.44 Makefile
--- Makefile	12 Dec 2010 01:08:19 -0000	1.44
+++ Makefile	26 Dec 2010 02:00:07 -0000
@@ -39,7 +39,6 @@
 OPTIONS=	IPV6 "Enable IPV6 for use with IPv6 Plugin" Off
 
 .include <bsd.port.pre.mk>
-
 .if defined(WITH_IPV6)
 RUN_DEPENDS+=	${SITE_PERL}/Net/IP.pm:${PORTSDIR}/net-mgmt/p5-Net-IP
 RUN_DEPENDS+=	${SITE_PERL}/mach/Net/DNS.pm:${PORTSDIR}/dns/p5-Net-DNS
@@ -87,7 +86,7 @@
 	${INSTALL_SCRIPT} ${WRKSRC}/tools/urlaliasbuilder.pl ${PREFIX}/www/awstats/tools
 	${INSTALL_DATA} ${WRKSRC}/tools/xslt/* ${PREFIX}/www/awstats/tools/xslt
 	${INSTALL_SCRIPT} ${WRKSRC}/wwwroot/cgi-bin/awredir.pl ${PREFIX}/www/awstats/cgi-bin
-	${INSTALL_DATA} ${WRKSRC}/wwwroot/cgi-bin/awstats.model.conf ${PREFIX}/www/awstats/cgi-bin
+	${INSTALL_SCRIPT} ${WRKSRC}/wwwroot/cgi-bin/awstats.model.conf ${PREFIX}/www/awstats/cgi-bin
 	${INSTALL_SCRIPT} ${WRKSRC}/wwwroot/cgi-bin/awstats.pl ${PREFIX}/www/awstats/cgi-bin
 	${INSTALL_DATA} ${WRKSRC}/wwwroot/cgi-bin/lang/tooltips_f/*.txt ${PREFIX}/www/awstats/cgi-bin/lang/tooltips_f
 	${INSTALL_DATA} ${WRKSRC}/wwwroot/cgi-bin/lang/tooltips_m/*.txt ${PREFIX}/www/awstats/cgi-bin/lang/tooltips_m
@@ -112,7 +111,7 @@
 	${INSTALL_DATA} ${WRKSRC}/docs/*.* ${DOCSDIR}
 .endif
 	@${ECHO_CMD} ""
-	@${ECHO_CMD} "* Rename ${PREFIX}/www/awstats/cgi-bin/awstats.model.conf to awstats.site.conf to setup awstats"
+	@${ECHO_CMD} "* Use ${PREFIX}/www/awstats/tools/awstats_configure.pl to setup your hosts.
 .if !defined(NOPORTDOCS)
 	@${ECHO_CMD} "* Documentation has been installed in ${PREFIX}/share/doc/awstats"
 .endif
@@ -122,5 +121,4 @@
 post-install:
 	@${CAT} ${PKGMESSAGE}
 .endif
-
 .include <bsd.port.post.mk>
Index: files/patch-tools-awstats_configure.pl
===================================================================
RCS file: /usr/local/freebsdcvs/ports/www/awstats/files/patch-tools-awstats_configure.pl,v
retrieving revision 1.1
diff -u -r1.1 patch-tools-awstats_configure.pl
--- files/patch-tools-awstats_configure.pl	26 Oct 2005 00:30:46 -0000	1.1
+++ files/patch-tools-awstats_configure.pl	26 Dec 2010 02:01:47 -0000
@@ -1,17 +1,88 @@
---- tools/awstats_configure.pl.orig	Sat Jan 15 17:42:58 2005
-+++ tools/awstats_configure.pl	Thu Sep 22 20:34:07 2005
-@@ -29,10 +29,10 @@
+--- tools/awstats_configure.pl.old	2010-12-25 19:25:49.000000000 -0600
++++ tools/awstats_configure.pl	2010-12-25 19:33:43.000000000 -0600
+@@ -28,12 +28,13 @@
+ $AWSTATS_MODEL_CONFIG
  $AWSTATS_DIRDATA_PATH
  /;
- $AWSTATS_PATH='';
+-$AWSTATS_PATH='';
 -$AWSTATS_ICON_PATH='/usr/local/awstats/wwwroot/icon';
 -$AWSTATS_CSS_PATH='/usr/local/awstats/wwwroot/css';
 -$AWSTATS_CLASSES_PATH='/usr/local/awstats/wwwroot/classes';
 -$AWSTATS_CGI_PATH='/usr/local/awstats/wwwroot/cgi-bin';
+-$AWSTATS_MODEL_CONFIG='/etc/awstats/awstats.model.conf';		# Used only when configure ran on linux
++$AWSTATS_PATH='%%PREFIX%%/www/awstats';
 +$AWSTATS_ICON_PATH='%%PREFIX%%/www/awstats/icon';
 +$AWSTATS_CSS_PATH='%%PREFIX%%/www/awstats/css';
 +$AWSTATS_CLASSES_PATH='%%PREFIX%%/www/awstats/classes';
 +$AWSTATS_CGI_PATH='%%PREFIX%%/www/awstats/cgi-bin';
- $AWSTATS_MODEL_CONFIG='/etc/awstats/awstats.model.conf';		# Used only when configure ran on linux
++$AWSTATS_MODEL_CONFIG='%%PREFIX%%/etc/awstats/awstats.model.conf';		
++# Used only when configure ran on linux
  $AWSTATS_DIRDATA_PATH='/var/lib/awstats';						# Used only when configure ran on linux
-
+ 
+ 
+@@ -64,6 +65,7 @@
+ '/etc/httpd/httpd.conf',
+ '/usr/local/apache/conf/httpd.conf',
+ '/usr/local/apache2/conf/httpd.conf',
++'/usr/local/etc/apache(13/22)/httpd.conf',
+ );
+ 
+ use vars qw/
+@@ -309,7 +311,8 @@
+ 	$AWSTATS_PATH=`pwd`; $AWSTATS_PATH =~ s/[\r\n]//;
+ 	$AWSTATS_PATH=~s/tools[\\\/]?$//;
+ 	$AWSTATS_PATH=~s/[\\\/]$//;
+-	if ($AWSTATS_PATH ne '/usr/local/awstats') {
++#freebsd default %%PREFIX%%/www/awstats
++	if ($AWSTATS_PATH ne '/usr/local/www/awstats') {
+ 		print "Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'.\n";
+ 		print "If you want to use standard directory, you should first move all content\n";
+ 		print "of AWStats distribution from current directory:\n";
+@@ -324,10 +327,10 @@
+ 			print "configure.pl aborted.\n";
+ 			exit 1;
+ 		}
+-		$AWSTATS_ICON_PATH="$AWSTATS_PATH/wwwroot/icon";
+-		$AWSTATS_CSS_PATH="$AWSTATS_PATH/wwwroot/css";
+-		$AWSTATS_CLASSES_PATH="$AWSTATS_PATH/wwwroot/classes";
+-		$AWSTATS_CGI_PATH="$AWSTATS_PATH/wwwroot/cgi-bin";
++		$AWSTATS_ICON_PATH="$AWSTATS_PATH/icon";
++		$AWSTATS_CSS_PATH="$AWSTATS_PATH/css";
++		$AWSTATS_CLASSES_PATH="$AWSTATS_PATH/classes";
++		$AWSTATS_CGI_PATH="$AWSTATS_PATH/cgi-bin";
+ 	}
+ }
+ elsif ($OS eq 'macosx') {
+@@ -420,6 +423,7 @@
+ 
+ 		print "\n".($bidon?"Now, enter":"Enter")." full config file path of your Web server.\n";
+ 		print "Example: /etc/httpd/httpd.conf\n";
++		print "Example: %%PREFIX%%/etc/apache(13/22)/httpd.conf";
+ 		print "Example: /usr/local/apache2/conf/httpd.conf\n";
+ 		print "Example: c:\\Program files\\apache group\\apache\\conf\\httpd.conf\n";
+ 		$bidon='';
+@@ -527,7 +531,7 @@
+ #
+ # This is to permit URL access to scripts/files in AWStats directory.
+ #
+-<Directory "$AWSTATS_PATH/wwwroot">
++<Directory "$AWSTATS_PATH/">
+     Options None
+     AllowOverride None
+     Order allow,deny
+@@ -546,12 +550,12 @@
+ # -----------------------------
+ my $modelfile='';
+ if ($OS eq 'linux') 		{ 
+-	if (-f "$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf") {
+-		$modelfile="$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf";
++	if (-f "$AWSTATS_PATH/cgi-bin/awstats.model.conf") {
++		$modelfile="$AWSTATS_PATH/cgi-bin/awstats.model.conf";
+ 	}
+ 	else {
+ 		$modelfile="$AWSTATS_MODEL_CONFIG";
+-		if (! -s $modelfile || ! -w $modelfile) { $modelfile="$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf"; }
++		if (! -s $modelfile || ! -w $modelfile) { $modelfile="$AWSTATS_PATH/cgi-bin/awstats.model.conf"; }
+ 	}
+ }
+ elsif ($OS eq "macosx") 		{ 


>Release-Note:
>Audit-Trail:
>Unformatted:



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