2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-03 03:50:08 +00:00

use pigz instead of gzip in liteimg

This commit is contained in:
immarvin 2015-08-28 02:56:26 -04:00
parent 5e03ebc498
commit 81409e1899

View File

@ -522,15 +522,26 @@ sub process_request {
my $oldmask;
$callback->({data=>["$verb contents of $rootimg_dir"]});
unlink("$destdir/rootimg-statelite.gz");
my $compress="gzip";
#use "pigz" as the compress tool instead of gzip if "pigz" exist
my $ispigz=system("bash -c 'type -p pigz'");
if($ispigz == 0){
$compress="pigz";
}
$callback->({info=>["compress method: $compress"]});
if ($exlistloc) {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
if ( $includestr) {
system("$includestr >> $xcat_packimg_tmpfile");
}
$excludestr = "cat $xcat_packimg_tmpfile |cpio -H newc -o | gzip -c - > ../rootimg-statelite.gz";
$excludestr = "cat $xcat_packimg_tmpfile |cpio -H newc -o | $compress -c - > ../rootimg-statelite.gz";
} else {
$excludestr = "find . |cpio -H newc -o | gzip -c - > ../rootimg-statelite.gz";
$excludestr = "find . |cpio -H newc -o | $compress -c - > ../rootimg-statelite.gz";
}
$oldmask = umask 0077;
chdir("$rootimg_dir");