Developing lightweight computation at the DSG edge

Commit 6bb062d4 authored by hitz's avatar hitz
Browse files

Added shell support

parent fc789921
......@@ -34,3 +34,15 @@ config qmp networks
option babel_mesh_prefix48 'fd03:0:0'
#This is only a prototype, not implemented!
config qmp wireless1
option driver madwifi
option channel 44 option country 800
option mode mesh
config qmp wireless2
option driver athXk
option channel 10
option country 800 option mode ap
config wifi-device wifi0
option type atheros
option channel 10
option channel 44
option diversity 0 # 0:off, 1:on
option txantenna 1 # 0:auto, 1:main, 2:aux
option rxantenna 1 # 0:auto, 1:main, 2:aux
option country 276
option country 800
option outdoor 1
# option txpower 1
......
#!/bin/sh
# Licence: GPLv3
# Part of qmp.cat project
# Maintainer: p4u
#
# This script gives information about bmx6
# Can be executed from a linux shell: ./bmx6-info -s links
# Or from web interfae (with cgi enabled): http://host/cgi-bin/bmx6-info?links
# If you ask for a directory you wil get the directory contents in JSON forman
BMX6_DIR="/var/run/bmx6/json"
#Checking if shell mode or cgi-bin mode
if [ "$1" == "-s" ]; then QUERY="$2"
else QUERY="$QUERY_STRING"
fi
check_path() {
[ -d "$1" ] && path=$(cd $1; pwd)
......@@ -8,20 +22,25 @@ check_path() {
[ $(echo "$path" | grep -c "^$BMX6_DIR") -ne 1 ] && exit 1
}
echo "Content-type: text/html"
echo ""
check_path "$BMX6_DIR/$QUERY_STRING"
check_path "$BMX6_DIR/$QUERY"
[ -d "$BMX6_DIR/$QUERY_STRING" ] &&
[ -d "$BMX6_DIR/$QUERY" ] &&
{
ls -1F "$BMX6_DIR/$QUERY_STRING";
total=$(ls $BMX6_DIR/$QUERY | wc -w)
i=1
echo -n "{ \"$QUERY\": [ "
for f in $(ls $BMX6_DIR/$QUERY); do
echo -n "{ \"name\": \"$f\" }"
[ $i -lt $total ] && echo -n ','
i=$(( $i + 1 ))
done
echo -n " ] }"
exit 0;
}
[ -f "$BMX6_DIR/$QUERY_STRING" ] &&
[ -f "$BMX6_DIR/$QUERY" ] &&
{
cat "$BMX6_DIR/$QUERY_STRING";
cat "$BMX6_DIR/$QUERY";
exit 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment