aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfig/squid3/34/squid.inc51
-rw-r--r--config/squid3/34/swapstate_check.php11
-rw-r--r--pkg_config.10.xml2
3 files changed, 24 insertions, 40 deletions
diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc
index 87232c2b..a2917515 100755
--- a/config/squid3/34/squid.inc
+++ b/config/squid3/34/squid.inc
@@ -42,14 +42,12 @@ if(!function_exists("filter_configure"))
require_once("filter.inc");
$shortcut_section = "squid";
-$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
if (is_dir('/usr/pbi/squid-' . php_uname("m"))) {
- if ($pfs_version == 2.2)
- define('SQUID_LOCALBASE', '/usr/pbi/squid-' . php_uname("m")."/local");
- else
- define('SQUID_LOCALBASE', '/usr/pbi/squid-' . php_uname("m"));
+ define('SQUID_BASE', '/usr/pbi/squid-' . php_uname("m"));
+ define('SQUID_LOCALBASE', SQUID_BASE . "/local");
} else {
- define('SQUID_LOCALBASE','/usr/local');
+ define('SQUID_BASE', '/usr/local');
+ define('SQUID_LOCALBASE', '/usr/local');
}
define('SQUID_CONFBASE', SQUID_LOCALBASE .'/etc/squid');
@@ -138,12 +136,12 @@ function squid_dash_z($cache_action='none') {
if(!is_dir($cachedir.'/00/')) {
log_error("Creating squid cache subdirs in $cachedir");
- mwexec(SQUID_LOCALBASE. "/sbin/squid -k shutdown -f " . SQUID_CONFFILE);
+ mwexec(SQUID_BASE. "/sbin/squid -k shutdown -f " . SQUID_CONFFILE);
sleep(5);
- mwexec(SQUID_LOCALBASE. "/sbin/squid -k kill -f " . SQUID_CONFFILE);
+ mwexec(SQUID_BASE. "/sbin/squid -k kill -f " . SQUID_CONFFILE);
// Double check permissions here, should be safe to recurse cache dir if it's small here.
mwexec("/usr/sbin/chown -R proxy:proxy $cachedir");
- mwexec(SQUID_LOCALBASE. "/sbin/squid -z -f " . SQUID_CONFFILE);
+ mwexec(SQUID_BASE. "/sbin/squid -z -f " . SQUID_CONFFILE);
}
if(file_exists("/var/squid/cache/swap.state")) {
@@ -347,11 +345,11 @@ function squid_install_command() {
if (!is_service_running('squid')) {
update_status("Starting... One moment please...");
log_error("Starting Squid");
- mwexec_bg(SQUID_LOCALBASE. "/sbin/squid -f " . SQUID_CONFFILE);
+ mwexec_bg(SQUID_BASE. "/sbin/squid -f " . SQUID_CONFFILE);
} else {
update_status("Reloading Squid for configuration sync... One moment please...");
log_error("Reloading Squid for configuration sync");
- mwexec_bg(SQUID_LOCALBASE. "/sbin/squid -k reconfigure -f " . SQUID_CONFFILE);
+ mwexec_bg(SQUID_BASE. "/sbin/squid -k reconfigure -f " . SQUID_CONFFILE);
}
/* restart proxy alarm scripts */
@@ -736,7 +734,7 @@ function squid_install_cron($should_install) {
$rotate_job_id=-1;
$swapstate_job_id=-1;
$cron_cmd=($settings['clear_cache']=='on' ? "/usr/local/pkg/swapstate_check.php clean; " : "");
- $cron_cmd .= SQUID_LOCALBASE."/sbin/squid -k rotate -f " . SQUID_CONFFILE;
+ $cron_cmd .= SQUID_BASE."/sbin/squid -k rotate -f " . SQUID_CONFFILE;
$need_write = false;
foreach($config['cron']['item'] as $item) {
if(strstr($item['task_name'], "squid_rotate_logs")) {
@@ -1342,7 +1340,7 @@ function squid_resync_antivirus(){
#fix perl path on clwarn.cgi
$clwarn_file_new=file_get_contents($clwarn_file);
$c_pattern[]="@/usr/\S+/perl@";
- $c_replacement[]=SQUID_LOCALBASE."/bin/perl";
+ $c_replacement[]=SQUID_BASE."/bin/perl";
/*$c_pattern[]="@redirect \S+/clwarn.cgi@";
$gui_proto=$config['system']['webgui']['protocol'];
$gui_port=$config['system']['webgui']['port'];
@@ -1440,15 +1438,12 @@ EOF;
#Check clamav database
if (count(glob("/var/db/clamav/*d"))==0){
log_error("Squid - Missing /var/db/clamav/*.cvd or *.cld files. Running freshclam on background.");
- mwexec_bg(SQUID_LOCALBASE."/bin/freshclam");
- }
- #check startup scripts on pfsense > 2.1
- if (preg_match("/usr.pbi/",SQUID_LOCALBASE)){
- $rcd_files = scandir(SQUID_LOCALBASE."/etc/rc.d");
- foreach($rcd_files as $rcd_file)
- if (!file_exists("/usr/local/etc/rc.d/{$rcd_file}"))
- symlink (SQUID_LOCALBASE."/etc/rc.d/{$rcd_file}","/usr/local/etc/rc.d/{$rcd_file}");
+ mwexec_bg(SQUID_BASE."/bin/freshclam");
}
+ $rcd_files = scandir(SQUID_LOCALBASE."/etc/rc.d");
+ foreach($rcd_files as $rcd_file)
+ if (!file_exists("/usr/local/etc/rc.d/{$rcd_file}"))
+ symlink (SQUID_LOCALBASE."/etc/rc.d/{$rcd_file}","/usr/local/etc/rc.d/{$rcd_file}");
#write advanced icap config files
file_put_contents(SQUID_LOCALBASE."/etc/c-icap/squidclamav.conf",base64_decode($antivirus_config['squidclamav']),LOCK_EX);
@@ -1898,12 +1893,12 @@ function squid_resync($via_rpc="no") {
if (!is_service_running('squid')) {
log_error("Starting Squid");
- mwexec(SQUID_LOCALBASE . "/sbin/squid -f " . SQUID_CONFFILE);
+ mwexec(SQUID_BASE . "/sbin/squid -f " . SQUID_CONFFILE);
}
else {
if (!isset($boot_process)){
log_error("Reloading Squid for configuration sync");
- mwexec(SQUID_LOCALBASE . "/sbin/squid -k reconfigure -f " . SQUID_CONFFILE);
+ mwexec(SQUID_BASE . "/sbin/squid -k reconfigure -f " . SQUID_CONFFILE);
}
}
@@ -2268,18 +2263,18 @@ function squid_write_rcfile() {
/* Declare a variable for the SQUID_CONFFILE constant. */
/* Then the variable can be referenced easily in the Heredoc text that generates the rc file. */
$squid_conffile_var = SQUID_CONFFILE;
- $squid_local_base = SQUID_LOCALBASE;
+ $squid_base = SQUID_BASE;
$rc = array();
$rc['file'] = 'squid.sh';
$rc['start'] = <<<EOD
if [ -z "`ps auxw | grep "[s]quid "|awk '{print $2}'`" ];then
- {$squid_local_base}/sbin/squid -f {$squid_conffile_var}
+ {$squid_base}/sbin/squid -f {$squid_conffile_var}
fi
EOD;
$rc['stop'] = <<<EOD
-{$squid_local_base}/sbin/squid -k shutdown -f {$squid_conffile_var}
+{$squid_base}/sbin/squid -k shutdown -f {$squid_conffile_var}
# Just to be sure...
sleep 5
@@ -2294,9 +2289,9 @@ killall pinger 2>/dev/null
EOD;
$rc['restart'] = <<<EOD
if [ -z "`ps auxw | grep "[s]quid "|awk '{print $2}'`" ];then
- {$squid_local_base}/sbin/squid -f {$squid_conffile_var}
+ {$squid_base}/sbin/squid -f {$squid_conffile_var}
else
- {$squid_local_base}/sbin/squid -k reconfigure -f {$squid_conffile_var}
+ {$squid_base}/sbin/squid -k reconfigure -f {$squid_conffile_var}
fi
EOD;
diff --git a/config/squid3/34/swapstate_check.php b/config/squid3/34/swapstate_check.php
index b9f51ec1..7a7ccd27 100644
--- a/config/squid3/34/swapstate_check.php
+++ b/config/squid3/34/swapstate_check.php
@@ -30,17 +30,6 @@ require_once('config.inc');
require_once('util.inc');
require_once('squid.inc');
-$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
-if (is_dir('/usr/pbi/squid-' . php_uname("m"))) {
- if ($pfs_version == 2.2)
- define('SQUID_LOCALBASE', '/usr/pbi/squid-' . php_uname("m")."/local");
- else
- define('SQUID_LOCALBASE', '/usr/pbi/squid-' . php_uname("m"));
-} else {
- define('SQUID_LOCALBASE','/usr/local');
-}
-
-
$settings = $config['installedpackages']['squidcache']['config'][0];
// Only check the cache if Squid is actually caching.
// If there is no cache then quietly do nothing.
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index a4e767f5..5c113a95 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -908,7 +908,7 @@
<pkginfolink>https://forum.pfsense.org/index.php/topic,48347.0.html</pkginfolink>
<website>http://www.squid-cache.org/</website>
<category>Network</category>
- <version>3.4.9_1 pkg 0.1</version>
+ <version>3.4.9_1 pkg 0.2</version>
<status>beta</status>
<required_version>2.2</required_version>
<maintainer>marcellocoutinho@gmail.com fernando@netfilter.com.br seth.mos@dds.nl mfuchs77@googlemail.com jimp@pfsense.org</maintainer>