summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-15 23:43:17 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-15 23:43:17 +0000
commit87362af36b6e0a51bf91285173af133fa40070f6 (patch)
treed6d530965445489c7e4ace01008d0b4ec1dcdd7f /etc
parentf38dea081471248addbd737f1cabd7975594fd9e (diff)
downloadpfsense-87362af36b6e0a51bf91285173af133fa40070f6.zip
pfsense-87362af36b6e0a51bf91285173af133fa40070f6.tar.gz
* Introduce is_package_instaleld()
* Use is_package_installed to figure out if we should install a squid rule
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/filter.inc6
-rw-r--r--etc/inc/pfsense-utils.inc17
2 files changed, 17 insertions, 6 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 451389f..62eb50f 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -880,10 +880,8 @@ EOD;
}
}
- $squid_installed = run_command_return_string("/bin/ls {$g['vardb_path']}/pkg/ | grep squid");
- if ($squid_installed <> "") {
+ if (is_package_installed("squid") == 1)
$natrules .= "rdr on " . $lanif . " inet proto tcp from any to !{$lanip} port www -> 127.0.0.1 port 3128\n";
- }
return $natrules;
}
@@ -1356,7 +1354,7 @@ EOD;
if($rule['returngateway'] <> "") {
$line .= "reply-to (" . $rule['returngateway'] . ") ";
}
-
+
if (isset($rule['protocol'])) {
if($rule['protocol'] == "tcp/udp")
$line .= "proto { tcp udp } ";
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 6282c51..ac3bf54 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -339,6 +339,17 @@ function remove_text_from_file($file, $text) {
}
/*
+ * is_package_installed($packgename): returns 1 if a package is installed, 0 otherwise.
+ */
+function is_package_installed($packagename) {
+ global $config;
+ foreach($config['installedpackages']['package'] as $package) {
+ if($package['name'] == "squid") return 1;
+ }
+ return 0;
+}
+
+/*
* lookup pkg array id#
*/
function get_pkg_id($pkg_name) {
@@ -875,12 +886,14 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) {
foreach($depends as $item) {
$item_config = parse_xml_config_pkg("/usr/local/pkg/" . $item, "packagegui");
if(isset($item_config['nosync'])) continue;
- if($item_config['custom_php_command_before_form'] <> "")
+ if($item_config['custom_php_command_before_form'] <> "") {
eval($item_config['custom_php_command_before_form']);
print "Evaled dependency.";
- if($item_config['custom_php_resync_config_command'] <> "")
+ }
+ if($item_config['custom_php_resync_config_command'] <> "") {
eval($item_config['custom_php_resync_config_command']);
print "Evaled dependency.";
+ }
if($show_message == true) print " " . $item_config['name'];
}
}
OpenPOWER on IntegriCloud