ded9495595
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@265 2a923420-c742-0410-a762-8d5b09965624
46 lines
815 B
Plaintext
Executable File
46 lines
815 B
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
package require cgi
|
|
source /mod/var/mongoose/lib/setup
|
|
require pkg.class
|
|
|
|
puts "Content-Type: text/html"
|
|
puts "Transfer-Encoding: chunked"
|
|
puts ""
|
|
|
|
cgi_input
|
|
#cgi_dump
|
|
|
|
#set _cgi(cmd) {remove binutils}
|
|
|
|
if {![dict exists $_cgi cmd]} { set _cgi(cmd) update }
|
|
|
|
set cmd [dict get $_cgi cmd]
|
|
|
|
proc chunk {chk} {
|
|
puts -nonewline [format "%x\r\n" [string length $chk]]
|
|
puts -nonewline "$chk\r\n"
|
|
flush stdout
|
|
}
|
|
|
|
# Kick the browser into life...
|
|
chunk [string range [format "%301d" 0] 1 end-1]
|
|
|
|
#puts [exec /mod/var/mongoose/lib/opkg {*}$cmd]
|
|
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"
|
|
|