2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

refine the tar options

This commit is contained in:
immarvin 2016-08-12 21:11:48 -04:00
parent 3047917dce
commit e1775355f5

View File

@ -484,14 +484,14 @@ sub process_request {
$oldmask = umask 0077;
} elsif ($method =~ /tar/) {
if (!$exlistloc) {
$excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.$suffix";
$excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix";
} else {
chdir("$rootimg_dir");
system("$excludestr >> $xcat_packimg_tmpfile");
if ($includestr) {
system("$includestr >> $xcat_packimg_tmpfile");
}
$excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.$suffix";
$excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix";
}
$oldmask = umask 0077;
} elsif ($method =~ /squashfs/) {
@ -508,8 +508,15 @@ sub process_request {
return 1;
}
chdir("$rootimg_dir");
my $outputmsg = `$excludestr`;
$callback->({ info => ["$outputmsg"] });
my $outputmsg = `$excludestr 2>&1`;
unless($?){
$callback->({ info => ["$outputmsg"] });
}else{
$callback->({ info => ["$outputmsg"] });
$callback->({ error => ["packimage failed while running: \n $excludestr"], errorcode => [1] });
system("rm -rf $xcat_packimg_tmpfile");
return 1;
}
if ($method =~ /cpio/) {
chmod 0644, "$destdir/rootimg.$suffix";
if ($dotorrent) {