Revived as addon: squid graphs 3.2

Message ID 20171112003456.10198-1-matthias.fischer@ipfire.org
State Superseded
Headers
Series Revived as addon: squid graphs 3.2 |

Commit Message

Matthias Fischer Nov. 12, 2017, 11:34 a.m. UTC
  Hi,

For details see:
https://sourceforge.net/projects/squid-graph/

"Squid Graph is a free, simple, yet powerful Squid v2 native logfile analysis tool
that generates reports with graphical representation of the proxy server's traffic,
somewhat like the popular MRTG tool."

I found by chance that the corresponding translation strings were still present,
so I thought "Why not?". ;-)

After some tests I decided to revive this tool - here it is as an IPFire addon.

The original GUI and scripts were slightly tuned, localised and polished for better readability,
translations went in '/var/ipfire/addon-lang' for better handling.

For better GUI integration I had to move the 'entropy'-STATUS-entry one step down, so that
the '*-graphs' entries were lying together. I found no problems with that during testing.

Updates are made every five minutes through '/etc/fcron.cyclic', so there was no need to
patch '/usr/local/bin/makegraphs' as before.

Please test and report. ;-)

Best,
Matthias

P.S.: Removed some unnecessary spaces in 'make.sh'

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
 config/menu/20-status.menu            |   2 +-
 config/rootfiles/packages/squid-graph |  16 +++++
 lfs/squid-graph                       | 110 ++++++++++++++++++++++++++++++++++
 make.sh                               |   5 +-
 src/paks/squid-graph/install.sh       |  31 ++++++++++
 src/paks/squid-graph/uninstall.sh     |  29 +++++++++
 src/paks/squid-graph/update.sh        |  26 ++++++++
 7 files changed, 216 insertions(+), 3 deletions(-)
 create mode 100644 config/rootfiles/packages/squid-graph
 create mode 100644 lfs/squid-graph
 create mode 100644 src/paks/squid-graph/install.sh
 create mode 100644 src/paks/squid-graph/uninstall.sh
 create mode 100644 src/paks/squid-graph/update.sh
  

Comments

Matthias Fischer Nov. 12, 2017, 9:11 p.m. UTC | #1
Hi,

On 12.11.2017 01:34, Matthias Fischer wrote:
> Hi,
> 
> For details see:
> https://sourceforge.net/projects/squid-graph/
> ...

Ok guys - sorry for the noise, but currently I'm not so fit as I'd like
to be (flu).

After looking at my upload results in patchwork and GIT and - for
example - thinking about future updates I decided to rework this addon
from scratch. So for now I'll change this to 'under review' in patchwork.

Reasons for this:
During testing its installing and working ok, BUT(!)...

Publishing or merging 'squid-graph' the way I did would induce the need
to pack and upload a NEW archive every time something gets changed. Be
it a language-file or some script or some GUI-file or something else.

After looking at this, I thought it would be better and easier to
maintain this addon if I build and pack it like 'squid-accounting' or
'wio' (e.g.).

Again: sorry for the noise - I'm working on it.

Best,
Matthias
  
Michael Tremer Nov. 14, 2017, 9:56 a.m. UTC | #2
Hi,

On Sun, 2017-11-12 at 11:11 +0100, Matthias Fischer wrote:
> Hi,
> 
> On 12.11.2017 01:34, Matthias Fischer wrote:
> > Hi,
> > 
> > For details see:
> > https://sourceforge.net/projects/squid-graph/
> > ...
> 
> Ok guys - sorry for the noise, but currently I'm not so fit as I'd like
> to be (flu).

That's fine. Get better soon.

> After looking at my upload results in patchwork and GIT and - for
> example - thinking about future updates I decided to rework this addon
> from scratch. So for now I'll change this to 'under review' in patchwork.
> 
> Reasons for this:
> During testing its installing and working ok, BUT(!)...
> 
> Publishing or merging 'squid-graph' the way I did would induce the need
> to pack and upload a NEW archive every time something gets changed. Be
> it a language-file or some script or some GUI-file or something else.
> 
> After looking at this, I thought it would be better and easier to
> maintain this addon if I build and pack it like 'squid-accounting' or
> 'wio' (e.g.).

Well, since there is an upstream project, I think it is probably best
to use their tarball and have patches against the latest release.

However, this is indeed quite old, so it might make sense to fork it
and have an own git repository to work on it and release every once in
a while. Like we do with guardian...

Maybe it makes sense to get in touch with the original maintainer and
see where that goes. That depends on what changes you are going to
make.

Best,
-Michael

> 
> Again: sorry for the noise - I'm working on it.
> 
> Best,
> Matthias
  
Matthias Fischer Nov. 14, 2017, 10:48 p.m. UTC | #3
Hi,

On 13.11.2017 23:56, Michael Tremer wrote:
> Hi,
> 
> On Sun, 2017-11-12 at 11:11 +0100, Matthias Fischer wrote:
>> Hi,
>> 
>> On 12.11.2017 01:34, Matthias Fischer wrote:
>> > Hi,
>> > 
>> > For details see:
>> > https://sourceforge.net/projects/squid-graph/
>> > ...
>> After looking at this, I thought it would be better and easier to
>> maintain this addon if I build and pack it like 'squid-accounting' or
>> 'wio' (e.g.).
> 
> Well, since there is an upstream project, I think it is probably best
> to use their tarball and have patches against the latest release.

Somehow I knew you would write that... ;-)
I thought about that, too.

> However, this is indeed quite old, so it might make sense to fork it
> and have an own git repository to work on it and release every once in
> a while. Like we do with guardian...
> 
> Maybe it makes sense to get in touch with the original maintainer and
> see where that goes. That depends on what changes you are going to
> make.

Hm. I have the feeling that this could be a timeconsuming procedure with
some up and downs and I would want to get this thing done somehow. So
prior to search for a - in the meantime no longer existent? - original
maintainer, I'd prefer to use the upstream package like in acient days
(IPCop) and apply a patch. I don't change anything in the original
working code, I just do some 'polishing'.

IPCop did it that way with some 'sed'-lines. There is only one file to
patch, everything else are added scripts from us for integration in
IPFire (controlling, polishing and localisation) and for Pakfire.

As a result we would have ONE file to download and a few files to
maintain which could be easily done through GIT.

What do you think?

Best,
Matthias
  
Matthias Fischer Nov. 16, 2017, 12:17 a.m. UTC | #4
Hi,

On 13.11.2017 23:56, Michael Tremer wrote:
> Hi,
> 
> On Sun, 2017-11-12 at 11:11 +0100, Matthias Fischer wrote:
>> Hi,
>> 
>> On 12.11.2017 01:34, Matthias Fischer wrote:
>> > Hi,
>> > 
>> > For details see:
>> > https://sourceforge.net/projects/squid-graph/
>> > ...
>> 
>> Ok guys - sorry for the noise, but currently I'm not so fit as I'd like
>> to be (flu).
> 
> That's fine. Get better soon.
Y
>> After looking at my upload results in patchwork and GIT and - for
>> example - thinking about future updates I decided to rework this addon
>> from scratch. So for now I'll change this to 'under review' in patchwork.
>> 
>> Reasons for this:
>> During testing its installing and working ok, BUT(!)...
>> 
>> Publishing or merging 'squid-graph' the way I did would induce the need
>> to pack and upload a NEW archive every time something gets changed. Be
>> it a language-file or some script or some GUI-file or something else.
>> 
>> After looking at this, I thought it would be better and easier to
>> maintain this addon if I build and pack it like 'squid-accounting' or
>> 'wio' (e.g.).
> 
> Well, since there is an upstream project, I think it is probably best
> to use their tarball and have patches against the latest release.

Done. Patch was easy, lfs-file a bit tricky, but looking good now.

> However, this is indeed quite old, so it might make sense to fork it
> and have an own git repository to work on it and release every once in
> a while. Like we do with guardian...
> 
> Maybe it makes sense to get in touch with the original maintainer and
> see where that goes. That depends on what changes you are going to
> make.

I thought this over => created a sourceforge account today and sent an
email to the original maintainer (detach8?), asking if he would mind if
I adapt 'squid-graph 3.2 for IPFire. Waiting for response...

Best,
Matthias
  

Patch

diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu
index 2bcf0d5e8..2e7c579e3 100644
--- a/config/menu/20-status.menu
+++ b/config/menu/20-status.menu
@@ -58,7 +58,7 @@ 
 				'title' => "$Lang::tr{'hardware graphs'}",
 				'enabled' => 1,
 			  };
-    $substatus->{'61.entropy'} = {
+    $substatus->{'62.entropy'} = {
 				'caption' => "$Lang::tr{'entropy'}",
 				'uri' => '/cgi-bin/entropy.cgi',
 				'title' => "$Lang::tr{'entropy graphs'}",
diff --git a/config/rootfiles/packages/squid-graph b/config/rootfiles/packages/squid-graph
new file mode 100644
index 000000000..4da515229
--- /dev/null
+++ b/config/rootfiles/packages/squid-graph
@@ -0,0 +1,16 @@ 
+etc/fcron.cyclic/update-squid-graphs
+srv/web/ipfire/cgi-bin/sgraphs.cgi
+srv/web/ipfire/html/sgraph
+srv/web/ipfire/html/sgraph/logo.png
+usr/bin/squid-graphs
+usr/local/bin/update-squid-graphs.sh
+var/ipfire/addon-lang/squid-graphs.de.pl
+var/ipfire/addon-lang/squid-graphs.en.pl
+var/ipfire/addon-lang/squid-graphs.es.pl
+var/ipfire/addon-lang/squid-graphs.fr.pl
+var/ipfire/addon-lang/squid-graphs.it.pl
+var/ipfire/addon-lang/squid-graphs.nl.pl
+var/ipfire/addon-lang/squid-graphs.pl.pl
+var/ipfire/addon-lang/squid-graphs.ru.pl
+var/ipfire/addon-lang/squid-graphs.tr.pl
+var/ipfire/menu.d/EX-squid-graphs.menu
diff --git a/lfs/squid-graph b/lfs/squid-graph
new file mode 100644
index 000000000..1ba975d5e
--- /dev/null
+++ b/lfs/squid-graph
@@ -0,0 +1,110 @@ 
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007-2017  IPFire Team  <info@ipfire.org>                     #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 3.2
+
+THISAPP    = squid-graph-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+PAK_VER    = 1
+PROG       = squid-graph
+
+DEPS       = ""
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = eaa3051dd36456a7b1d8eadb8605e201
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist:
+	$(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+	@$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+	@$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+	@$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+	@$(PREBUILD)
+	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+
+# Install GUI
+	install -v -m 755 $(DIR_SRC)/srv/web/ipfire/cgi-bin/sgraphs.cgi \
+		/srv/web/ipfire/cgi-bin/sgraphs.cgi
+
+# Create sgraph dir, install logo
+	-mkdir -p /srv/web/ipfire/html/sgraph
+	install -v -m 644 $(DIR_SRC)/srv/web/ipfire/html/sgraph/logo.png \
+		/srv/web/ipfire/html/sgraph/logo.png
+
+# Install main program
+	install -v -m 755 $(DIR_SRC)/usr/bin/squid-graphs \
+		/usr/bin/squid-graphs
+
+# Install update script
+	install -v -m 755 $(DIR_SRC)/usr/local/bin/update-squid-graphs.sh \
+		/usr/local/bin/update-squid-graphs.sh
+
+# Create symlink for five-minute-update-interval
+	ln -sf /usr/local/bin/update-squid-graphs.sh /etc/fcron.cyclic/update-squid-graphs
+
+# Install language files
+	install -v -m 004 $(DIR_SRC)/var/ipfire/addon-lang/squid-graphs.*.pl \
+		/var/ipfire/addon-lang/
+
+# Install menu entry
+	install -v -m 644 $(DIR_SRC)/var/ipfire/menu.d/EX-squid-graphs.menu \
+		/var/ipfire/menu.d/EX-squid-graphs.menu
+
+	@rm -rf $(DIR_APP)
+	@$(POSTBUILD)
diff --git a/make.sh b/make.sh
index f8a2e5b34..de31d1874 100755
--- a/make.sh
+++ b/make.sh
@@ -877,6 +877,7 @@  buildipfire() {
   lfsmake2 perl-Net-IP
   lfsmake2 wio
   lfsmake2 iftop
+  lfsmake2 squid-graph
 }
 
 buildinstaller() {
@@ -893,7 +894,7 @@  buildpackages() {
   export LOGFILE
   echo "... see detailed log in _build.*.log files" >> $LOGFILE
 
-  
+
   # Generating list of packages used
   echo -n "Generating packages list from logs" | tee -a $LOGFILE
   rm -f $BASEDIR/doc/packages-list
@@ -908,7 +909,7 @@  buildpackages() {
   rm -f $BASEDIR/doc/packages-list
   # packages-list.txt is ready to be displayed for wiki page
   beautify message DONE
-  
+
   # Update changelog
   cd $BASEDIR
   [ -z $GIT_TAG ]  || LAST_TAG=$GIT_TAG
diff --git a/src/paks/squid-graph/install.sh b/src/paks/squid-graph/install.sh
new file mode 100644
index 000000000..833c14435
--- /dev/null
+++ b/src/paks/squid-graph/install.sh
@@ -0,0 +1,31 @@ 
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+
+extract_files
+
+# Update language-cache
+/usr/local/bin/update-lang-cache
+
+restore_backup ${NAME}
diff --git a/src/paks/squid-graph/uninstall.sh b/src/paks/squid-graph/uninstall.sh
new file mode 100644
index 000000000..0823bc8b3
--- /dev/null
+++ b/src/paks/squid-graph/uninstall.sh
@@ -0,0 +1,29 @@ 
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+
+make_backup ${NAME}
+remove_files
+
+/usr/local/bin/update-lang-cache
diff --git a/src/paks/squid-graph/update.sh b/src/paks/squid-graph/update.sh
new file mode 100644
index 000000000..89c40d0d7
--- /dev/null
+++ b/src/paks/squid-graph/update.sh
@@ -0,0 +1,26 @@ 
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+./uninstall.sh
+./install.sh