aboutsummaryrefslogtreecommitdiffstats
path: root/config/avahi/avahi.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-10-01 14:05:35 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-10-01 14:05:35 -0300
commitef6603f08a8e249e2973db0f2d34662ae9d86d12 (patch)
tree39deb16292e21186575e03d14a31ae9651bc4e24 /config/avahi/avahi.inc
parent4cb9f54be52925d8270f2d7b57bce97404718ea0 (diff)
downloadpfsense-packages-ef6603f08a8e249e2973db0f2d34662ae9d86d12.tar.gz
pfsense-packages-ef6603f08a8e249e2973db0f2d34662ae9d86d12.tar.bz2
pfsense-packages-ef6603f08a8e249e2973db0f2d34662ae9d86d12.zip
Attempt to fix avahi on 2.2
Diffstat (limited to 'config/avahi/avahi.inc')
-rw-r--r--config/avahi/avahi.inc24
1 files changed, 15 insertions, 9 deletions
diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc
index 0bc181ec..e2cb7b6e 100644
--- a/config/avahi/avahi.inc
+++ b/config/avahi/avahi.inc
@@ -33,10 +33,16 @@ $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');
+ define('AVAHI_BASE', '/usr/local');
+ define('AVAHI_LOCALBASE', AVAHI_BASE);
+ break;
+ case "2.1":
+ define('AVAHI_BASE', '/usr/pbi/avahi-' . php_uname("m"));
+ define('AVAHI_LOCALBASE', AVAHI_BASE);
break;
default:
define('AVAHI_BASE', '/usr/pbi/avahi-' . php_uname("m"));
+ define('AVAHI_LOCALBASE', AVAHI_BASE . '/local');
}
function avahi_start() {
@@ -56,8 +62,8 @@ function avahi_install() {
$archive = (substr(trim(file_get_contents("/etc/version")),0,1) == "1") ? "avahi.tar.gz" : "";
// Extract out libraries and avahi-daemon
if(!empty($archive) && file_exists("/root/{$archive}")) {
- exec("mkdir -p " . AVAHI_BASE . "/etc/avahi/services/");
- exec("mv " . AVAHI_BASE . "/etc/avahi/*.service " . AVAHI_BASE . "/etc/avahi/services/");
+ exec("mkdir -p " . AVAHI_LOCALBASE . "/etc/avahi/services/");
+ exec("mv " . AVAHI_LOCALBASE . "/etc/avahi/*.service " . AVAHI_LOCALBASE . "/etc/avahi/services/");
exec("/usr/bin/tar xzPUf /root/{$archive} -C /");
unlink("/root/{$archive}");
// Make sure everthing was extracted
@@ -158,8 +164,8 @@ rlimit-nproc=3
EOF;
/* Write out .conf file */
- safe_mkdir(AVAHI_BASE . "/etc/avahi");
- $fd = fopen(AVAHI_BASE . "/etc/avahi/avahi-daemon.conf", "w");
+ safe_mkdir(AVAHI_LOCALBASE . "/etc/avahi");
+ $fd = fopen(AVAHI_LOCALBASE . "/etc/avahi/avahi-daemon.conf", "w");
fwrite($fd, $avahiconfig);
fclose($fd);
/* Write out rc.d startup file */
@@ -169,18 +175,18 @@ EOF;
$start .= " mount -t procfs procfs /proc\n";
$start .= "fi\n";
$start .= "/usr/bin/killall avahi-daemon\n";
- if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
+ if (file_exists(AVAHI_LOCALBASE . "/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 .= AVAHI_LOCALBASE . "/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\n";
- if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
- $stop .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
+ if (file_exists(AVAHI_LOCALBASE . "/etc/rc.d/dbus")) {
+ $stop .= AVAHI_LOCALBASE . "/etc/rc.d/dbus onestop\n";
$stop .= "rm /var/run/dbus/dbus.pid\n";
}