aboutsummaryrefslogtreecommitdiffstats
path: root/packages/avahi/avahi.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-01-24 01:22:04 +0000
committerScott Ullrich <sullrich@pfsense.org>2009-01-24 01:22:04 +0000
commit6e3ff8404e9a557894ddaf5115721d453a3dfb02 (patch)
treeecb5c21b79579f37b122be7916b5fbcd425cf728 /packages/avahi/avahi.inc
parent238cb37ee0838599d480dda7409ee73d15ebc145 (diff)
downloadpfsense-packages-6e3ff8404e9a557894ddaf5115721d453a3dfb02.tar.gz
pfsense-packages-6e3ff8404e9a557894ddaf5115721d453a3dfb02.tar.bz2
pfsense-packages-6e3ff8404e9a557894ddaf5115721d453a3dfb02.zip
First stab at Avahi package.
Sponsored-by: icci.com
Diffstat (limited to 'packages/avahi/avahi.inc')
-rw-r--r--packages/avahi/avahi.inc93
1 files changed, 93 insertions, 0 deletions
diff --git a/packages/avahi/avahi.inc b/packages/avahi/avahi.inc
new file mode 100644
index 00000000..33e25294
--- /dev/null
+++ b/packages/avahi/avahi.inc
@@ -0,0 +1,93 @@
+<?php
+
+function setup_avahi() {
+ global $g, $config;
+
+ // Pull some various values out of config.xml
+ $hostname = $config['system']['hostname'];
+ $domain = $config['system']['domain'];
+ $enable = $config['installedpackages']['avahi']['config'][0]['enable'];
+ $browsedomains = $config['installedpackages']['avahi']['config'][0]['browsedomains'];
+
+ // Is package disabled?
+ if(!$enable) {
+ if(file_exists("/usr/local/etc/rc.d/avahi.sh"))
+ unlink("/usr/local/etc/rc.d/avahi.sh");
+ return;
+ }
+
+ // No supplied domains? Use the defaults.
+ if(!$browsedomains)
+ $browsedomains = "local, 0pointer.de, zeroconf.org";
+
+ // Construct the avahi configuration
+ $config = <<<EOF
+
+ # avahi.conf - This file was automatically generated by the pfSense pacakge
+ # manager. Do not edit this file, it will be overwritten automatically.
+ # See /usr/local/pkg/avahi.inc to make changes to this file!
+
+ [server]
+ host-name={$hostname}
+ domain-name={$domain}
+ browse-domains={$browsedomains}
+ use-ipv4=yes
+ use-ipv6=no
+ enable-dbus=no
+ #check-response-ttl=no
+ #use-iff-running=no
+ #disallow-other-stacks=no
+ #allow-point-to-point=no
+
+ [wide-area]
+ enable-wide-area=yes
+
+ [publish]
+ #disable-publishing=no
+ #disable-user-service-publishing=no
+ #add-service-cookie=no
+ #publish-addresses=yes
+ #publish-hinfo=yes
+ #publish-workstation=yes
+ #publish-domain=yes
+ #publish-dns-servers=192.168.50.1, 192.168.50.2
+ #publish-resolv-conf-dns-servers=yes
+ #publish-aaaa-on-ipv4=yes
+ #publish-a-on-ipv6=no
+
+ [reflector]
+ enable-reflector=yes
+ #reflect-ipv=no
+
+ [rlimits]
+ rlimit-core=0
+ rlimit-data=4194304
+ rlimit-fsize=0
+ rlimit-nofile=300
+ rlimit-stack=4194304
+ rlimit-nproc=3
+ #rlimit-as=
+
+EOF;
+
+ // Make image RW
+ conf_mount_rw();
+ /* Write out .conf file */
+ $fd = fopen("/usr/local/etc/avahi.conf", "w");
+ fwrite($fd, $config);
+ fclose($fd);
+ /* Write out rc.d startup file */
+ $start = "/usr/local/sbin/avahi";
+ $stop = "/usr/bin/killall avahi";
+ write_rcfile(array(
+ "file" => "avahi.sh",
+ "start" => $start,
+ "stop" => $stop
+ )
+ );
+ // Make image RO
+ conf_mount_ro();
+
+}
+
+?> \ No newline at end of file