229 lines
7.5 KiB
RPMSpec
229 lines
7.5 KiB
RPMSpec
|
|
%define name w3perl
|
||
|
|
%define version 3.19
|
||
|
|
%define release 1%{?dist}
|
||
|
|
%define basedir /var/www/w3perl
|
||
|
|
%define docs %{basedir}/docs
|
||
|
|
%define cfg1 %{basedir}/config
|
||
|
|
%define cfg2 %{basedir}/resources/admin
|
||
|
|
%define cgi /var/www/cgi-bin/w3perl
|
||
|
|
%define perl_path %(which perl)
|
||
|
|
%define mod_conf w3perl.conf
|
||
|
|
%define urpmi_readme_doc %{_defaultdocdir}/%{name}
|
||
|
|
|
||
|
|
Summary: Web/ftp/mail/squid/cups/dhcp/ssh server log file analyzer
|
||
|
|
Name: %{name}
|
||
|
|
Version: %{version}
|
||
|
|
Release: %{release}
|
||
|
|
Source0: http://www.w3perl.com/download/%{name}-%{version}.tar.bz2
|
||
|
|
License: GPLv3+
|
||
|
|
Group: Networking/WWW
|
||
|
|
URL: http://www.w3perl.com/
|
||
|
|
BuildRequires: perl >= 5.0
|
||
|
|
Requires: perl >= 5.0
|
||
|
|
Requires: webserver
|
||
|
|
BuildRoot: %{_tmppath}/%{name}-buildroot
|
||
|
|
Prefix: %{basedir}
|
||
|
|
Prefix: %{cgi}
|
||
|
|
BuildArch: noarch
|
||
|
|
|
||
|
|
%description
|
||
|
|
W3Perl is a free web log file analyzer which is also able to parse FTP,
|
||
|
|
Mail, CUPS, DHCP, SSH and Squid log files.
|
||
|
|
|
||
|
|
It is one of the most powerful package as it includes advanced stats
|
||
|
|
like real-time, sessions, URL mapping along with classical
|
||
|
|
stats like hosts, pages, traffic, countries, agents, referrers, errors,
|
||
|
|
file types, robots, search engines and much more.
|
||
|
|
|
||
|
|
It supports most logfile formats, including Apache (CLF, ECLF, NECLF)
|
||
|
|
or IIS (W3C, Microsoft or any variation). Logs can be daily or monthly
|
||
|
|
split and/or compressed.
|
||
|
|
|
||
|
|
A web administration tool allows you to manage your configuration
|
||
|
|
files to customize your stats output. A demo is available at
|
||
|
|
http://www.w3perl.com/demo/
|
||
|
|
|
||
|
|
%prep
|
||
|
|
%setup -q
|
||
|
|
|
||
|
|
%install
|
||
|
|
rm -rf $RPM_BUILD_ROOT
|
||
|
|
%{perl_path} install.pl -r $RPM_BUILD_ROOT -i $RPM_BUILD_ROOT%{basedir} -d $RPM_BUILD_ROOT%{cgi} -p %{perl_path}
|
||
|
|
ln -sf install.pl %{buildroot}%{basedir}/upgrade.pl
|
||
|
|
|
||
|
|
# Web app config file
|
||
|
|
cat <<EOF > %{mod_conf}
|
||
|
|
Alias /%{name} %{basedir}
|
||
|
|
<Directory %{basedir}>
|
||
|
|
Allow from all
|
||
|
|
</Directory>
|
||
|
|
EOF
|
||
|
|
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf/webapps.d
|
||
|
|
install -m0644 %{mod_conf} %{buildroot}%{_sysconfdir}/httpd/conf/webapps.d/%{mod_conf}
|
||
|
|
|
||
|
|
cat > README.urpmi <<EOF
|
||
|
|
|
||
|
|
--- W3Perl has been successfully installed ---
|
||
|
|
|
||
|
|
The resource files are located in %{basedir}
|
||
|
|
The cgi scripts are located in %{cgi}
|
||
|
|
|
||
|
|
In order to get your stats :
|
||
|
|
1- First, password protect the %{basedir}/admin directory
|
||
|
|
* add an htaccess file or/and add your IP in %{basedir}/admin/pass.txt
|
||
|
|
2- Open a browser to http://127.0.0.1/w3perl/admin
|
||
|
|
3- Build your own configuration file
|
||
|
|
* use 'clone' to start from a predefined configuration file
|
||
|
|
4- Compute your stats either from web admin OR command line
|
||
|
|
4a -> Web admin : Select 'Init all stats' with your configuration file
|
||
|
|
4b -> Command line : Run cron-w3perl.pl -a -c <your config file>
|
||
|
|
5- When completed, go back to admin and view the output
|
||
|
|
|
||
|
|
EOF
|
||
|
|
|
||
|
|
# No need to ship the license if it's standard
|
||
|
|
rm -f %{buildroot}%{basedir}/LICENCE
|
||
|
|
|
||
|
|
|
||
|
|
%post
|
||
|
|
|
||
|
|
# Relocatable
|
||
|
|
if test "x$RPM_INSTALL_PREFIX1" != "x" ; then
|
||
|
|
perl -pi -e "s|conf_file = \"%{cgi}|conf_file = \"$RPM_INSTALL_PREFIX1| if (/\# install/)" $RPM_INSTALL_PREFIX1/libw3perl.pl
|
||
|
|
perl -pi -e "s|cgipath = \"%{cgi}|cgipath = \"$RPM_INSTALL_PREFIX1| if (/\# cgipath_install/);" $RPM_INSTALL_PREFIX1/libw3perl.pl
|
||
|
|
perl -pi -e "s|require \"%{cgi}|require \"$RPM_INSTALL_PREFIX1| if (/check_modules/);" $RPM_INSTALL_PREFIX1/libw3perl.pl
|
||
|
|
perl -pi -e "s|cgipath = \"%{cgi}|cgipath = \"$RPM_INSTALL_PREFIX1|" $RPM_INSTALL_PREFIX1/init.pl
|
||
|
|
perl -pi -e "s|w3perlpath = \"%{basedir}|w3perlpath = \"$RPM_INSTALL_PREFIX0|" $RPM_INSTALL_PREFIX1/init.pl
|
||
|
|
perl -pi -e "s|require \"%{cgi}|require \"$RPM_INSTALL_PREFIX1|;" $RPM_INSTALL_PREFIX1/confstat.pl
|
||
|
|
perl -pi -e "s|Alias \/%{name} %{basedir}|Alias \/%{name} $RPM_INSTALL_PREFIX0|;" %{_sysconfdir}/httpd/conf/webapps.d/%{mod_conf}
|
||
|
|
perl -pi -e "s|Directory %{basedir}|Directory $RPM_INSTALL_PREFIX0|;" %{_sysconfdir}/httpd/conf/webapps.d/%{mod_conf}
|
||
|
|
perl -pi -e "s|^Perl\s(.*)|Perl %{perl_path}|;" $RPM_INSTALL_PREFIX0/upgrade.txt
|
||
|
|
perl -pi -e "s|%{basedir}|$RPM_INSTALL_PREFIX0|;" $RPM_INSTALL_PREFIX0/upgrade.txt
|
||
|
|
perl -pi -e "s|%{cgi}|$RPM_INSTALL_PREFIX1|;" $RPM_INSTALL_PREFIX0/upgrade.txt
|
||
|
|
perl -pi -e "s|%{basedir}|$RPM_INSTALL_PREFIX0|;" %{urpmi_readme_doc}/README.urpmi
|
||
|
|
perl -pi -e "s|%{cgi}|$RPM_INSTALL_PREFIX1|;" %{urpmi_readme_doc}/README.urpmi
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Upgrade
|
||
|
|
if [ "$1" = "2" ]; then
|
||
|
|
%{perl_path} $RPM_INSTALL_PREFIX0/upgrade.pl -i $RPM_INSTALL_PREFIX0 -d $RPM_INSTALL_PREFIX1
|
||
|
|
echo
|
||
|
|
echo "--- W3Perl has been successfully upgraded to %{version} ---"
|
||
|
|
echo
|
||
|
|
fi
|
||
|
|
rm $RPM_INSTALL_PREFIX0/libw3perl.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/cron-*
|
||
|
|
rm $RPM_INSTALL_PREFIX0/check_modules.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/admin/scripts/*.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/config/config-ftp-iis.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/config/config-iis.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/config/config-win-abyss.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/config/config-win-apache.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/config/config-win.pl
|
||
|
|
rm $RPM_INSTALL_PREFIX0/resources/admin/config-ftp-iis
|
||
|
|
rm $RPM_INSTALL_PREFIX0/resources/admin/config-iis
|
||
|
|
rm $RPM_INSTALL_PREFIX0/resources/admin/config-win-abyss
|
||
|
|
rm $RPM_INSTALL_PREFIX0/resources/admin/config-win-apache
|
||
|
|
rm $RPM_INSTALL_PREFIX0/resources/admin/config-win
|
||
|
|
rm -r $RPM_INSTALL_PREFIX0/tools/windows
|
||
|
|
|
||
|
|
if [ -f /var/lock/subsys/httpd ]; then
|
||
|
|
%{_initrddir}/httpd restart 1>&2;
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ "$1" = "1" ]; then
|
||
|
|
cat %{urpmi_readme_doc}/README.urpmi
|
||
|
|
fi
|
||
|
|
|
||
|
|
%postun
|
||
|
|
if [ "$1" = "0" ]; then
|
||
|
|
if [ -f /var/lock/subsys/httpd ]; then
|
||
|
|
%{_initrddir}/httpd restart 1>&2
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
%clean
|
||
|
|
rm -rf $RPM_BUILD_ROOT
|
||
|
|
|
||
|
|
%files
|
||
|
|
%doc README.urpmi
|
||
|
|
%doc %{basedir}/README
|
||
|
|
%doc %{basedir}/VERSION
|
||
|
|
#%doc %{basedir}/LICENSE
|
||
|
|
%doc %{docs}
|
||
|
|
%{basedir}/INSTALL
|
||
|
|
|
||
|
|
%{basedir}/index.html
|
||
|
|
%attr(0755,-,-) %{basedir}/*.pl
|
||
|
|
%{basedir}/upgrade.txt
|
||
|
|
|
||
|
|
%{basedir}/admin
|
||
|
|
%{basedir}/logs
|
||
|
|
%{basedir}/tools
|
||
|
|
%dir %{basedir}/resources
|
||
|
|
%dir %{basedir}
|
||
|
|
|
||
|
|
%{basedir}/resources/*.jpg
|
||
|
|
%{basedir}/resources/*.gif
|
||
|
|
%{basedir}/resources/*.png
|
||
|
|
%{basedir}/resources/*.ico
|
||
|
|
%{basedir}/resources/*.nsi
|
||
|
|
%{basedir}/resources/*.spec
|
||
|
|
%{basedir}/resources/fileext
|
||
|
|
%{basedir}/resources/pays-conv
|
||
|
|
%{basedir}/resources/upgrade
|
||
|
|
%{basedir}/resources/virus
|
||
|
|
%{basedir}/resources/new_package
|
||
|
|
%{basedir}/resources/convert_jvectormap.pl
|
||
|
|
%{basedir}/resources/jvectormap_convert.cmd
|
||
|
|
%{basedir}/resources/robot.txt
|
||
|
|
%{basedir}/resources/gpl.txt
|
||
|
|
%{basedir}/resources/referrer-standard.txt
|
||
|
|
%{basedir}/resources/referrer-keyword.txt
|
||
|
|
%{basedir}/resources/resolv_users.csv.example
|
||
|
|
%{basedir}/resources/spip
|
||
|
|
%{basedir}/resources/css
|
||
|
|
%{basedir}/resources/js
|
||
|
|
%{basedir}/resources/flags
|
||
|
|
%{basedir}/resources/help
|
||
|
|
%{basedir}/resources/os
|
||
|
|
%{basedir}/resources/homepage
|
||
|
|
%{basedir}/resources/lang
|
||
|
|
%{basedir}/resources/counter
|
||
|
|
%{basedir}/resources/Readme-tag.txt
|
||
|
|
%{basedir}/resources/tag_log.php
|
||
|
|
%{basedir}/resources/heatmap.php
|
||
|
|
|
||
|
|
%defattr(0755,apache,apache,-)
|
||
|
|
%dir %{cfg1}
|
||
|
|
%dir %{cfg2}
|
||
|
|
|
||
|
|
%attr(0644,apache,apache) %{cfg1}/*
|
||
|
|
%attr(0644,apache,apache) %{cfg2}/*
|
||
|
|
|
||
|
|
%defattr(0755,root,root,-)
|
||
|
|
%{cgi}
|
||
|
|
|
||
|
|
%defattr(0644,root,root,-)
|
||
|
|
%{_sysconfdir}/httpd/conf/webapps.d/%{mod_conf}
|
||
|
|
|
||
|
|
%changelog
|
||
|
|
* Thu May 29 2014 Laurent Domisse <domisse@w3perl.com> 1.190-1
|
||
|
|
- Remove /resources/pays/, /resources/pays-coord
|
||
|
|
- Add /resources/convert_jvectormap.pl and /resources/jvectormap_convert.cmd
|
||
|
|
|
||
|
|
* Tue Oct 29 2013 Laurent Domisse <domisse@w3perl.com> 1.8-1
|
||
|
|
- Use = rather than == for sh shell
|
||
|
|
|
||
|
|
* Mon Jun 03 2013 Laurent Domisse <domisse@w3perl.com> 1.173-1
|
||
|
|
- Remove Windows files
|
||
|
|
|
||
|
|
* Tue May 29 2013 Laurent Domisse <domisse@w3perl.com> 1.172-3
|
||
|
|
- Relocation available with --relocate /var/www/w3perl = NEWPATH --relocate /var/www/cgi-bin/w3perl = NEWCGIPATH
|
||
|
|
|
||
|
|
* Sat May 25 2013 Laurent Domisse <domisse@w3perl.com> 1.172-2
|
||
|
|
- Upgrade.txt file and symlink added, fix %defattr
|
||
|
|
|
||
|
|
* Tue May 21 2013 Laurent Domisse <domisse@w3perl.com> 1.172-1
|
||
|
|
- Cleanup
|