File-Copy-Undoable
view release on metacpan or search on metacpan
0.04 2013-09-09 Released-By: SHARYANTO
- No functional changes. Fix wrong argument type --rsync_opts in t/cp.t
[CT].
0.03 2012-09-06 Released-By: SHARYANTO
- Don't chown (and fail miserably) if we're not running as root (this is
like rsync's -a behavior).
0.02 2012-09-05 Released-By: SHARYANTO
[ENHANCEMENTS]
- Add 'target_owner' and 'target_group' argument.
lib/File/Copy/Undoable.pm view on Meta::CPAN
} elsif ($tx_action eq 'fix_state') {
my @cmd = ("rsync", @$rsync_opts, "$source/", "$target/");
log_info("Rsync-ing $source -> $target ...");
system @cmd;
return [500, "Can't rsync: ".explain_child_error($?)] if $?;
if (defined($args{target_owner}) || defined($args{target_group})) {
if ($> == 0) {
log_info("Chown-ing $target ...");
@cmd = (
"chown", "-Rh",
join("", $args{target_owner}//"", ":",
$args{target_group}//""),
$target);
system @cmd;
return [500, "Can't chown: ".explain_child_error($?)] if $?;
} else {
log_debug("Not running as root, not doing chown");
}
}
return [200, "OK"];
}
[400, "Invalid -tx_action"];
}
1;
# ABSTRACT: Copy file/directory using rsync, with undo support
( run in 1.805 second using v1.01-cache-2.11-cpan-71847e10f99 )