diff options
author | bartus | 2019-10-30 21:52:41 +0100 |
---|---|---|
committer | Que Quotion | 2019-11-01 12:33:36 +0900 |
commit | 7c79bfe21813f5403980a5aec5138fd6c6ae0d01 (patch) | |
tree | f59931398f0a37e09515163365973eb0ba47d8b8 /upx.sh.in | |
parent | 2be3b9630a14a3fac26a51b9eda94e311c377bf0 (diff) | |
download | aur-7c79bfe21813f5403980a5aec5138fd6c6ae0d01.tar.gz |
Add multiprocessing to upx/png/svg and fix upx case statement.
Diffstat (limited to 'upx.sh.in')
-rw-r--r-- | upx.sh.in | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/upx.sh.in b/upx.sh.in index 340df6c8d66b..6d03d1fb7cd7 100644 --- a/upx.sh.in +++ b/upx.sh.in @@ -19,18 +19,19 @@ tidy_upx() { msg2 "$(gettext "Compressing binaries with %s...")" "UPX" local binary find . -type f -perm -u+w 2>/dev/null | while read -r binary ; do - if [[ $(file --brief --mime-type "$binary") == application* ]] ; then - case "$(file --brief --mime-type "$binary")" in - 'application/x-executable' | 'application/x-dosexec') - upx "${UPXFLAGS[@]}" "$binary" &>/dev/null || - warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}" - ;; - *) - warning "$(gettext "Not compressing %s, $(file --brief --mime-type "$binary")")" \ - "${binary/$pkgdir\//}" - ;; - esac - fi + [ $(jobs -p|wc -l) -gt $(nproc) ] && wait -n + mime=$(file --brief --mime-type "$binary") + case "$mime" in + application/x-executable | application/x-dosexec ) + { upx "${UPXFLAGS[@]}" "$binary" &>/dev/null || + warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}"; } & + ;; + application* ) + warning "$(gettext "Not compressing %s, $(file --brief --mime-type "$binary")")" \ + "${binary/$pkgdir\//}" + ;; + esac done + wait fi } |