openwrt list packages and used space code example
Example: openwrt list packages and used space
#!/usr/bin/awk -f
BEGIN {
D="cd /overlay/upper/usr/lib/opkg/info&&"
C=D"ls *.list"
S="sort -n"
while(C|getline>0) {
P=substr(F=$1,1,length($1)-5)
J=D"du -sk $(cat "F")"
s=0
while(J|getline>0) {
s+=$1
t+=$1
}
close(J)
print s"\t"P|S
}
close(S)
print t"\t---TOTAL---"
}