summaryrefslogtreecommitdiff
path: root/contrib/paccache.sh.in
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-06 19:47:47 -0400
committerDan McGee <dan@archlinux.org>2012-06-25 23:39:46 -0500
commitb1bb2eaa50e436e2221a1aec9749de58e4234b44 (patch)
treefcdeb68e3f02d8f93163dcc27e01601847659fa3 /contrib/paccache.sh.in
parenta98fce08968febe7395b30f15f070f400da089ed (diff)
downloadpacman-b1bb2eaa50e436e2221a1aec9749de58e4234b44.tar.xz
paccache: adopt size_to_human
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'contrib/paccache.sh.in')
-rw-r--r--contrib/paccache.sh.in21
1 files changed, 1 insertions, 20 deletions
diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index ded42ed5..e8136559 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -108,26 +108,7 @@ pkgfilter() {
}' "${@:3}"
}
-size_to_human() {
- awk -v size="$1" '
- BEGIN {
- suffix[1] = "B"
- suffix[2] = "KiB"
- suffix[3] = "MiB"
- suffix[4] = "GiB"
- suffix[5] = "TiB"
- count = 1
-
- while (size > 1024) {
- size /= 1024
- count++
- }
-
- sizestr = sprintf("%.2f", size)
- sub(/\.?0+$/, "", sizestr)
- printf("%s %s", sizestr, suffix[count])
- }'
-}
+m4_include(../scripts/library/size_to_human.sh)
runcmd() {
if (( needsroot && EUID != 0 )); then