#!/mod/bin/jimsh # Build a list of available packages set avail_pkgs {} foreach pkg [split [exec /bin/opkg list] "\n"] { if [regexp {^ } $pkg] { append descr $pkg } else { if {[regexp {^([^ ]+) - ([^ ]+) - (.*)$} \ $pkg full name ver descr] == 0} { continue } } set avail_pkgs($name) [concat $ver "$descr"] #puts "Set: $name = ($ver, $descr)
" } # Build a list of installed packages - just the names set inst_pkgs {} foreach pkg [split [exec /bin/opkg list-installed] "\n"] { if {[regexp {^([^ ]+)} $pkg name] == 0} { continue } lappend inst_pkgs $name #puts "Inst: $name
" } puts "" puts "" puts "" puts "" puts "" puts "" puts "" foreach name [lsort [array names avail_pkgs]] { set value $avail_pkgs($name) set ver [lindex $value 0] set descr [lrange $value 1 [llength $value]] puts "" puts "" puts "" puts "" puts "" puts "" } puts "
InstalledNameVersionDescription
" if {[lsearch $inst_pkgs $name] > -1} { puts "" } else { puts "" } puts "$name$ver$descr
"