From 692a3585dd0d60981fc7721b7effef16c063ebd1 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Tue, 11 Aug 2015 10:42:16 +0200 Subject: avahi - code style fixes - Fix copyright header - Fix indentation - Fix permissions (none of these needs to be executable) - Make version sane and consistent - Hide WAN from 'Deny interfaces' selection because it's always disabled. Clarify the description note accordingly - Move custom_php_deinstall_command to avahi.inc and make it much more thorough --- config/avahi/avahi.xml | 114 ++++++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 49 deletions(-) (limited to 'config') diff --git a/config/avahi/avahi.xml b/config/avahi/avahi.xml index cd1d96ce..e0fcb6fb 100644 --- a/config/avahi/avahi.xml +++ b/config/avahi/avahi.xml @@ -1,40 +1,50 @@ + + - + + 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. +*/ +/* ====================================================================================== */ + ]]> Services: Avahi avahi - 0.6.31 pkg v1.05 + 1.10.0 Save /usr/local/pkg/avahi.inc @@ -49,6 +59,18 @@ avahi-daemon Avahi zeroconf/mDNS daemon + + /usr/local/pkg/ + https://packages.pfsense.org/packages/config/avahi/avahi.inc + + + /usr/local/etc/avahi/ + https://packages.pfsense.org/packages/config/avahi/services/ssh.service + + + /usr/local/etc/avahi/ + https://packages.pfsense.org/packages/config/avahi/services/sftp-ssh.service + Enable @@ -59,44 +81,40 @@ Browse domains (comma separated) browsedomains - Enter the domains that you would like proxied. (example: local, pfsense.org, mydomain.com) + + + (Example: local, pfsense.org, mydomain.com) + ]]> + input Deny interfaces denyinterfaces - Interfaces that you do NOT want Avahi to listen on. NOTE: WAN is always disabled. + + NOTE: WAN is always disabled (so it is not shown here). + ]]> + interfaces_selection + wan true Disable IPv6 disable_ipv6 - Disable IPv6 support in Avahi + Disable IPv6 support in Avahi. checkbox Disable IPv4 disable_ipv4 - Disable IPv4 support in Avahi + Disable IPv4 support in Avahi. checkbox - - /usr/local/pkg/ - 0755 - https://packages.pfsense.org/packages/config/avahi/avahi.inc - - - /usr/local/etc/avahi/ - 0755 - https://packages.pfsense.org/packages/config/avahi/services/ssh.service - - - /usr/local/etc/avahi/ - 0755 - https://packages.pfsense.org/packages/config/avahi/services/sftp-ssh.service - avahi_sync(); @@ -104,8 +122,6 @@ avahi_install(); - unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh"); - exec("killall -9 avahi-daemon"); - exec("killall -9 dbus-daemon"); + avahi_deinstall(); -- cgit v1.2.3 From 3597ec01e234e8a3b45b630466d7de87b1743673 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Tue, 11 Aug 2015 10:48:06 +0200 Subject: avahi - code style fixes - Fix copyright header - Remove useless avahi_start() / avahi_stop() functions and use service_start() / service_stop() instead - Remove unused $g var declaration everywhere - On install, only try to add avahi user/group if they don't exist yet - Add avahi_deinstall() function, move the existing custom_php_deinstall_command contents here, additionally remove the avahi user/group on uninstall and also nuke /usr/local/etc/gnome.subr when removing the package - Use full paths to binaries consistently in the rc file - Code style fixes --- config/avahi/avahi.inc | 122 ++++++++++++++++++++++++++++--------------------- 1 file changed, 70 insertions(+), 52 deletions(-) (limited to 'config') diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc index 6d46df59..d180178d 100644 --- a/config/avahi/avahi.inc +++ b/config/avahi/avahi.inc @@ -1,21 +1,21 @@ /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 .= "/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"; @@ -172,31 +192,29 @@ EOF; $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"; + $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")) { + service_stop("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")) { + service_start("avahi"); } } -- cgit v1.2.3 From b6319ac80ac7ae392d3e6c265362f3e98210779e Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 04:01:35 +0200 Subject: Fix start/stop service function names --- config/avahi/avahi.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc index d180178d..e9e75f5d 100644 --- a/config/avahi/avahi.inc +++ b/config/avahi/avahi.inc @@ -209,12 +209,12 @@ function avahi_sync() { global $config; if (is_service_running("avahi")) { - service_stop("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")) { - service_start("avahi"); + start_service("avahi"); } } -- cgit v1.2.3 From 0b6889b49d2518e0e639a66332e04970f23aa0e4 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 09:29:07 +0200 Subject: avahi - add option to disable D-BUS client API --- config/avahi/avahi.xml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'config') diff --git a/config/avahi/avahi.xml b/config/avahi/avahi.xml index e0fcb6fb..0b49fea3 100644 --- a/config/avahi/avahi.xml +++ b/config/avahi/avahi.xml @@ -114,6 +114,12 @@ Disable IPv4 support in Avahi. checkbox + + Disable D-BUS + disable_dbus + Disable D-BUS client API support in Avahi. + checkbox + avahi_sync(); -- cgit v1.2.3 From e4370bba8fd5849751b3411e218c50c076b4d9a3 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 12 Aug 2015 09:31:16 +0200 Subject: avahi - add option to disable D-BUS client API --- config/avahi/avahi.inc | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'config') diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc index e9e75f5d..7d69af78 100644 --- a/config/avahi/avahi.inc +++ b/config/avahi/avahi.inc @@ -89,6 +89,7 @@ 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) { @@ -123,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 @@ -175,24 +176,28 @@ EOF; $start .= "if [ ! -f /usr/local/etc/gnome.subr ]; then\n"; $start .= " /bin/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 .= " /bin/mkdir /var/run/dbus\n"; - $start .= " /usr/sbin/chown messagebus:messagebus /var/run/dbus\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 .= "/bin/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 .= "/bin/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( -- cgit v1.2.3