Developing lightweight computation at the DSG edge

Commit 9949849a authored by hitz's avatar hitz
Browse files

Added bmx6-info cgi script

parent cf884620
......@@ -42,6 +42,7 @@ endef
define Package/bmx6-luci/install
$(CP) ./files/* $(1)/
chmod 755 $(1)/www/cgi-bin/bmx6-info
endef
$(eval $(call BuildPackage,bmx6-luci))
......
#!/bin/sh
BMX6_DIR="/var/run/bmx6/json"
#!/bin/sh
BMX6_DIR="/var/run/bmx6/json"
check_path() {
[ -d "$1" ] && path=$(cd $1; pwd)
[ -f "$1" ] && path=$(cd $1/..; pwd)
[ $(echo "$path" | grep -c "^$BMX6_DIR") -ne 1 ] && exit 1
}
echo "Content-type: text/html"
echo ""
check_path "$BMX6_DIR/$QUERY_STRING"
[ -d "$BMX6_DIR/$QUERY_STRING" ] &&
{
ls -1F "$BMX6_DIR/$QUERY_STRING";
exit 0;
}
[ -f "$BMX6_DIR/$QUERY_STRING" ] &&
{
cat "$BMX6_DIR/$QUERY_STRING";
exit 0;
}
ls -1F "$BMX6_DIR"
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