aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-07-05 12:03:58 -0400
committerjim-p <jimp@pfsense.org>2012-07-05 12:03:58 -0400
commitb012ea0f60785020b8f697300fe8e78da2e5e45d (patch)
treef8a6620e87f436a5367a8418e8b55918865ddc2d
parent1cf2a9f705284e474d721cb31e13db9c67708cad (diff)
downloadpfsense-packages-b012ea0f60785020b8f697300fe8e78da2e5e45d.tar.gz
pfsense-packages-b012ea0f60785020b8f697300fe8e78da2e5e45d.tar.bz2
pfsense-packages-b012ea0f60785020b8f697300fe8e78da2e5e45d.zip
Various fixes for Avahi on 2.1. Fixes #2535
-rw-r--r--config/avahi/avahi.inc41
-rw-r--r--config/avahi/avahi.xml5
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
4 files changed, 37 insertions, 13 deletions
diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc
index 76264ff2..df56cd06 100644
--- a/config/avahi/avahi.inc
+++ b/config/avahi/avahi.inc
@@ -4,7 +4,7 @@
$Id$
avahi.inc
part of pfSense (http://www.pfSense.com)
- Copyright (C) 2009 Scott Ullrich, Jim Pingle
+ Copyright (C) 2009-2012 Scott Ullrich, Jim Pingle
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,16 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+switch ($pfs_version) {
+ case "1.2":
+ case "2.0":
+ define('AVAHI_BASE','/usr/local');
+ break;
+ default:
+ define('AVAHI_BASE', '/usr/pbi/avahi-' . php_uname("m"));
+}
+
function avahi_start() {
mwexec_bg("/usr/local/etc/rc.d/avahi-daemon.sh start");
}
@@ -41,17 +51,17 @@ function avahi_install() {
global $g, $config;
conf_mount_rw();
+ // This old hacky install code should only happen on 1.x
if (php_uname("m") == "i386")
$archive = (substr(trim(file_get_contents("/etc/version")),0,1) == "2") ? "" : "avahi.tar.gz";
-
// Extract out libraries and avahi-daemon
if(!empty($archive) && file_exists("/root/{$archive}")) {
- exec("mkdir -p /usr/local/etc/avahi/services/");
- exec("mv /usr/local/etc/avahi/*.service /usr/local/etc/avahi/services/");
+ exec("mkdir -p " . AVAHI_BASE . "/etc/avahi/services/");
+ exec("mv " . AVAHI_BASE . "/etc/avahi/*.service " . AVAHI_BASE . "/etc/avahi/services/");
exec("/usr/bin/tar xzPUf /root/{$archive} -C /");
unlink("/root/{$archive}");
// Make sure everthing was extracted
- if(!file_exists("/usr/local/sbin/avahi-daemon")) {
+ if(!file_exists(AVAHI_BASE . "/sbin/avahi-daemon")) {
log_error("Sorry, something went wrong while extract avahi binaries. Please try the operation again");
return;
}
@@ -146,8 +156,8 @@ rlimit-nproc=3
EOF;
/* Write out .conf file */
- safe_mkdir("/usr/local/etc/avahi");
- $fd = fopen("/usr/local/etc/avahi/avahi-daemon.conf", "w");
+ safe_mkdir(AVAHI_BASE . "/etc/avahi");
+ $fd = fopen(AVAHI_BASE . "/etc/avahi/avahi-daemon.conf", "w");
fwrite($fd, $avahiconfig);
fclose($fd);
/* Write out rc.d startup file */
@@ -156,9 +166,22 @@ EOF;
$start .= " mkdir -p /proc\n";
$start .= " mount -t procfs procfs /proc\n";
$start .= "fi\n";
- $start .= "/usr/local/sbin/avahi-daemon -D\n";
+ $start .= "/usr/bin/killall avahi-daemon\n";
+ if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
+ $start .= "/usr/bin/killall dbus-daemon\n";
+ $start .= "rm /var/run/dbus/dbus.pid\n";
+ $start .= AVAHI_BASE . "/etc/rc.d/dbus onestart\n";
+ }
+ $start .= "sleep 5\n";
+ $start .= AVAHI_BASE . "/sbin/avahi-daemon -D\n";
$start .= "/etc/rc.conf_mount_ro\n";
- $stop = "/usr/bin/killall avahi-daemon";
+
+ $stop = "/usr/bin/killall avahi-daemon\n";
+ if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
+ $stop .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
+ $stop .= "rm /var/run/dbus/dbus.pid\n";
+ }
+
write_rcfile(array(
"file" => "avahi-daemon.sh",
"start" => $start,
diff --git a/config/avahi/avahi.xml b/config/avahi/avahi.xml
index dc77c659..8a503e1c 100644
--- a/config/avahi/avahi.xml
+++ b/config/avahi/avahi.xml
@@ -34,7 +34,7 @@
</copyright>
<title>Services: Avahi</title>
<name>avahi</name>
- <version>1.0</version>
+ <version>0.6.29</version>
<savetext>Save</savetext>
<include_file>/usr/local/pkg/avahi.inc</include_file>
<menu>
@@ -102,6 +102,7 @@
</custom_php_install_command>
<custom_php_deinstall_command>
unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh");
- exec("killall avahi-daemon");
+ exec("killall -9 avahi-daemon");
+ exec("killall -9 dbus-daemon");
</custom_php_deinstall_command>
</packagegui>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 238a91b4..a6b9e4c0 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -247,7 +247,7 @@
</build_pbi>
<depends_on_package>avahi-app-0.6.29_1.tbz</depends_on_package>
<depends_on_package_pbi>avahi-0.6.29-i386.pbi</depends_on_package_pbi>
- <version>0.6.25_2</version>
+ <version>0.6.29</version>
<status>ALPHA</status>
<required_version>1.2.3</required_version>
<config_file>http://www.pfsense.com/packages/config/avahi/avahi.xml</config_file>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index e3da905e..befcf9b8 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -234,7 +234,7 @@
</build_pbi>
<depends_on_package>avahi-0.6.29.tbz</depends_on_package>
<depends_on_package_pbi>avahi-0.6.29-amd64.pbi</depends_on_package_pbi>
- <version>0.6.25_2</version>
+ <version>0.6.29</version>
<status>ALPHA</status>
<required_version>1.2.3</required_version>
<config_file>http://www.pfsense.com/packages/config/avahi/avahi.xml</config_file>