diff options
Diffstat (limited to 'config/darkstat')
-rw-r--r-- | config/darkstat/darkstat.sh | 22 | ||||
-rw-r--r-- | config/darkstat/darkstat.xml | 109 |
2 files changed, 131 insertions, 0 deletions
diff --git a/config/darkstat/darkstat.sh b/config/darkstat/darkstat.sh new file mode 100644 index 00000000..a7706142 --- /dev/null +++ b/config/darkstat/darkstat.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +rc_start() { + /usr/local/sbin/darkstat --detach +} + +rc_stop() { + killall darkstat +} + +case $1 in + start) + rc_start + ;; + stop) + rc_stop + ;; + restart) + rc_stop + rc_start + ;; +esac diff --git a/config/darkstat/darkstat.xml b/config/darkstat/darkstat.xml new file mode 100644 index 00000000..7385048d --- /dev/null +++ b/config/darkstat/darkstat.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + authng.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + 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. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>Describe your package here</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>Darkstat</name> + <version>3.0</version> + <title>Diagnostics: Darkstat</title> + <menu> + <name>Darkstat Settings</name> + <tooltiptext>Setup darkstat specific settings</tooltiptext> + <section>Diagnostics</section> + <url>/pkg_edit.php?xml=darkstat.xml&id=0</url> + </menu> + <service> + <name>darkstat</name> + <rcfile>darkstat.sh</rcfile> + <executable>darkstat</executable> + </service> + <tabs> + <tab> + <text>Darkstat Settings</text> + <url>/pkg_edit.php?xml=darkstat.xml&id=0</url> + <active/> + </tab> + <tab> + <text>Access Darkstat</text> + <url>http://$myurl:666</url> + </tab> + </tabs> + <fields> + <field> + <fielddescr>Interface</fielddescr> + <fieldname>interface_array</fieldname> + <type>interfaces_selection</type> + <size>3</size> + <value>lan</value> + <multiple>true</multiple> + </field> + </fields> + <custom_php_global_functions> + function sync_package_darkstat() { + $first = 0; + foreach($_POST['interface_array'] as $iface) { + $if = convert_friendly_interface_to_real_interface_name($iface); + if($if) { + $ifaces_final .= " -i " . $if; + $first = 1; + } + } + $start = "/usr/local/sbin/darkstat" . $ifaces_final . " -p 666 "; + write_rcfile(array( + "file" => "darkstat.sh", + "start" => $start, + "stop" => "/usr/bin/killall darkstat" + ) + ); + start_service("darkstat"); + } + </custom_php_global_functions> + <custom_add_php_command> + sync_package_darkstat(); + </custom_add_php_command> + <custom_php_resync_config_command> + sync_package_darkstat(); + </custom_php_resync_config_command> +</packagegui> |