summaryrefslogtreecommitdiff
path: root/pcr/pactools/pt-pacsize
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-12-31 17:29:39 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-12-31 17:29:39 -0300
commit6f102d1647580e0bb9513c124b26a64c77da4f15 (patch)
tree0340f1f588be251183fe2b251bdba778f2c85c22 /pcr/pactools/pt-pacsize
parent433900b14f11dc9ee55b72e8e5946bf47f65b636 (diff)
parentb6cb10de275cea63bab0bee2a98342afa4fdc4ee (diff)
downloadabslibre-6f102d1647580e0bb9513c124b26a64c77da4f15.tar.gz
abslibre-6f102d1647580e0bb9513c124b26a64c77da4f15.tar.bz2
abslibre-6f102d1647580e0bb9513c124b26a64c77da4f15.zip
Merge branch 'master' of ssh://gparabola/srv/git/abslibre
Diffstat (limited to 'pcr/pactools/pt-pacsize')
-rw-r--r--pcr/pactools/pt-pacsize21
1 files changed, 21 insertions, 0 deletions
diff --git a/pcr/pactools/pt-pacsize b/pcr/pactools/pt-pacsize
new file mode 100644
index 000000000..e70a34597
--- /dev/null
+++ b/pcr/pactools/pt-pacsize
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+##AUTHOR: hads
+##See: http://bbs.archlinux.org/viewtopic.php?t=20971
+
+for i in /var/lib/pacman/local/*; do
+ PKG=`echo $i | cut -d '/' -f 6`
+ SIZE=`grep -A 1 SIZE $i/desc | tail -1`
+ if [ -x /usr/bin/bc ]; then
+ if [ $SIZE -gt 1024 ]; then
+ if [ $SIZE -gt 1048576 ]; then
+ SIZE=`echo "scale=1;$SIZE/1048576" | bc`M
+ else
+ SIZE=`echo "scale=1;$SIZE/1024" | bc`K
+ fi
+ else
+ SIZE={$SIZE}B
+ fi
+ fi
+ echo "$PKG | $SIZE"
+done