Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| user:vvkjndl:opkg-list-packages-sorted [2020/10/10 19:47] – vvkjndl | user:vvkjndl:opkg-list-packages-sorted [2020/10/30 15:24] – vvkjndl | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | < | + | ===== Opkg List All Installed Packages Sorted by Size ===== |
| + | |||
| + | :!: This script is inspired by [[https:// | ||
| + | |||
| + | :!: 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 the first one is not applicable then the next one is used): | ||
| + | |||
| + | * Calculate size of all files in package list file ''/ | ||
| + | * Calculate package size using opkg itself. '' | ||
| + | * Mark package size as unknown using '' | ||
| + | |||
| + | :!: This script should work on base installation without requiring any additional packages to be installed. | ||
| + | |||
| + | < | ||
| #!/bin/sh | #!/bin/sh | ||
| Line 11: | Line 25: | ||
| if [[ -z " | if [[ -z " | ||
| then | then | ||
| - | packagesizeb=$(opkg info $packagename | grep Size | sed ' | + | packagesizeb=$(opkg info $packagename | grep Size\: | sed ' |
| 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 ' | + | packagesizekb=$(opkg info $packagename | grep Size\: | sed ' |
| printf ' | printf ' | ||
| fi | fi | ||