aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-08-28 16:16:38 -0400
committerjim-p <jimp@pfsense.org>2013-08-28 16:16:38 -0400
commit429adb3b2dc66541670245bb63e0b952fda0617b (patch)
treecf4b996e3f1bd78bbf287356a59e270270ef5489
parent4e3879cf61b174570a0a27ab84fd32040e044222 (diff)
downloadpfsense-packages-429adb3b2dc66541670245bb63e0b952fda0617b.tar.gz
pfsense-packages-429adb3b2dc66541670245bb63e0b952fda0617b.tar.bz2
pfsense-packages-429adb3b2dc66541670245bb63e0b952fda0617b.zip
Teach blinkled how to write an rcfile since it claims to use one in its service definition.
-rw-r--r--config/blinkled8/blinkled.inc37
-rw-r--r--config/blinkled8/blinkled.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
4 files changed, 37 insertions, 6 deletions
diff --git a/config/blinkled8/blinkled.inc b/config/blinkled8/blinkled.inc
index d50cc022..f466da94 100644
--- a/config/blinkled8/blinkled.inc
+++ b/config/blinkled8/blinkled.inc
@@ -1,10 +1,36 @@
<?php
require_once("functions.inc");
+function blinkled_rcfile() {
+ global $config;
+ $blinkled_config = $config['installedpackages']['blinkled']['config'][0];
+ $stop = <<<EOD
+if [ `/bin/pgrep blinkled | /usr/bin/wc -l` != 0 ]; then
+ /usr/bin/killall -9 blinkled
+ while [ `/bin/pgrep blinkled | /usr/bin/wc -l` != 0 ]; do
+ sleep 1
+ done
+ fi
+EOD;
+
+ $start = "{$stop}\n";
+ if (($blinkled_config['enable_led2']) && ($blinkled_config['iface_led2']))
+ $start .= "\t" . blinkled_launch(convert_friendly_interface_to_real_interface_name($blinkled_config['iface_led2']), 2, true) . "\n";
+ if (($blinkled_config['enable_led3']) && ($blinkled_config['iface_led3']))
+ $start .= "\t" . blinkled_launch(convert_friendly_interface_to_real_interface_name($blinkled_config['iface_led3']), 3, true) . "\n";
+
+ conf_mount_rw();
+ write_rcfile(array(
+ 'file' => 'blinkled.sh',
+ 'start' => $start,
+ 'stop' => $stop)
+ );
+ conf_mount_ro();
+}
+
function blinkled_running () {
return ((int)exec('pgrep blinkled | wc -l') > 0);
}
-
function sync_package_blinkled() {
global $config;
$blinkled_config = $config['installedpackages']['blinkled']['config'][0];
@@ -16,10 +42,15 @@ function sync_package_blinkled() {
if(!blinkled_running()) {
blinkled_start();
}
+ blinkled_rcfile();
}
-function blinkled_launch($int, $led) {
- mwexec("/usr/local/bin/blinkled -i " . escapeshellarg($int) . " -l /dev/led/led" . escapeshellarg($led));
+function blinkled_launch($int, $led, $return = false) {
+ $cmd = "/usr/local/bin/blinkled -i " . escapeshellarg($int) . " -l " . escapeshellarg("/dev/led/led{$led}");
+ if ($return)
+ return $cmd;
+ else
+ mwexec($cmd);
}
function blinkled_start() {
diff --git a/config/blinkled8/blinkled.xml b/config/blinkled8/blinkled.xml
index 298ba42e..5fb5ff7c 100644
--- a/config/blinkled8/blinkled.xml
+++ b/config/blinkled8/blinkled.xml
@@ -2,7 +2,7 @@
<packagegui>
<title>Interfaces: Assign LEDs</title>
<name>blinkled</name>
- <version>20090710</version>
+ <version>0.4</version>
<savetext>Save</savetext>
<include_file>/usr/local/pkg/blinkled.inc</include_file>
<menu>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 4653345c..beb9fea2 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1490,7 +1490,7 @@
<name>blinkled</name>
<descr>Allows you to use LEDs for network activity on supported platforms (ALIX, WRAP, Soekris, etc)</descr>
<category>System</category>
- <version>0.3</version>
+ <version>0.4</version>
<status>Beta</status>
<maintainer>jimp@pfsense.org</maintainer>
<required_version>1.2.3</required_version>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 8d88316c..86cb6d54 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1477,7 +1477,7 @@
<name>blinkled</name>
<descr>Allows you to use LEDs for network activity on supported platforms (ALIX, WRAP, Soekris, etc)</descr>
<category>System</category>
- <version>0.3</version>
+ <version>0.4</version>
<status>Beta</status>
<maintainer>jimp@pfsense.org</maintainer>
<required_version>1.2.3</required_version>