updated on Tue Jan 17 12:00:36 UTC 2012
[aur-mirror.git] / pactools / pt-pacsize
blobe70a34597e6daa6fea5a614ca54a0d2c978c2f0d
1 #!/bin/bash
3 ##AUTHOR: hads
4 ##See: http://bbs.archlinux.org/viewtopic.php?t=20971
6 for i in /var/lib/pacman/local/*; do
7 PKG=`echo $i | cut -d '/' -f 6`
8 SIZE=`grep -A 1 SIZE $i/desc | tail -1`
9 if [ -x /usr/bin/bc ]; then
10 if [ $SIZE -gt 1024 ]; then
11 if [ $SIZE -gt 1048576 ]; then
12 SIZE=`echo "scale=1;$SIZE/1048576" | bc`M
13 else
14 SIZE=`echo "scale=1;$SIZE/1024" | bc`K
16 else
17 SIZE={$SIZE}B
20 echo "$PKG | $SIZE"
21 done