2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Only pass "--compress" argument to dracut when ($dracutver > "033")

This commit is contained in:
GONG Jie 2019-04-16 14:41:08 +08:00
parent 6157c035b4
commit 428483035f

View File

@ -1150,15 +1150,15 @@ sub mkinitrd_dracut {
# force the dracut run in non-hostonly mode for dracut higher than version 033
if ($dracutver > "033") {
$additional_options .= " -N";
}
#if "pigz" is available in the rootimg, use "pigz" instead of "gzip"
my $compress = qx(chroot $rootimg_dir bash -c "type -p pigz"|tr -d "\n");
if ($compress) {
#if "pigz" is available in the rootimg, use "pigz" instead of "gzip"
my $compress = qx(chroot $rootimg_dir bash -c "type -p pigz"|tr -d "\n");
if ($compress) {
#take the online cpu numerber as the pigz processes number
my $processnum = qx(lscpu -p=cpu --online|grep -v '#'|wc -l|tr -d "\n");
$additional_options .= " --compress \"$compress -p $processnum \"";
#take the online cpu numerber as the pigz processes number
my $processnum = qx(lscpu -p=cpu --online|grep -v '#'|wc -l|tr -d "\n");
$additional_options .= " --compress \"$compress -p $processnum \"";
}
}
print "\nchroot $rootimg_dir dracut $additional_options -f /tmp/initrd.$$.gz $kernelver\n";