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

using --nosyncfiles to bypass syncing files to root image directory (#5229)

This commit is contained in:
Bin Xu
2018-05-22 12:47:37 +08:00
committed by yangsong
parent 7b01d4ed03
commit 7a69c9b779
3 changed files with 31 additions and 10 deletions

View File

@ -23,7 +23,7 @@ SYNOPSIS
\ **packimage [-v| -**\ **-version]**\
\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] \ *imagename*\
\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] [\ **--nosyncfiles**\ ] \ *imagename*\
***********
@ -57,6 +57,8 @@ OPTIONS
\ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip)
\ **--nosyncfiles**\ Bypass of syncfiles requested, will not sync files to root image directory
************
RETURN VALUE
@ -89,6 +91,14 @@ EXAMPLES
packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute
3. To pack the osimage 'rhels7.1-x86_64-netboot-compute' without syncing files:
.. code-block:: perl
packimage --nosyncfiles rhels7.1-x86_64-netboot-compute
*****
FILES

View File

@ -8,7 +8,7 @@ B<packimage [-h| --help]>
B<packimage [-v| --version]>
B<packimage> [B<-m>|B<--method> I<cpio|tar>] [B<-c>|B<--compress> I<gzip|pigz|xz>] I<imagename>
B<packimage> [B<-m>|B<--method> I<cpio|tar>] [B<-c>|B<--compress> I<gzip|pigz|xz>] [B<--nosyncfiles>] I<imagename>
=head1 DESCRIPTION
@ -31,6 +31,8 @@ B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio)
B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip)
B<--nosyncfiles> Bypass of syncfiles requested, will not sync files to root image directory
=head1 RETURN VALUE
@ -48,6 +50,10 @@ B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip)
packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute
3. To pack the osimage 'rhels7.1-x86_64-netboot-compute' without syncing files:
packimage --nosyncfiles rhels7.1-x86_64-netboot-compute
=head1 FILES
/opt/xcat/sbin/packimage

View File

@ -82,7 +82,7 @@ sub process_request {
@ARGV = @{$args};
}
if (scalar(@ARGV) == 0) {
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] [--nosyncfiles] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
return 0;
}
@ -95,6 +95,7 @@ sub process_request {
my $syncfile;
my $rootimg_dir;
my $destdir;
my $nosyncfiles;
my $imagename;
my $dotorrent;
my $provmethod;
@ -109,6 +110,7 @@ sub process_request {
"method|m=s" => \$method,
"compress|c=s" => \$compress,
"tracker=s" => \$dotorrent,
'nosyncfiles' => \$nosyncfiles,
"help|h" => \$help,
"version|v" => \$version
);
@ -122,7 +124,7 @@ sub process_request {
return 0;
}
if ($help) {
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
$callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] [--nosyncfiles] <imagename>\n packimage [-h| --help]\n packimage [-v| --version]"] });
return 0;
}
@ -412,12 +414,15 @@ sub process_request {
close($shadow);
umask($oldmask);
# sync fils configured in the synclist to the rootimage
$syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename);
if (defined($syncfile) && -f $syncfile
&& -d $rootimg_dir) {
print "sync files from $syncfile to the $rootimg_dir\n";
system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile");
if (not $nosyncfiles) {
# sync fils configured in the synclist to the rootimage
$syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename);
if ( defined($syncfile) && -f $syncfile && -d $rootimg_dir) {
print "Syncing files from $syncfile to root image dir: $rootimg_dir\n";
system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile");
}
} else {
print "Bypass of syncfiles requested, will not sync files to root image directory.\n";
}
my $temppath;