#!/mod/bin/jimsh package require cgi source /mod/webif/lib/setup require settings.class pkg.class altrow if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 } puts "Content-Type: text/html" puts "Pragma: no-cache" puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT" puts "" cgi_input #cgi_dump if {![dict exists $_cgi type]} { set _cgi(type) avail } proc pkgrow {pkg} { set name [$pkg get name] altrow "pkg=\"$name\"" puts "$name" if {$::type eq "inst"} { puts "
   Info" } puts "" if {$::type eq "avail"} { puts "[$pkg get latest]" } else { puts "[$pkg get installed]" } if {$::type eq "upgr"} { puts "[$pkg get latest]" } if {[dict exists $::pkgmeta $name]} { puts "$::pkgmeta($name)" } else { puts "[$pkg get descr]" } if {![$pkg is installed]} { set type Install } elseif {$::type eq "upgr" && [$pkg is upgradable]} { set type Upgrade } else { set type Remove } puts "" puts "" } pkg loadmeta set type $_cgi(type) set pkgs [pkg $type] if {[llength $pkgs] > 0} { puts "" if {$type eq "avail"} { puts "" } else { puts "" } if {$type eq "upgr"} { puts "" } puts " " foreach pkg $pkgs { if {$type ne "upgr" && $filter && \ ![dict exists $::pkgmeta $pkg]} { continue } pkgrow [pkg load $pkg] } puts "
PackageAvailableInstalledAvailDescription   Action  
" if {$filter} { puts "This is a filtered package list. To show all packages, enable the Show development and advanced packages in the settings screen." } } else { puts "No packages " switch $type { inst { puts "are installed." } upgr { puts "are available for upgrade; try updating the package list from the Internet using the button above." } avail { puts "are available for installation." } } puts "" }