aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/lcdproc/lcdproc.inc99
-rw-r--r--packages/lcdproc/lcdproc.xml78
-rw-r--r--pkg_config.xml14
3 files changed, 191 insertions, 0 deletions
diff --git a/packages/lcdproc/lcdproc.inc b/packages/lcdproc/lcdproc.inc
new file mode 100644
index 00000000..b453dccd
--- /dev/null
+++ b/packages/lcdproc/lcdproc.inc
@@ -0,0 +1,99 @@
+<?php
+ require_once("config.inc");
+ require_once("functions.inc");
+
+ /* LCDproc */
+
+ function lcdproc_notice ($msg) { syslog(LOG_NOTICE, "lcdproc: {$msg}"); }
+ function lcdproc_warn ($msg) { syslog(LOG_WARNING, "lcdproc: {$msg}"); }
+
+ function lcdproc_running () {
+ if((int)exec('pgrep lcdproc | wc -l') > 0)
+ return true;
+ return false;
+ }
+
+ function lcdproc_write_config($file, $text) {
+ $handle = fopen($file, 'w');
+ if(!$handle) {
+ lcdproc_warn("Could not open {$file} for writing.");
+ exit;
+ }
+ fwrite($handle, $text);
+ fclose($handle);
+ }
+
+ function before_form_lcdproc($pkg) {
+ global $config;
+
+ config_lock();
+
+ config_unlock();
+ }
+
+ function validate_form_lcdproc($post, $input_errors) {
+ if($post['comport']) {
+ switch($post['comport']) {
+ case "none":
+ continue;
+ break;
+ case "com2":
+ continue;
+ break;
+ case "ucom1":
+ continue;
+ break;
+ case "ucom2":
+ continue;
+ break;
+ default:
+ $input_errors[] = "The chosen com port is not valid";
+ break;
+ }
+ }
+ }
+
+ function sync_package_lcdproc() {
+ global $config;
+ global $input_errors;
+
+ config_lock();
+
+ $lcdproc_config = $config['installedpackages']['lcdproc']['config'][0];
+ $config_file = '/var/etc/lcdd.conf';
+
+
+ /* since config is written before this file invoked we don't need to read post data */
+ if($lcdproc_config['enable'] && ($lcdproc_config['comport'] != "none")) {
+ $config_text = "[server]\n";
+ $config_text .= "Driver={$lcdproc_config[driver]}\n";
+
+ /* if lcdproc not running start it */
+ if(!lcdproc_running()) {
+ lcdproc_notice("Starting service lcdproc");
+ lcdproc_action('start');
+ }
+ /* or restart lcdproc if settings were changed */
+ elseif($_POST['comport']) {
+ lcdproc_notice("Restarting service lcdproc");
+ lcdproc_action('restart');
+ }
+ }
+
+ if((! $lcdproc_config['comport']) || ($lcdproc_config['comport'] == "none")) {
+ /* no parameters user does not want lcdproc running */
+ /* lets stop the service and remove the rc file */
+
+ if(file_exists($config_file)) {
+ if(!$lcdproc_config['enable']) {
+ lcdproc_notice('Stopping service: lcdproc disabled');
+ } else {
+ lcdproc_notice('Stopping service: no com port selected');
+ }
+ lcdproc_action('stop');
+ unlink($config_file);
+ }
+ }
+ config_unlock();
+ }
+?>
diff --git a/packages/lcdproc/lcdproc.xml b/packages/lcdproc/lcdproc.xml
new file mode 100644
index 00000000..68affd47
--- /dev/null
+++ b/packages/lcdproc/lcdproc.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<packagegui>
+ <title>Services: LCDproc</title>
+ <namelcdproc</name>
+ <version>0.5.2_1-p1</version>
+ <savetext>Save</savetext>
+ <include_file>/usr/local/pkg/lcdproc.inc</include_file>
+ <menu>
+ <name>LCDproc</name>
+ <tooltiptext>Set LCDproc settings such as display driver and com port</tooltiptext>
+ <section>Services</section>
+ <url>/pkg_edit.php?xml=lcdproc.xml&amp;id=0</url>
+ </menu>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/lcdproc/lcdproc.inc</item>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ </additional_files_needed>
+ <service>
+ <name>lcdproc</name>
+ <rcfile>lcdproc.sh</rcfile>
+ <executable>lcdproc</executable>
+ </service>
+ <tabs>
+ <tab>
+ <text>LCDproc Settings</text>
+ <url>/pkg_edit.php?xml=lcdproc.xml&amp;id=0</url>
+ <active/>
+ </tab>
+ </tabs>
+ <fields>
+ <field>
+ <fielddescr>Enable LCDproc</fielddescr>
+ <fieldname>enable</fieldname>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fieldname>comport</fieldname>
+ <fielddescr>Com Port</fieldescr>
+ <description>Set the com port LCDproc should use.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <value>none</value>
+ <name>none</name>
+ </option>
+ </options>
+ <options>
+ <option>
+ <value>com2</value>
+ <name>Serial Com port 2</name>
+ </option>
+ </options>
+ <options>
+ <option>
+ <value>ucom1</value>
+ <name>USB Com port 1</name>
+ </option>
+ </options>
+ <options>
+ <option>
+ <value>ucom2</value>
+ <name>USB Com port 2</name>
+ </option>
+ </options>
+ <default_value>0</default_value>
+ </field>
+ </fields>
+ <custom_php_command_before_form>
+ before_form_lcdproc(&amp;$pkg);
+ </custom_php_command_before_form>
+ <custom_php_validation_command>
+ validate_form_lcdproc($_POST, &amp;$input_errors);
+ </custom_php_validation_command>
+ <custom_php_resync_config_command>
+ sync_package_lcdproc();
+ </custom_php_resync_config_command>
+</packagegui>
diff --git a/pkg_config.xml b/pkg_config.xml
index 41d7d85f..14113280 100644
--- a/pkg_config.xml
+++ b/pkg_config.xml
@@ -584,6 +584,20 @@
<configurationfile>squid.xml</configurationfile>
</package>
<package>
+ <name>LCDproc</name>
+ <descr>LCD display driver</descr>
+ <website>http://www.lcdproc.org/</website>
+ <category>Utility</category>
+ <version>lcdproc-0.5.2_1-p1</version>
+ <status>ALPHA</status>
+ <required_version>1.3</required_version>
+ <maintainer>seth.mos@xs4all.nl</maintainer>
+ <depends_on_package_base_url>ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-stable/All</depends_on_package_base_url>
+ <depends_on_package>lcdproc-0.5.2_1.tbz</depends_on_package>
+ <config_file>http://www.pfsense.org/packages/config/lcdproc/lcdproc.xml</config_file>
+ <configurationfile>lcdproc.xml</configurationfile>
+ </package>
+ <package>
<name>arpwatch</name>
<descr>Arpwatch monitors ethernet/ip address pairings. It also logs certain changes to syslog.</descr>
<website>http://www-nrg.ee.lbl.gov/</website>