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

fix issue [DEV] it is ambiguous to determine which compressed rootimg to use among rootimg.tar.gz,rootimg.cpio.gz,rootimg.tar.xz... #1695; update the manpage and usage info of packimage

This commit is contained in:
immarvin
2016-08-13 02:53:05 -04:00
parent 5699b025dd
commit be77e5f43f
3 changed files with 26 additions and 9 deletions

View File

@ -23,7 +23,7 @@ SYNOPSIS
\ **packimage [-v| -**\ **-version]**\
\ **packimage**\ \ *imagename*\
\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] \ *imagename*\
***********
@ -62,9 +62,9 @@ OPTIONS
\ **-a**\ Architecture (ppc64,x86_64,etc)
\ **-m**\ Archive Method (cpio,tar,squashfs, default is cpio)
\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is cpio)
\ **-c**\ Compress Method (pigz,gzip,xz, default is pigz)
\ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip)
************
@ -90,6 +90,14 @@ EXAMPLES
packimage rhels7.1-x86_64-netboot-compute
2. To pack the osimage rhels7.1-x86_64-netboot-compute with "tar" to archive and "pigz" to compress:
.. code-block:: perl
packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute
*****
FILES

View File

@ -8,7 +8,7 @@ B<packimage [-h| --help]>
B<packimage [-v| --version]>
B<packimage> I<imagename>
B<packimage> [B<-m>|B<--method> I<cpio|tar>] [B<-c>|B<--compress> I<gzip|pigz|xz>] I<imagename>
=head1 DESCRIPTION
@ -36,9 +36,9 @@ B<-p> Profile (compute,service)
B<-a> Architecture (ppc64,x86_64,etc)
B<-m> Archive Method (cpio,tar,squashfs, default is cpio)
B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio)
B<-c> Compress Method (pigz,gzip,xz, default is pigz)
B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip)
=head1 RETURN VALUE
@ -53,6 +53,9 @@ B<-c> Compress Method (pigz,gzip,xz, default is pigz)
packimage rhels7.1-x86_64-netboot-compute
2. To pack the osimage rhels7.1-x86_64-netboot-compute with "tar" to archive and "pigz" to compress:
packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute
=head1 FILES

View File

@ -79,7 +79,7 @@ sub process_request {
@ARGV = @{$args};
}
if (scalar(@ARGV) == 0) {
$callback->({ info => ["Usage:\n packimage <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
return 0;
}
@ -114,7 +114,7 @@ sub process_request {
return 0;
}
if ($help) {
$callback->({ info => ["Usage:\n packimage <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
return 0;
}
@ -468,8 +468,12 @@ sub process_request {
}
$suffix = $method.".".$suffix;
unlink("$destdir/rootimg.$suffix");
unlink("$destdir/rootimg.sfs");
unlink("$destdir/rootimg.cpio.xz");
unlink("$destdir/rootimg.cpio.gz");
unlink("$destdir/rootimg.tar.xz");
unlink("$destdir/rootimg.tar.gz");
if ($method =~ /cpio/) {
if (!$exlistloc) {
$excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix";
@ -507,6 +511,7 @@ sub process_request {
$callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] });
return 1;
}
chdir("$rootimg_dir");
my $outputmsg = `$excludestr 2>&1`;
unless($?){
@ -517,6 +522,7 @@ sub process_request {
system("rm -rf $xcat_packimg_tmpfile");
return 1;
}
if ($method =~ /cpio/) {
chmod 0644, "$destdir/rootimg.$suffix";
if ($dotorrent) {