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/avahi') 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