#!/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 "
Installed | " puts "Name | " puts "Version | " puts "Description | " puts "
---|---|---|---|
" if {[lsearch $inst_pkgs $name] > -1} { puts "" } else { puts "" } puts " | " puts "$name | " puts "$ver | " puts "$descr | " puts "