/[smecontribs]/rpms/sarg/contribs10/sarg.spec
ViewVC logotype

Contents of /rpms/sarg/contribs10/sarg.spec

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Sat Aug 20 03:45:27 2022 UTC (2 years, 3 months ago) by jpp
Branch: MAIN
CVS Tags: sarg-2_4_0-1_el7_sme, HEAD
Changes since 1.2: +3 -3 lines
Error occurred while calculating annotation data.
* Fri Aug 19 2022 Jean-Philippe Pialasse <tests@pialasse.com> - 2.4.0-1
- Updated to version 2.4.0.

1 # $Id$
2 # Authority: dag
3 # Upstream: Pedro L. Orso <orso$onda,com,br>
4 # Upstream: <orso$yahoogroups,com>
5 # Tag: rft
6
7 Summary: Squid usage report generator per user/ip/name
8 Name: sarg
9 Version: 2.4.0
10 Release: 1%{?dist}
11 License: GPL
12 Group: Applications/Internet
13 URL: http://sarg.sourceforge.net/sarg.php
14
15 Packager: Dag Wieers <dag@wieers.com>
16 Vendor: Dag Apt Repository, http://dag.wieers.com/apt/
17
18 Source: http://downloads.sourceforge.net/project/sarg/sarg/sarg-%{version}/sarg-%{version}.tar.gz
19 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
20
21 BuildRequires: gd-devel >= 1.8
22 BuildRequires: openldap-devel
23 BuildRequires: perl
24 Requires: bash
25 Requires: gd >= 1.8
26 Requires: squid
27 Obsoletes: sqmgrlog
28
29 %description
30 Squid Analysis Report Generator is a tool that allows you to view "where"
31 your users are going to on the Internet. Sarg generate reports in html
32 showing users, IP addresses, bytes, sites and times.
33
34 %prep
35 %setup
36
37 %{__chmod} u+wx sarg-php/locale/
38
39 %{__perl} -pi.orig -e '
40 s|^#(access_log) (.+)$|#$1 $2\n$1 %{_localstatedir}/log/squid/access.log|;
41 s|^#(output_dir) (.+)$|#$1 $2\n$1 %{_localstatedir}/www/sarg/ONE-SHOT|;
42 s|^#(resolve_ip) (.+)$|#$1 $2\n$1 yes|;
43 s|^#(show_successful_message) (.+)$|#$1 $2\n$1 no|;
44 s|^#(mail_utility) (.+)$|#$1 $2\n$1 mail|;
45 s|^#(external_css_file) (.+)$|#$1 $2\n$1 %{_localstatedir}/www/sarg/sarg.css|;
46 ' sarg.conf
47
48 %{__cat} <<'EOF' >sarg.daily
49 #!/bin/bash
50
51 # Get yesterday's date
52 YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
53
54 exec %{_bindir}/sarg \
55 -o %{_localstatedir}/www/sarg/daily \
56 -d $YESTERDAY &>/dev/null
57 exit 0
58 EOF
59
60 %{__cat} <<'EOF' >sarg.weekly
61 #!/bin/bash
62 LOG_FILES=
63 for FILE in /var/log/squid/access.log*; do
64 LOG_FILES="$LOG_FILES -l $FILE"
65 done
66
67 # Get yesterday's date
68 YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
69
70 # Get one week ago date
71 WEEKAGO=$(date --date "7 days ago" +%d/%m/%Y)
72
73 exec %{_bindir}/sarg \
74 $LOG_FILES \
75 -o %{_localstatedir}/www/sarg/weekly \
76 -d $WEEKAGO-$YESTERDAY &>/dev/null
77 exit 0
78 EOF
79
80 %{__cat} <<'EOF' >sarg.monthly
81 #!/bin/bash
82 LOG_FILES=
83 for FILE in /var/log/squid/access.log*; do
84 LOG_FILES="$LOG_FILES -l $FILE"
85 done
86
87 # Get yesterday's date
88 YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
89
90 # Get 1 month ago date
91 MONTHAGO=$(date --date "1 month ago" +%d/%m/%Y)
92
93 exec %{_bindir}/sarg \
94 $LOG_FILES \
95 -o %{_localstatedir}/www/sarg/monthly \
96 -d $MONTHAGO-$YESTERDAY &>/dev/null
97 exit 0
98 EOF
99
100 %{__cat} <<EOF >sarg-index.html
101 <?xml version="1.0" encoding="iso-8859-1"?>
102 <!DOCTYPE html PUBLIC "XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
103 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
104 <head>
105 <title>Squid User's Access Report</title>
106 <style type="text/css">
107 #content { width:20em; margin-left:auto; margin-right:auto; }
108 h1 { color:green; font-size:1.2em; text-align:center; }
109 table#reports { border-collapse:collapse; width:20em; margin-left:auto; margin-right:auto; font-size:0.8em; }
110 table#reports td { padding:2px; background-color:#f5f5dc; border:solid white 1px; }
111 table#reports th { background-color:#feebcd; border:solid white 1px; color:#00008b; }
112 </style>
113 </head>
114 <body>
115
116 <div id="content">
117 <h1>Squid User's Access Report</h1>
118
119 <table summary="" id="reports">
120 <tbody>
121 <tr>
122 <th>DIRECTORY</th>
123 <th>DESCRIPTION</th>
124 </tr>
125 <tr>
126 <td><a href="ONE-SHOT/index.html">ONE-SHOT</a></td>
127 <td>One shot reports</td>
128 </tr>
129 <tr>
130 <td><a href="daily/index.html">daily</a></td>
131 <td>Daily reports</td>
132 </tr>
133 <tr>
134 <td><a href="weekly/index.html">weekly</a></td>
135 <td>Weekly reports</td>
136 </tr>
137 <tr>
138 <td><a href="monthly/index.html">monthly</a></td>
139 <td>Monthly reports</td>
140 </tr>
141 </tbody>
142 </table>
143 </div>
144 </body>
145 </html>
146 EOF
147
148 %{__cat} <<EOF >sarg-http.conf
149 Alias /sarg %{_localstatedir}/www/sarg
150
151 <Directory %{_localstatedir}/www/sarg>
152 DirectoryIndex index.html
153 Order deny,allow
154 Deny from all
155 Allow from 127.0.0.1
156 Allow from ::1
157 # Allow from your-workstation.com
158 </Directory>
159 EOF
160
161 %build
162 %configure \
163 --bindir="%{_bindir}" \
164 --sysconfdir="%{_sysconfdir}/sarg" \
165 --mandir="%{_mandir}/man1" \
166 --disable-rpath \
167 --disable-sargphp \
168 --enable-extraprotection \
169 --enable-imagedir="%{_sysconfdir}/sarg/images"
170 %{__make} %{?_smp_mflags} CFLAGS="%{optflags}"
171
172 %install
173 %{__rm} -rf %{buildroot}
174 %{__install} -Dp -m0755 sarg %{buildroot}%{_bindir}/sarg
175 %{__install} -Dp -m0644 sarg.conf %{buildroot}%{_sysconfdir}/sarg/sarg.conf
176 %{__install} -Dp -m0644 exclude_codes %{buildroot}%{_sysconfdir}/sarg/exclude_codes
177 %{__install} -Dp -m0644 sarg.1 %{buildroot}%{_mandir}/man1/sarg.1
178
179 %{__install} -Dp -m0644 sarg-http.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/sarg.conf
180 %{__install} -Dp -m0755 sarg.daily %{buildroot}%{_sysconfdir}/cron.daily/sarg
181 %{__install} -Dp -m0755 sarg.weekly %{buildroot}%{_sysconfdir}/cron.weekly/sarg
182 %{__install} -Dp -m0755 sarg.monthly %{buildroot}%{_sysconfdir}/cron.monthly/sarg
183 %{__install} -Dp -m0644 sarg-index.html %{buildroot}%{_localstatedir}/www/sarg/index.html
184 %{__install} -Dp -m0644 css.tpl %{buildroot}%{_localstatedir}/www/sarg/sarg.css
185
186 %{__install} -d -m0755 %{buildroot}%{_localstatedir}/www/sarg/{ONE-SHOT,daily,weekly,monthly}/
187 %{__cp} -av fonts/ images/ po/ %{buildroot}%{_sysconfdir}/sarg/
188
189 ### Clean up buildroot
190 %{__rm} -rf %{buildroot}%{_sysconfdir}/sarg/po/.new
191
192 %clean
193 %{__rm} -rf %{buildroot}
194
195 %files
196 %defattr(-, root, root, 0755)
197 %doc ChangeLog CONTRIBUTORS COPYING DONATIONS README
198 %doc %{_mandir}/man1/sarg.1*
199 %dir %{_sysconfdir}/sarg/
200 %config %{_sysconfdir}/sarg/exclude_codes
201 %config(noreplace) %{_sysconfdir}/sarg/sarg.conf
202 %config(noreplace) %{_sysconfdir}/httpd/conf.d/sarg.conf
203 %config %{_sysconfdir}/cron.daily/sarg
204 %config %{_sysconfdir}/cron.weekly/sarg
205 %config %{_sysconfdir}/cron.monthly/sarg
206 %{_bindir}/sarg
207 %{_localstatedir}/www/sarg/
208 %{_sysconfdir}/sarg/fonts/
209 %{_sysconfdir}/sarg/images/
210 %{_sysconfdir}/sarg/po/
211
212 %changelog
213 * Fri Aug 19 2022 Jean-Philippe Pialasse <tests@pialasse.com> - 2.4.0-1
214 - Updated to version 2.4.0.
215
216 * Thu Oct 13 2011 Thiago Coutinho <root@thiagoc.net> - 2.3.1-1
217 - Updated to version 2.3.1.
218 - Fixed cron scripts to support RHEL/CentOS 6.
219
220 * Tue Jun 22 2010 Christoph Maser <cmaser@gmx.de> - 2.3-2
221 - Build with ldap support.
222
223 * Tue Jun 22 2010 Christoph Maser <cmaser@gmx.de> - 2.3-1
224 - Updated to version 2.3.
225
226 * Thu Jun 19 2008 Dries Verachtert <dries@ulyssis.org> - 2.2.5-1
227 - Updated to release 2.2.5.
228
229 * Sat Aug 25 2007 Dag Wieers <dag@wieers.com> - 2.2.3.1-1
230 - Updated to release 2.2.3.1.
231
232 * Sat Aug 25 2007 Dag Wieers <dag@wieers.com> - 2.2.3-1
233 - Updated to release 2.2.3.
234 - Fixed typo in monthly script. (Rabie Van der Merwe)
235
236 * Mon May 29 2006 Dag Wieers <dag@wieers.com> - 2.2.1-1
237 - Updated to release 2.2.1.
238 - Many changes to reflect release 2.2. (Bernard Lheureux)
239
240 * Wed Aug 04 2004 Dag Wieers <dag@wieers.com> - 1.4.1-5
241 - Fixed ugly bug in weekly and monthly cron entries. (Viktor Zoubkov)
242
243 * Wed Jun 30 2004 Dag Wieers <dag@wieers.com> - 1.4.1-4
244 - Fixed default mail_utility. (John Florian)
245
246 * Sat Apr 10 2004 Dag Wieers <dag@wieers.com> - 1.4.1-3
247 - Fixed problem with inline cron-scripts. (Luigi Iotti)
248
249 * Tue Apr 06 2004 Dag Wieers <dag@wieers.com> - 1.4.1-2
250 - Fixed missing directories in sarg. (William Hooper)
251
252 * Wed Mar 17 2004 Dag Wieers <dag@wieers.com> - 1.4.1-1
253 - Initial package. (using DAR)

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed