2011-06-28 00:20:31 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2012-05-21 20:23:41 +00:00
|
|
|
source /mod/webif/lib/setup
|
2011-07-14 22:22:54 +00:00
|
|
|
require pkg.class chunked
|
2011-06-28 00:20:31 +00:00
|
|
|
|
|
|
|
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-10-07 18:18:45 +00:00
|
|
|
proc opkg {cmd} {
|
|
|
|
chunk ">>> opkg $cmd\r\n"
|
2012-05-21 20:23:41 +00:00
|
|
|
set bcmd "|/mod/webif/lib/opkg $cmd"
|
2011-10-07 18:18:45 +00:00
|
|
|
set fd [open $bcmd r]
|
|
|
|
while {[gets $fd line] >= 0} {
|
|
|
|
chunk "$line\r\n"
|
|
|
|
#chunk_pad
|
|
|
|
}
|
|
|
|
close $fd
|
2011-10-11 19:51:58 +00:00
|
|
|
chunk "\r\n"
|
2011-10-07 18:18:45 +00:00
|
|
|
}
|
|
|
|
|
2011-07-15 23:20:57 +00:00
|
|
|
start_chunked
|
|
|
|
|
2011-10-07 18:18:45 +00:00
|
|
|
if {$cmd eq "upgrade"} { opkg update }
|
|
|
|
opkg $cmd
|
2011-07-11 23:29:21 +00:00
|
|
|
|
2011-10-07 18:18:45 +00:00
|
|
|
if {$cmd eq "update" || $cmd eq "upgrade"} {
|
2011-07-11 23:29:21 +00:00
|
|
|
chunk "Updating package meta information\r\n"
|
|
|
|
pkg fetchmeta
|
|
|
|
chunk "Done.\r\n"
|
|
|
|
}
|
|
|
|
|
2011-07-15 23:20:57 +00:00
|
|
|
end_chunked
|
2011-06-28 00:20:31 +00:00
|
|
|
|