index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <dreisner@archlinux.org> | 2012-05-06 19:47:47 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-06-25 23:39:46 -0500 |
commit | b1bb2eaa50e436e2221a1aec9749de58e4234b44 (patch) | |
tree | fcdeb68e3f02d8f93163dcc27e01601847659fa3 | |
parent | a98fce08968febe7395b30f15f070f400da089ed (diff) |
-rw-r--r-- | contrib/Makefile.am | 2 | ||||
-rw-r--r-- | contrib/paccache.sh.in | 21 | ||||
-rw-r--r-- | scripts/library/size_to_human.sh | 2 |
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index ccf56c5a..3641a085 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -93,7 +93,7 @@ uninstall-local: bacman: $(srcdir)/bacman.sh.in bash_completion: $(srcdir)/bash_completion.in -paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh +paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh $(top_srcdir)/scripts/library/size_to_human.sh pacdiff: $(srcdir)/pacdiff.sh.in paclist: $(srcdir)/paclist.sh.in paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in 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 diff --git a/scripts/library/size_to_human.sh b/scripts/library/size_to_human.sh index 9c0f0de2..1d13eeb4 100644 --- a/scripts/library/size_to_human.sh +++ b/scripts/library/size_to_human.sh @@ -6,6 +6,8 @@ size_to_human() { suffix[3] = "MiB" suffix[4] = "GiB" suffix[5] = "TiB" + suffix[6] = "PiB" + suffix[7] = "EiB" count = 1 while (size > 1024) { |