2011-06-28 00:20:31 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2011-07-11 23:29:21 +00:00
|
|
|
source /mod/var/mongoose/lib/setup
|
2011-07-14 22:22:54 +00:00
|
|
|
require pkg.class chunked
|
2011-06-28 00:20:31 +00:00
|
|
|
|
|
|
|
puts "Content-Type: text/html"
|
2011-07-11 23:29:21 +00:00
|
|
|
puts "Transfer-Encoding: chunked"
|
2011-06-28 00:20:31 +00:00
|
|
|
puts ""
|
|
|
|
|
|
|
|
cgi_input
|
|
|
|
#cgi_dump
|
|
|
|
|
2011-07-14 22:22:54 +00:00
|
|
|
set cmd [cgi_get cmd update]
|
2011-06-28 00:20:31 +00:00
|
|
|
|
2011-07-11 23:29:21 +00:00
|
|
|
set bcmd "|/mod/var/mongoose/lib/opkg $cmd"
|
|
|
|
set fd [open $bcmd r]
|
|
|
|
while {[gets $fd line] >= 0} {
|
|
|
|
chunk "$line\r\n"
|
|
|
|
}
|
|
|
|
close $fd
|
|
|
|
|
|
|
|
if {$cmd eq "update"} {
|
|
|
|
chunk "Updating package meta information\r\n"
|
|
|
|
pkg fetchmeta
|
|
|
|
chunk "Done.\r\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
chunk ""
|
|
|
|
puts "\r\n"
|
2011-06-28 00:20:31 +00:00
|
|
|
|