diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index b94294c07..4c0d2e609 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -839,6 +839,7 @@ sub fork_fanout_dcp $rcp_config{'preserve'} = $$options{'preserve'}; $rcp_config{'recursive'} = $$options{'recursive'}; + $rcp_config{'sudo'} = $$options{'sudo'}; if ($$options{'pull'}) { @@ -4598,8 +4599,8 @@ sub parse_and_run_dcp close FILE; # now put the original syncfile on the queue to sync to the SN's $rc = - &parse_rsync_input_file_on_MN(\@nodelist, \%options, $tmpsyncfile, - $::SYNCSN, $synfiledir,$nodesyncfiledir); + &parse_rsync_input_file_on_MN(\@nodelist, \%options,$tmpsyncfile, + $::SYNCSN, $synfiledir,$nodesyncfiledir); # cleanup my $cmd = "rm $tmpsyncfile"; my @output = xCAT::Utils->runcmd($cmd, 0); diff --git a/perl-xCAT/xCAT/RSYNC.pm b/perl-xCAT/xCAT/RSYNC.pm index 4039a434b..b3779c03e 100644 --- a/perl-xCAT/xCAT/RSYNC.pm +++ b/perl-xCAT/xCAT/RSYNC.pm @@ -98,13 +98,21 @@ sub remote_copy_command { if (-e ("/usr/bin/rsync")) { if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local + if ($$config{'sudo'}){ + $sync_opt = '--rsync-path=sudo /usr/bin/rsync '; + } else { $sync_opt = '--rsync-path /usr/bin/rsync '; + } } else { $sync_opt = '--rsh /bin/rsh --rsync-path /usr/bin/rsync '; } } else { if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local - $sync_opt = '--rsync-path /usr/local/bin/rsync '; + if ($$config{'sudo'}){ + $sync_opt = '--rsync-path=sudo /usr/local/bin/rsync '; + } else { + $sync_opt = '--rsync-path=/usr/local/bin/rsync '; + } } else { $sync_opt = '--rsh /bin/rsh --rsync-path /usr/local/bin/rsync '; } @@ -112,7 +120,11 @@ sub remote_copy_command } else #linux { + if ($$config{'sudo'}) { + $sync_opt = '--rsync-path=\'sudo /usr/bin/rsync\' '; + } else { $sync_opt = '--rsync-path /usr/bin/rsync '; + } } # if only syncing the service node or # (no postscripts and no append lines) then do not