aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorjim-p <jim@pingle.org>2009-10-06 23:15:48 -0400
committerjim-p <jim@pingle.org>2009-10-06 23:16:45 -0400
commit95295ac86170e99aa559ef59ab5d23baff68f12e (patch)
treedef31b655c079c8b223f3ce91b0c315e1ab4162d /config
parenta39d18d35f155660bcba150985a330285d6df6cf (diff)
downloadpfsense-packages-95295ac86170e99aa559ef59ab5d23baff68f12e.tar.gz
pfsense-packages-95295ac86170e99aa559ef59ab5d23baff68f12e.tar.bz2
pfsense-packages-95295ac86170e99aa559ef59ab5d23baff68f12e.zip
More changes to avahi to hopefully make it more nanobsd-friendly.
Diffstat (limited to 'config')
-rw-r--r--config/avahi/avahi.inc61
-rw-r--r--config/avahi/avahi.xml59
2 files changed, 70 insertions, 50 deletions
diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc
index 2c1ce25f..a89b5da2 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
+ Copyright (C) 2009 Scott Ullrich, Jim Pingle
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -29,24 +29,24 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-function start_avahi() {
- mwexec_bg("sh /usr/local/etc/rc.d/avahi-daemon.sh start");
+function avahi_start() {
+ mwexec_bg("/usr/local/etc/rc.d/avahi-daemon.sh start");
}
-function stop_avahi() {
- mwexec_bg("sh /usr/local/etc/rc.d/avahi-daemon.sh stop");
+function avahi_stop() {
+ mwexec_bg("/usr/local/etc/rc.d/avahi-daemon.sh stop");
}
-function setup_avahi() {
+function avahi_install() {
global $g, $config;
-
- // Make image RW
conf_mount_rw();
+ exec("mkdir -p /usr/local/etc/avahi/services/");
+ exec("mv /usr/local/etc/avahi/*.service /usr/local/etc/avahi/services/");
// Extract out libraries and avahi-daemon
- if(file_exists("/tmp/avahi.tgz")) {
- exec("/usr/bin/tar xzPf /tmp/avahi.tgz -C /");
- unlink("/tmp/avahi.tgz");
+ if(file_exists("/root/avahi.tgz")) {
+ exec("/usr/bin/tar xzPUf /root/avahi.tgz -C /");
+ unlink("/root/avahi.tgz");
}
// Make sure everthing was extracted
@@ -55,6 +55,19 @@ function setup_avahi() {
return;
}
+ // Add needed users and groups
+ exec("/usr/sbin/pw useradd avahi");
+ exec("/usr/sbin/pw groupadd avahi");
+
+ // Make image RO
+ conf_mount_ro();
+}
+
+function avahi_write_config() {
+ global $g, $config;
+ // Make image RW
+ conf_mount_rw();
+
// Pull some various values out of config.xml
$hostname = $config['system']['hostname'];
$domain = $config['system']['domain'];
@@ -62,16 +75,6 @@ function setup_avahi() {
$browsedomains = $config['installedpackages']['avahi']['config'][0]['browsedomains'];
$denyif = $config['installedpackages']['avahi']['config'][0]['denyinterfaces'];
- // Is package disabled?
- if ((!$enable) && file_exists("/usr/local/etc/rc.d/avahi-daemon.sh")) {
- stop_avahi();
- return;
- }
-
- // Add needed users and groups
- exec("/usr/sbin/pw useradd avahi");
- exec("/usr/sbin/pw groupadd avahi");
-
// No supplied domains? Use the defaults.
if(!$browsedomains)
$browsedomains = "local, 0pointer.de, zeroconf.org";
@@ -162,7 +165,21 @@ EOF;
);
// Make image RO
conf_mount_ro();
- start_avahi();
+
+}
+
+function avahi_sync() {
+ global $g, $config;
+
+ avahi_stop();
+
+ avahi_write_config();
+
+ // Is package enabled?
+ if (isset($config['installedpackages']['avahi']['config'][0]['enable'])
+ && file_exists("/usr/local/etc/rc.d/avahi-daemon.sh")) {
+ avahi_start();
+ }
}
?>
diff --git a/config/avahi/avahi.xml b/config/avahi/avahi.xml
index 21d60576..da0e05fb 100644
--- a/config/avahi/avahi.xml
+++ b/config/avahi/avahi.xml
@@ -1,7 +1,8 @@
+<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
<copyright>
<![CDATA[
- /*
+ /*
$Id$
avahi.xml
part of pfSense (http://www.pfSense.com)
@@ -31,9 +32,11 @@
*/
]]>
</copyright>
+ <title>Services: Avahi</title>
<name>avahi</name>
<version>1.0</version>
- <title>Services: Avahi</title>
+ <savetext>Save</savetext>
+ <include_file>/usr/local/pkg/avahi.inc</include_file>
<menu>
<name>Avahi</name>
<tooltiptext>Modify avahi settings.</tooltiptext>
@@ -42,29 +45,9 @@
</menu>
<service>
<name>avahi</name>
- <rcfile>avahi.sh</rcfile>
- <executable>avahi</executable>
+ <rcfile>avahi-daemon.sh</rcfile>
+ <executable>avahi-daemon</executable>
</service>
- <additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/avahi/binaries/avahi.tgz</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/avahi/avahi.inc</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/etc/avahi/</prefix>
- <chmod>0755</chmod>
- <item>http://www.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>http://www.pfsense.org/packages/config/avahi/services/sftp-ssh.service</item>
- </additional_files_needed>
<fields>
<field>
<fielddescr>Enable</fielddescr>
@@ -86,14 +69,34 @@
<multiple>true</multiple>
</field>
</fields>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/avahi/binaries/avahi.tgz</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/avahi/avahi.inc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/etc/avahi/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.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>http://www.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>
<custom_php_install_command>
- exec("mkdir -p /usr/local/etc/avahi/services/");
- exec("mv /usr/local/etc/avahi/*.service /usr/local/etc/avahi/services/");
- setup_avahi();
+ avahi_install();
</custom_php_install_command>
<custom_php_deinstall_command>
unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh");
exec("killall avahi-daemon");
</custom_php_deinstall_command>
- <include_file>/usr/local/pkg/avahi.inc</include_file>
</packagegui>