Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
user:vvkjndl:opkg-list-packages-sorted [2020/10/10 20:23] vvkjndluser:vvkjndl:opkg-list-packages-sorted [2020/10/30 15:24] vvkjndl
Line 1: Line 1:
-===== Opkg List All Installed Packages Sorted by Size=====+===== Opkg List All Installed Packages Sorted by Size =====
  
 :!: This script is inspired by [[https://openwrt.org/user/yeti/opkg-list-user-installed-packages]]. :!: This script is inspired by [[https://openwrt.org/user/yeti/opkg-list-user-installed-packages]].
Line 5: Line 5:
 :!: This script will list all packages instead of listing only user-installed packages. :!: This script will list all packages instead of listing only user-installed packages.
  
-Three conditions are applied in determining a package size (in order, if first is not application then next one is used):+Three conditions are applied in determining a package size (in order, if the first one is not applicable then the next one is used):
  
   * Calculate size of all files in package list file ''/usr/lib/opkg/info/packagename.list''. ''du -k'' command is used. (fast and accurate)   * Calculate size of all files in package list file ''/usr/lib/opkg/info/packagename.list''. ''du -k'' command is used. (fast and accurate)
-  * Calculate package size using opkg itself. ''opkg info packagename'' command is used. (CPU-intensive and less-accurate as actual files residing on filesystem are probably consume more space)+  * Calculate package size using opkg itself. ''opkg info packagename'' command is used. (CPU-intensive and less-accurate as actual files residing on filesystem are probably consuming more space)
   * Mark package size as unknown using ''-.-''.   * Mark package size as unknown using ''-.-''.
  
Line 25: Line 25:
         if [[ -z "$packagefiles" ]]         if [[ -z "$packagefiles" ]]
         then         then
-                packagesizeb=$(opkg info $packagename | grep Size | sed 's/Size\:\ //g')+                packagesizeb=$(opkg info $packagename | grep Size\: | sed 's/Size\:\ //g')
                 if [[ -z $packagesizeb ]]                 if [[ -z $packagesizeb ]]
                 then                 then
                         echo -e "-.- KB \t\t$packagename"                         echo -e "-.- KB \t\t$packagename"
                 else                 else
-                        packagesizekb=$(opkg info $packagename | grep Size | sed 's/Size\:\ //g' | awk 'END {printf "%.02f\n", $1/1024}')+                        packagesizekb=$(opkg info $packagename | grep Size\: | sed 's/Size\:\ //g' | awk 'END {printf "%.02f\n", $1/1024}')
                         printf '%-16s' "$packagesizekb KB"; printf '%s\n' "$packagename"                         printf '%-16s' "$packagesizekb KB"; printf '%s\n' "$packagename"
                 fi                 fi
  • Last modified: 2021/08/10 08:28
  • by tmomas