aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-06-05 10:56:06 +0000
committerJohn Crispin <blogic@openwrt.org>2014-06-05 10:56:06 +0000
commitb8e563d2d056c6f8f9859d1ba6201d813e782aec (patch)
treebb4b6ec47feefad878735a7eea6e8e9cad431269 /package
parent120957698ac8f10e8f38588047748368a3be2171 (diff)
downloadmaster-187ad058-b8e563d2d056c6f8f9859d1ba6201d813e782aec.tar.gz
master-187ad058-b8e563d2d056c6f8f9859d1ba6201d813e782aec.tar.bz2
master-187ad058-b8e563d2d056c6f8f9859d1ba6201d813e782aec.zip
procd: add wrapper calls for interface triggers
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41008 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/system/procd/files/procd.sh37
1 files changed, 35 insertions, 2 deletions
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index d83c067fd0..bee3293837 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -128,7 +128,7 @@ _procd_set_param() {
env|data|limits)
_procd_add_table "$type" "$@"
;;
- command|netdev|file|respawn)
+ command|netdev|file|respawn|watch)
_procd_add_array "$type" "$@"
;;
nice)
@@ -137,6 +137,37 @@ _procd_set_param() {
esac
}
+_procd_add_interface_trigger() {
+ json_add_array
+ _procd_add_array_data "$1"
+ shift
+
+ json_add_array
+ _procd_add_array_data "if"
+
+ json_add_array
+ _procd_add_array_data "eq" "interface" "$1"
+ shift
+ json_close_array
+
+ json_add_array
+ _procd_add_array_data "run_script" "$@"
+ json_close_array
+
+ json_close_array
+
+ json_close_array
+}
+
+_procd_add_network_trigger() {
+ local script=$(readlink "$initscript")
+ local name=$(basename ${script:-$initscript})
+
+ _procd_open_trigger
+ _procd_add_interface_trigger "interface.*" $1 /etc/init.d/$name reload
+ _procd_close_trigger
+}
+
_procd_add_config_trigger() {
json_add_array
_procd_add_array_data "$1"
@@ -182,7 +213,7 @@ _procd_append_param() {
env|data|limits)
_procd_add_table_data "$@"
;;
- command|netdev|file|respawn)
+ command|netdev|file|respawn|watch)
_procd_add_array_data "$@"
;;
esac
@@ -237,6 +268,8 @@ _procd_wrapper \
procd_add_instance \
procd_add_config_trigger \
procd_add_reload_trigger \
+ procd_add_interface_trigger \
+ procd_add_network_trigger \
procd_open_trigger \
procd_close_trigger \
procd_open_instance \