From 35e8b2be1d285b3e12fcfc2670463f75edd199ff Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 18 May 2009 18:15:47 +0000 Subject: [PATCH] update for -s support more todo git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3400 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DSHCLI.pm | 24 ++++++++++++++++++++---- xCAT-client/bin/xdsh | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index b38d342da..2262019a3 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -4136,11 +4136,18 @@ sub parse_and_run_dcp # /....file* /...../sample* -> /..../directory # my @results; + my $syncSN = 0; + if ($options{'rsyncSN'}) + { + $syncSN = 1; + } if ($options{'File'}) { @results = - &parse_rsync_input_file(\@nodelist, \%options, $options{'File'}); + &parse_rsync_input_file(\@nodelist, \%options, + $options{'File'}, $syncSN); + # rdist not supported #@results = &parse_rdist_input_file(\%options, $options{'File'}); } else # source and destination files are from command line @@ -4232,7 +4239,7 @@ sub parse_and_run_dcp sub parse_rsync_input_file { use File::Basename; - my ($nodes, $options, $input_file) = @_; + my ($nodes, $options, $input_file, $rsyncSN) = @_; my @dest_host = @$nodes; open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n"; while (my $line = ) @@ -4258,13 +4265,22 @@ sub parse_rsync_input_file foreach my $target_node (@dest_host) { - $$options{'destDir_srcFile'}{$target_node} ||= {}; - $$options{'destDir_srcFile'}{$target_node}{$dest_dir} ||= {}; + $$options{'destDir_srcFile'}{$target_node} ||= {}; # for each file on the line foreach my $srcfile (@srcfiles) { + # if syncing the Service Node, file goes to the same place + # from which it came + if ($rsyncSN == 1) + { # syncing the SN + $dest_dir = dirname($srcfile); + $dest_dir =~ s/\s*//g; #remove blanks + } + $$options{'destDir_srcFile'}{$target_node}{$dest_dir} ||= + {}; + # can be full file name for destination or just the # directory name my $src_basename = basename($srcfile); # get file name diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 78f3a133c..4e703f2fb 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -417,7 +417,7 @@ sub parse_args_xdcp 'q|show-config' => \$options{'show-config'}, 'p|preserve' => \$options{'preserve'}, 'r|c|node-rcp=s' => \$options{'node-rcp'}, - 's' => \$options{'rsync'}, + 's' => \$options{'rsyncSN'}, 't|timeout=i' => \$options{'timeout'}, 'v|verify' => \$options{'verify'}, 'B|bypass' => \$options{'bypass'},