sub import {
hook(type => "getsetup", id => "rsync", call => \&getsetup);
- hook(type => "postrefresh", id => "rsync", call => \&postrefresh);
+ hook(type => "change", id => "rsync", call => \&postrefresh);
+ hook(type => "delete", id => "rsync", call => \&postrefresh);
}
sub getsetup () {
},
}
+my $ran=0;
+
sub postrefresh () {
- if (defined $config{rsync_command}) {
+ if (defined $config{rsync_command} && ! $ran) {
+ $ran=1;
chdir($config{destdir}) || error("chdir: $!");
system $config{rsync_command};
if ($? == -1) {
if (%rendered) {
run_hooks(change => sub { shift->(keys %rendered) });
}
- run_hooks(postrefresh => sub { shift->() });
}
sub commandline_render () {