diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-olsr-viz/htdocs/cgi-bin/vizdata.sh | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-olsr-viz/htdocs/cgi-bin/vizdata.sh')
-rwxr-xr-x | applications/luci-app-olsr-viz/htdocs/cgi-bin/vizdata.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/applications/luci-app-olsr-viz/htdocs/cgi-bin/vizdata.sh b/applications/luci-app-olsr-viz/htdocs/cgi-bin/vizdata.sh new file mode 100755 index 0000000000..5a74f2be94 --- /dev/null +++ b/applications/luci-app-olsr-viz/htdocs/cgi-bin/vizdata.sh @@ -0,0 +1,48 @@ +#!/bin/sh +echo Content-type: text/html +echo + +cat<<EOF +<HTML> +<HEAD> + <TITLE>OLSR-VIZ Data</TITLE> + <META CONTENT="text/html; charset=iso-8859-1" HTTP-EQUIV="Content-Type"> + <META CONTENT="no-cache" HTTP-EQUIV="cache-control"> +</HEAD> +<BODY> + +<script langauge='JavaScript1.2' type='text/javascript'> +EOF + +# sed + txtinfo plugin +re_ip='[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}' +re_sep='[[:space:]]\{1,\}' +re_nosep='[^[:space:]]\{1,\}' +wget http://127.0.0.1:2006/all -qO - | sed -n " +/^Table: Links$/,/^$/ { +s# # - #g +s#\($re_ip\)$re_sep\($re_ip\)\($re_sep$re_nosep\)\{3\}$re_sep\($re_nosep\)#parent.touch_edge(parent.touch_node('\1').set_metric(1).update(),parent.touch_node('\2').set_metric(1).update(),'\4');#p +} +/^Table: Topology$/,/^$/ { +s#\($re_ip\)$re_sep\($re_ip\)\($re_sep$re_nosep\)\{2\}$re_sep\($re_nosep\)#parent.touch_edge(parent.touch_node('\1').update(),parent.touch_node('\2').update(),'\4');#p +} +/^Table: HNA$/,/^$/ { +s#\($re_ip\)/\([0-9]\{1,\}\)$re_sep\($re_ip\)#parent.touch_hna(parent.touch_node('\3'),'\1','\2');#p +} +/^Table: Routes$/,/^$/ { +s#\($re_ip\)/32$re_sep$re_nosep$re_sep\($re_nosep\).*#parent.touch_node('\1').set_metric('\2').update();#p +} +" + +hosts=$(uci show olsrd|grep hosts_file|cut -d "=" -f 2) +if [ -n $hosts ]; then +sed -n " +s#\($re_ip\)$re_sep\($re_nosep\)$re_sep.*#parent.touch_node('\1').set_desc('\2');#p +" < $hosts +fi + +cat<<EOF + parent.viz_callback(); +</script> +</BODY></HTML> +EOF |