aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-01-24 19:41:07 +0000
committerScott Ullrich <sullrich@pfsense.org>2009-01-24 19:41:07 +0000
commiteff5895f538f1db9742e591447189f17ab77630e (patch)
tree916d881c74858d4c5cf21561b9dde4f5c03fc320 /packages
parent6525c6fbacf1ed8c815b1324fb5318c175b161d4 (diff)
downloadpfsense-packages-eff5895f538f1db9742e591447189f17ab77630e.tar.gz
pfsense-packages-eff5895f538f1db9742e591447189f17ab77630e.tar.bz2
pfsense-packages-eff5895f538f1db9742e591447189f17ab77630e.zip
* Extract out avahi.tgz
* Use /usr/local/etc/avahi for .conf storage * Misc code cleanups
Diffstat (limited to 'packages')
-rw-r--r--packages/avahi/avahi.inc147
-rw-r--r--packages/avahi/avahi.xml12
2 files changed, 103 insertions, 56 deletions
diff --git a/packages/avahi/avahi.inc b/packages/avahi/avahi.inc
index 33e25294..2a82fcd4 100644
--- a/packages/avahi/avahi.inc
+++ b/packages/avahi/avahi.inc
@@ -1,8 +1,55 @@
<?php
+/*
+ $Id$
+ avahi.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2009 Scott Ullrich
+ 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.
+
+ 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.
+*/
+
+function delete_avahi() {
+ global $g, $config;
+ unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh");
+ exec("killall avahi-daemon");
+}
+
function setup_avahi() {
global $g, $config;
+ // 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");
+ }
+
+ // Make sure everthing was extracted
+ if(!file_exists("/usr/local/sbin/avahi-daemon")) {
+ log_error("Sorry, something went wrong while extract avahi binaries. Please try the operation again");
+ return;
+ }
+
// Pull some various values out of config.xml
$hostname = $config['system']['hostname'];
$domain = $config['system']['domain'];
@@ -11,8 +58,7 @@ function setup_avahi() {
// Is package disabled?
if(!$enable) {
- if(file_exists("/usr/local/etc/rc.d/avahi.sh"))
- unlink("/usr/local/etc/rc.d/avahi.sh");
+ delete_avahi();
return;
}
@@ -23,64 +69,65 @@ function setup_avahi() {
// 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=
+# 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");
+ safe_mkdir("/usr/local/etc/avahi");
+ $fd = fopen("/usr/local/etc/avahi/avahi-daemon.conf", "w");
fwrite($fd, $config);
fclose($fd);
/* Write out rc.d startup file */
- $start = "/usr/local/sbin/avahi";
- $stop = "/usr/bin/killall avahi";
+ $start = "/usr/local/sbin/avahi-daemon";
+ $stop = "/usr/bin/killall avahi-daemon";
write_rcfile(array(
- "file" => "avahi.sh",
+ "file" => "avahi-daemon.sh",
"start" => $start,
"stop" => $stop
)
diff --git a/packages/avahi/avahi.xml b/packages/avahi/avahi.xml
index 0b97ef29..248dd76c 100644
--- a/packages/avahi/avahi.xml
+++ b/packages/avahi/avahi.xml
@@ -46,9 +46,9 @@
<executable>avahi</executable>
</service>
<additional_files_needed>
- <prefix>/usr/local/sbin/</prefix>
+ <prefix>/tmp/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.com/packages/avahi/binaries/avahi</item>
+ <item>http://www.pfsense.com/packages/avahi/binaries/avahi.tgz</item>
</additional_files_needed>
<fields>
<field>
@@ -64,12 +64,12 @@
<type>checkbox</type>
</field>
</fields>
- <custom_php_global_functions>
- </custom_php_global_functions>
- <custom_add_php_command>
- </custom_add_php_command>
<custom_php_install_command>
setup_avahi();
</custom_php_install_command>
+ <custom_php_deinstall_command>
+ delete_avahi();
+ </custom_php_deinstall_command>
+
<include_file>avahi.inc</include_file>
</packagegui> \ No newline at end of file