--- /dev/null
+#!/bin/sh
+# ipkg.cgi
+# Ian Roberts
+# May 12 2012
+# CGI to execute ipkg <argument>
+# script expects only one argument
+# valid arguments are list_installed, list etc
+
+cat <<EOF
+Content-type: text/html
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1"></head></head>
+<body>
+EOF
+
+arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+#Todo : Test for one argument
+#Todo : Test for valid argument
+ipkg $arg
+
+cat <<EOF
+</body>
+</html>
+EOF
html += '<tr><td div id="mtd"></div></td></tr>';
html += '<tr><td colspan="2">cat /proc/meminfo</td></tr>';
+ html += '<tr><td div id="meminfo"></div></td></tr>';
html += '<tr><td colspan="2">cat /proc/yaffs</td></tr>';
+ html += '<tr><td div id="yaffs"></div></td></tr>';
html += '<tr><td colspan="2">uptime</td></tr>';
+ html += '<tr><td div id="uptime"></div></td></tr>';
html += '<tr><td colspan="2">ipkg list_installed</td></tr>';
+ html += '<tr><td div id="installed"></div></td></tr>';
html += '<tr><td> </td></tr>';
}
function loadCPUinfo(doc, status) {
- cpuinfo = "";
-
-// cpuinfo = doc.substr(0, doc.length);
- if (doc.indexOf("processor") != -1) {
- ip = doc.substr(doc.indexOf("processor"), doc.length);
-// ip = ip.substr(10, ip.length);
- ip = ip.substr(0, ip.indexOf("power manage"));
- }
+ ip = "";
+
+ ip = doc.substr(0, doc.length);
+ if (doc.indexOf("CPU") != -1) {
+
+ // Blackfin hardware is ADSP-BF533
+ ip = doc.substr(doc.indexOf("CPU"), doc.length);
+// ip = ip.substr(10, ip.length);
+// ip = ip.substr(0, ip.indexOf("power manage"));
+ }
+
document.getElementById('cpuinfo').innerHTML = ip;
downloadUrl("/cgi-bin/catproc.cgi?arg=mtd", loadmtd);
document.getElementById('mtd').innerHTML = doc.substr(0, doc.length);
-// downloadUrl("/cgi-bin/catproc.cgi?arg=cpuinfo", loadCPUinfo);
+ downloadUrl("/cgi-bin/catproc.cgi?arg=meminfo", loadmeminfo);
+}
+
+function loadmeminfo(doc, status) {
+
+ document.getElementById('meminfo').innerHTML = doc.substr(0, doc.length);
+
+ downloadUrl("/cgi-bin/catproc.cgi?arg=yaffs", loadyaffs);
+}
+
+function loadyaffs(doc, status) {
+
+ document.getElementById('yaffs').innerHTML = doc.substr(0, doc.length);
+
+ downloadUrl("/cgi-bin/uptime.cgi?arg=nothing", loaduptime);
+}
+
+function loaduptime(doc, status) {
+
+ document.getElementById('uptime').innerHTML = doc.substr(0, doc.length);
+
+ downloadUrl("/cgi-bin/ipkg.cgi?arg=list_installed", loadinstalled);
}
+function loadinstalled(doc, status) {
+
+ document.getElementById('installed').innerHTML = doc.substr(0, doc.length);
+
+// downloadUrl("/cgi-bin/catproc.cgi?arg=cpuinfo", loadCPUinfo);
+}