diff options
-rw-r--r-- | config/siproxd.inc | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/config/siproxd.inc b/config/siproxd.inc index f0ec9f94..13254a42 100644 --- a/config/siproxd.inc +++ b/config/siproxd.inc @@ -30,10 +30,22 @@ if(!function_exists("filter_configure")) require_once("filter.inc"); +// Check to find out on which system the package is running +if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") { + define('SIPROXD', '/usr/local'); +} else { + define('SIPROXD', '/usr/pbi/siproxd-' . php_uname("m")); +} +// End of system check + function sync_package_sipproxd_users() { conf_mount_rw(); + + // put the constant to a variable + $varSIPROXD = SIPROXD; + global $config; - $fout = fopen("/usr/local/etc/siproxd_passwd.cfg","w"); + $fout = fopen("$varSIPROXD/etc/siproxd_passwd.cfg","w"); fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); if($config['installedpackages']['siproxdusers']['config'] != "") { foreach($config['installedpackages']['siproxdusers']['config'] as $rowhelper) { @@ -48,6 +60,9 @@ function sync_package_sipproxd_users() { function siproxd_generate_rules($type) { global $config; + // put the constant to a variable + $varSIPROXD = SIPROXD; + $siproxd_conf = &$config['installedpackages']['siproxdsettings']['config'][0]; if (!is_service_running('siproxd')) { log_error("Sipproxd is installed but not started. Not installing redirect rules."); @@ -92,6 +107,9 @@ function siproxd_generate_rules($type) { function sync_package_siproxd() { global $config; + // put the constant to a variable + $varSIPROXD = SIPROXD; + conf_mount_rw(); $siproxd_chroot = "/var/siproxd/"; @@ -99,9 +117,9 @@ function sync_package_siproxd() { @chown($siproxd_chroot, "nobody"); @chgrp($siproxd_chroot, "nobody"); - unlink_if_exists("/usr/local/etc/rc.d/siproxd"); + unlink_if_exists("$varSIPROXD/etc/rc.d/siproxd"); $siproxd_conf = &$config['installedpackages']['siproxdsettings']['config'][0]; - $fout = fopen("/usr/local/etc/siproxd.conf","w"); + $fout = fopen("$varSIPROXD/etc/siproxd.conf","w"); fwrite($fout, "# This file was automatically generated by the pfSense\n"); fwrite($fout, "# package management system.\n\n"); @@ -167,7 +185,7 @@ function sync_package_siproxd() { if($siproxd_conf['authentication']) { fwrite($fout, "proxy_auth_realm = Authentication_Realm\n"); - fwrite($fout, "proxy_auth_pwfile = /usr/local/etc/siproxd_passwd.cfg\n"); + fwrite($fout, "proxy_auth_pwfile = $varSIPROXD/etc/siproxd_passwd.cfg\n"); } if($siproxd_conf['debug_level'] != "") { @@ -203,7 +221,7 @@ function sync_package_siproxd() { if ($siproxd_conf['tcp_keepalive'] != "") fwrite($fout, "tcp_keepalive = " . $siproxd_conf['tcp_keepalive'] . "\n"); - fwrite($fout, "plugindir=/usr/local/lib/siproxd/\n"); + fwrite($fout, "plugindir=$varSIPROXD/lib/siproxd/\n"); fwrite($fout, "load_plugin=plugin_logcall.la\n"); if ($siproxd_conf['plugin_defaulttarget'] != "") @@ -231,7 +249,7 @@ function sync_package_siproxd() { write_rcfile(array( "file" => "siproxd.sh", - "start" => "/usr/local/sbin/siproxd -c /usr/local/etc/siproxd.conf &", + "start" => "$varSIPROXD/sbin/siproxd -c $varSIPROXD/etc/siproxd.conf &", "stop" => "/usr/bin/killall -9 siproxd" ) ); |