aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/avahi/avahi.inc145
-rw-r--r--config/avahi/avahi.xml120
-rw-r--r--pkg_config.10.xml2
3 files changed, 156 insertions, 111 deletions
diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc
index 6d46df59..7d69af78 100644
--- a/config/avahi/avahi.inc
+++ b/config/avahi/avahi.inc
@@ -1,21 +1,21 @@
<?php
-
/*
- $Id$
avahi.inc
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2009-2012 Scott Ullrich, Jim Pingle
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2009 Scott Ullrich
+ Copyright (C) 2009-2013 Jim Pingle
+ Copyright (C) 2015 ESF, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -28,40 +28,57 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
-$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
-if ($pfs_version == "2.1" || $pfs_version == "2.2")
+$pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3);
+if ($pfs_version == "2.1" || $pfs_version == "2.2") {
define('AVAHI_BASE', '/usr/pbi/avahi-' . php_uname("m"));
-else
+} else {
define('AVAHI_BASE', '/usr/local');
-
-function avahi_start() {
- mwexec_bg("/usr/local/etc/rc.d/avahi-daemon.sh start");
-}
-
-function avahi_stop() {
- mwexec_bg("/usr/local/etc/rc.d/avahi-daemon.sh stop");
}
function avahi_install() {
- global $g, $config;
conf_mount_rw();
if (!file_exists('/usr/local/etc/gnome.subr')) {
@symlink(AVAHI_BASE . '/etc/gnome.subr', '/usr/local/etc/gnome.subr');
}
- // Add needed users and groups
- exec("/usr/sbin/pw useradd avahi -u 558");
- exec("/usr/sbin/pw groupadd avahi -g 558");
+ // Add needed users and groups if they don't exist
+ if (!exec("/usr/sbin/pw usershow avahi")) {
+ exec("/usr/sbin/pw useradd avahi -u 558");
+ }
+ if (!exec("/usr/sbin/pw groupshow avahi")) {
+ exec("/usr/sbin/pw groupadd avahi -g 558");
+ }
+
+ conf_mount_ro();
+}
+
+function avahi_deinstall() {
+ conf_mount_rw();
+
+ // Stop services and remove created rc script and symlink
+ if (is_process_running("avahi-daemon")) {
+ exec("/usr/bin/killall -9 avahi-daemon");
+ }
+ if (is_process_running("dbus-daemon")) {
+ exec("/usr/bin/killall -9 dbus-daemon");
+ }
+ unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh");
+ unlink_if_exists("/usr/local/etc/gnome.subr");
+
+ // Remove created users and groups if they exist
+ if (exec("/usr/sbin/pw groupshow avahi")) {
+ exec("/usr/sbin/pw groupdel avahi");
+ }
+ if (exec("/usr/sbin/pw usershow avahi")) {
+ exec("/usr/sbin/pw userdel avahi");
+ }
- // Make image RO
conf_mount_ro();
}
function avahi_write_config() {
- global $g, $config;
- // Make image RW
+ global $config;
conf_mount_rw();
// Pull some various values out of config.xml
@@ -72,29 +89,32 @@ function avahi_write_config() {
$denyif = $config['installedpackages']['avahi']['config'][0]['denyinterfaces'];
$useipv4 = ($config['installedpackages']['avahi']['config'][0]['disable_ipv4']) ? "no" : "yes";
$useipv6 = ($config['installedpackages']['avahi']['config'][0]['disable_ipv6']) ? "no" : "yes";
+ $usedbus = ($config['installedpackages']['avahi']['config'][0]['disable_dbus']) ? "no" : "yes";
- // No supplied domains? Use the defaults.
- if(!$browsedomains)
+ // No supplied domains? Use the defaults.
+ if (!$browsedomains) {
$browsedomains = "local, 0pointer.de, zeroconf.org";
+ }
- // Never pass along WAN. Bad.
+ // Never pass along WAN. Bad.
$denyinterfaces = $config['interfaces']['wan']['if'];
// Process interfaces defined by user to deny.
- if($denyif) {
+ if ($denyif) {
$if = explode(",", $denyif);
- foreach($if as $i) {
+ foreach ($if as $i) {
$ifreal = convert_friendly_interface_to_real_interface_name($i);
- if($ifreal)
+ if ($ifreal) {
$denyinterfaces .= ", " . $ifreal;
+ }
}
}
// Construct the avahi configuration
- $avahiconfig = <<<EOF
+ $avahiconfig = <<<EOF
# avahi.conf - This file was automatically generated by the pfSense pacakge
-# manager. Do not edit this file, it will be overwritten automatically.
+# manager. Do not edit this file, it will be overwritten automatically.
# See /usr/local/pkg/avahi.inc to make changes to this file!
[server]
@@ -104,7 +124,7 @@ browse-domains={$browsedomains}
deny-interfaces={$denyinterfaces}
use-ipv4={$useipv4}
use-ipv6={$useipv6}
-enable-dbus=yes
+enable-dbus={$usedbus}
#check-response-ttl=no
#use-iff-running=no
#disallow-other-stacks=no
@@ -146,57 +166,60 @@ EOF;
$fd = fopen(AVAHI_BASE . "/etc/avahi/avahi-daemon.conf", "w");
fwrite($fd, $avahiconfig);
fclose($fd);
+
/* Write out rc.d startup file */
$start = "/etc/rc.conf_mount_rw\n";
$start .= "if [ ! -d /proc/0 ]; then\n";
- $start .= " mkdir -p /proc\n";
- $start .= " mount -t procfs procfs /proc\n";
+ $start .= " /bin/mkdir -p /proc\n";
+ $start .= " /sbin/mount -t procfs procfs /proc\n";
$start .= "fi\n";
$start .= "if [ ! -f /usr/local/etc/gnome.subr ]; then\n";
- $start .= " ln -sf " . AVAHI_BASE . "/etc/gnome.subr /usr/local/etc/gnome.subr\n";
- $start .= "fi\n";
- $start .= "if [ ! -d /var/run/dbus ]; then\n";
- $start .= " mkdir /var/run/dbus\n";
- $start .= " chown messagebus:messagebus /var/run/dbus\n";
+ $start .= " /bin/ln -sf " . AVAHI_BASE . "/etc/gnome.subr /usr/local/etc/gnome.subr\n";
$start .= "fi\n";
$start .= "/usr/bin/killall avahi-daemon >/dev/null 2>&1\n";
- if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
- $start .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
- $start .= "rm /var/run/dbus/dbus.pid >/dev/null 2>&1\n";
- $start .= AVAHI_BASE . "/etc/rc.d/dbus onestart\n";
+ if (!$config['installedpackages']['avahi']['config'][0]['disable_dbus']) {
+ $start .= "if [ ! -d /var/run/dbus ]; then\n";
+ $start .= " /bin/mkdir /var/run/dbus\n";
+ $start .= " /usr/sbin/chown messagebus:messagebus /var/run/dbus\n";
+ $start .= "fi\n";
+ if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
+ $start .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
+ $start .= "/bin/rm /var/run/dbus/dbus.pid >/dev/null 2>&1\n";
+ $start .= AVAHI_BASE . "/etc/rc.d/dbus onestart\n";
+ $start .= "sleep 5\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 >/dev/null 2>&1\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 >/dev/null 2>&1\n";
+ if (!$config['installedpackages']['avahi']['config'][0]['disable_dbus']) {
+ if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
+ $stop .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
+ $stop .= "/bin/rm /var/run/dbus/dbus.pid >/dev/null 2>&1\n";
+ }
}
write_rcfile(array(
"file" => "avahi-daemon.sh",
"start" => $start,
- "stop" => $stop
+ "stop" => $stop
)
);
- // Make image RO
- conf_mount_ro();
+ conf_mount_ro();
}
function avahi_sync() {
- global $g, $config;
-
- avahi_stop();
+ global $config;
+ if (is_service_running("avahi")) {
+ stop_service("avahi");
+ }
avahi_write_config();
-
// Is package enabled?
- if (($config['installedpackages']['avahi']['config'][0]['enable'])
- && file_exists("/usr/local/etc/rc.d/avahi-daemon.sh")) {
- avahi_start();
+ if (($config['installedpackages']['avahi']['config'][0]['enable']) && file_exists("/usr/local/etc/rc.d/avahi-daemon.sh")) {
+ start_service("avahi");
}
}
diff --git a/config/avahi/avahi.xml b/config/avahi/avahi.xml
index cd1d96ce..0b49fea3 100644
--- a/config/avahi/avahi.xml
+++ b/config/avahi/avahi.xml
@@ -1,40 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
<copyright>
- <![CDATA[
- /*
- $Id$
- avahi.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2009 Scott Ullrich
- All rights reserved.
+<![CDATA[
+/* $Id$ */
+/* ====================================================================================== */
+/*
+ avahi.xml
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2009 Scott Ullrich
+ Copyright (C) 2009-2013 Jim Pingle
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+*/
+/* ====================================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
- ]]>
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+/* ====================================================================================== */
+ ]]>
</copyright>
<title>Services: Avahi</title>
<name>avahi</name>
- <version>0.6.31 pkg v1.05</version>
+ <version>1.10.0</version>
<savetext>Save</savetext>
<include_file>/usr/local/pkg/avahi.inc</include_file>
<menu>
@@ -49,6 +59,18 @@
<executable>avahi-daemon</executable>
<description>Avahi zeroconf/mDNS daemon</description>
</service>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <item>https://packages.pfsense.org/packages/config/avahi/avahi.inc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/etc/avahi/</prefix>
+ <item>https://packages.pfsense.org/packages/config/avahi/services/ssh.service</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/etc/avahi/</prefix>
+ <item>https://packages.pfsense.org/packages/config/avahi/services/sftp-ssh.service</item>
+ </additional_files_needed>
<fields>
<field>
<fielddescr>Enable</fielddescr>
@@ -59,44 +81,46 @@
<field>
<fielddescr>Browse domains (comma separated)</fielddescr>
<fieldname>browsedomains</fieldname>
- <description>Enter the domains that you would like proxied. (example: local, pfsense.org, mydomain.com)</description>
+ <description>
+ <![CDATA[
+ Enter the domains that you would like proxied.<br />
+ (Example: local, pfsense.org, mydomain.com)
+ ]]>
+ </description>
<type>input</type>
</field>
<field>
<fielddescr>Deny interfaces</fielddescr>
<fieldname>denyinterfaces</fieldname>
- <description>Interfaces that you do NOT want Avahi to listen on. NOTE: WAN is always disabled.</description>
+ <description>
+ <![CDATA[
+ Interfaces that you do NOT want Avahi to listen on.
+ <strong>NOTE: WAN is always disabled (so it is not shown here).</strong>
+ ]]>
+ </description>
<type>interfaces_selection</type>
+ <hideinterfaceregex>wan</hideinterfaceregex>
<multiple>true</multiple>
</field>
<field>
<fielddescr>Disable IPv6</fielddescr>
<fieldname>disable_ipv6</fieldname>
- <description>Disable IPv6 support in Avahi</description>
+ <description>Disable IPv6 support in Avahi.</description>
<type>checkbox</type>
</field>
<field>
<fielddescr>Disable IPv4</fielddescr>
<fieldname>disable_ipv4</fieldname>
- <description>Disable IPv4 support in Avahi</description>
+ <description>Disable IPv4 support in Avahi.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Disable D-BUS</fielddescr>
+ <fieldname>disable_dbus</fieldname>
+ <description>Disable D-BUS client API support in Avahi.</description>
<type>checkbox</type>
</field>
</fields>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/avahi/avahi.inc</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/etc/avahi/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/avahi/services/ssh.service</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/etc/avahi/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/avahi/services/sftp-ssh.service</item>
- </additional_files_needed>
<custom_php_resync_config_command>
avahi_sync();
</custom_php_resync_config_command>
@@ -104,8 +128,6 @@
avahi_install();
</custom_php_install_command>
<custom_php_deinstall_command>
- unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh");
- exec("killall -9 avahi-daemon");
- exec("killall -9 dbus-daemon");
+ avahi_deinstall();
</custom_php_deinstall_command>
</packagegui>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index 5ae74cba..b421ebac 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -261,7 +261,7 @@
<ports_after>net/avahi-app devel/dbus</ports_after>
</build_pbi>
<depends_on_package_pbi>avahi-0.6.31-##ARCH##.pbi</depends_on_package_pbi>
- <version>1.09</version>
+ <version>1.10.0</version>
<status>BETA</status>
<required_version>2.2</required_version>
<config_file>https://packages.pfsense.org/packages/config/avahi/avahi.xml</config_file>