Revived (as addon): squid graphs 3.2

Message ID 20171111214506.18007-1-matthias.fischer@ipfire.org
State Dropped
Headers
Series Revived (as addon): squid graphs 3.2 |

Commit Message

Matthias Fischer Nov. 12, 2017, 8:45 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

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
 config/menu/20-status.menu            |   2 +-
 config/rootfiles/packages/squid-graph |  16 +++++
 lfs/squid-graph                       | 111 ++++++++++++++++++++++++++++++++++
 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, 217 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:38 a.m. UTC | #1
Hi,

On 11.11.2017 22:45, Matthias Fischer wrote:
> Hi,
> ...

Sorry, patch is superseded - I made a silly lfs/packaging error.

I'll rework that one.

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..227b754dd
--- /dev/null
+++ b/lfs/squid-graph
@@ -0,0 +1,111 @@ 
+###############################################################################
+#                                                                             #
+# 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 = f60b197bc39220a1cfc12deba855825d
+
+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
+
+# Install cron-job for five-minute-update
+	install -v -m 755 $(DIR_SRC)/etc/fcron.cyclic/update-squid-graphs \
+		/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