From 26489aeed47661337e472463602879b2d08268b8 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 29 Jan 2018 14:46:54 -0500 Subject: [PATCH] Squid package: Do not attempt to start or monitor squid when squid is disabled. NG #479 (cherry picked from commit 91ba6792f9e185c6942b2e1ee0efd64d4890f53a) --- www/pfSense-pkg-squid/Makefile | 3 +-- www/pfSense-pkg-squid/files/usr/local/pkg/sqpmon.sh | 6 ++++++ www/pfSense-pkg-squid/files/usr/local/pkg/squid.inc | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/www/pfSense-pkg-squid/Makefile b/www/pfSense-pkg-squid/Makefile index ddfbc81b3c19..f6c6ff261163 100644 --- a/www/pfSense-pkg-squid/Makefile +++ b/www/pfSense-pkg-squid/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ PORTNAME= pfSense-pkg-squid -PORTVERSION= 0.4.42 -PORTREVISION= 1 +PORTVERSION= 0.4.43 CATEGORIES= www MASTER_SITES= # empty DISTFILES= # empty diff --git a/www/pfSense-pkg-squid/files/usr/local/pkg/sqpmon.sh b/www/pfSense-pkg-squid/files/usr/local/pkg/sqpmon.sh index 45c1372f5548..d0b3580d1a0f 100644 --- a/www/pfSense-pkg-squid/files/usr/local/pkg/sqpmon.sh +++ b/www/pfSense-pkg-squid/files/usr/local/pkg/sqpmon.sh @@ -19,6 +19,12 @@ # limitations under the License. # +SQUID_ENABLED=$(/usr/local/sbin/read_xml_tag.sh string installedpackages/squid/config/enable_squid) +if [ "${SQUID_ENABLED}" != "on" ]; then + echo "Squid is disabled, exiting." | /usr/bin/logger -p daemon.info -i -t Squid_Alarm + exit 0 +fi + if [ `/bin/pgrep -f "sqpmon.sh" | /usr/bin/wc -l` -ge 1 ]; then exit 0 fi diff --git a/www/pfSense-pkg-squid/files/usr/local/pkg/squid.inc b/www/pfSense-pkg-squid/files/usr/local/pkg/squid.inc index 1ddc80901d07..7e3f39a0c9d5 100644 --- a/www/pfSense-pkg-squid/files/usr/local/pkg/squid.inc +++ b/www/pfSense-pkg-squid/files/usr/local/pkg/squid.inc @@ -337,7 +337,10 @@ function squid_write_rcfile() { $rc['file'] = 'squid.sh'; $rc['start'] = <<< EOD #/sbin/sysctl net.inet.ip.portrange.reservedhigh=0 -if [ -z "`/bin/ps auxw | /usr/bin/grep "[s]quid " | /usr/bin/awk '{print $2}'`" ]; then +SQUID_ENABLED=$(/usr/local/sbin/read_xml_tag.sh string installedpackages/squid/config/enable_squid) +if [ "\${SQUID_ENABLED}" != "on" ]; then + exit 0 +elif [ -z "`/bin/ps auxw | /usr/bin/grep "[s]quid " | /usr/bin/awk '{print $2}'`" ]; then {$squid_base}/sbin/squid -f {$squid_conffile_var} fi