diff mbox

[2/2] scripts: buildtar use parallel compress if available

Message ID 1471354514-12323-2-git-send-email-dmonakhov@openvz.org (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Monakhov Aug. 16, 2016, 1:35 p.m. UTC
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 scripts/package/buildtar | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jim Davis Aug. 16, 2016, 8:06 p.m. UTC | #1
On Tue, Aug 16, 2016 at 6:35 AM, Dmitry Monakhov <dmonakhov@openvz.org> wrote:

> +               type pigz >/dev/null 2>&1 && compress="pigz"

Isn't the "type" builtin a feature of the bash shell?  The buildtar
script won't necessarily be executed by bash.
Dmitry Monakhov Aug. 16, 2016, 9:34 p.m. UTC | #2
Jim Davis <jim.epost@gmail.com> writes:

> On Tue, Aug 16, 2016 at 6:35 AM, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
>
>> +               type pigz >/dev/null 2>&1 && compress="pigz"
>
> Isn't the "type" builtin a feature of the bash shell?  The buildtar
> script won't necessarily be executed by bash.
Yes, you are right.  Let's use '/usr/bin/which'. I'll resend new version. 
>
> -- 
> Jim
diff mbox

Patch

diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index c64e6eb..d0d790f 100755
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -29,14 +29,17 @@  case "${1}" in
 		;;
 	targz-pkg)
 		compress="gzip"
+		type pigz >/dev/null 2>&1 && compress="pigz"
 		file_ext=".gz"
 		;;
 	tarbz2-pkg)
 		compress="bzip2"
+		type lbzip2 >/dev/null 2>&1 && compress="lbzip2"
 		file_ext=".bz2"
 		;;
 	tarxz-pkg)
 		compress="xz"
+		type pxz >/dev/null 2>&1 && compress="pxz"
 		file_ext=".xz"
 		;;
 	*)