1 |
pterjan |
552 |
# $Id: Gendistrib.pm 115367 2007-01-30 09:47:04Z pixel $ |
2 |
|
|
package Youri::Submit::Post::Mirror; |
3 |
|
|
|
4 |
|
|
=head1 NAME |
5 |
|
|
|
6 |
|
|
Youri::Submit::Post::Mirror - synchronizes repository to mirror |
7 |
|
|
|
8 |
|
|
=head1 DESCRIPTION |
9 |
|
|
|
10 |
|
|
Calls genhdlist2 |
11 |
|
|
|
12 |
|
|
=cut |
13 |
|
|
|
14 |
|
|
use warnings; |
15 |
|
|
use strict; |
16 |
|
|
use Carp; |
17 |
|
|
use base qw/Youri::Submit::Post/; |
18 |
|
|
|
19 |
|
|
sub _init { |
20 |
|
|
my $self = shift; |
21 |
|
|
my %options = ( |
22 |
|
|
destination => '', |
23 |
|
|
@_ |
24 |
|
|
); |
25 |
|
|
|
26 |
|
|
foreach my $var ('destination') { |
27 |
|
|
$self->{"_$var"} = $options{$var}; |
28 |
|
|
} |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
sub run { |
32 |
|
|
my ($self, $repository, $target, $define) = @_; |
33 |
|
|
croak "Not a class method" unless ref $self; |
34 |
|
|
my $root = $repository->get_install_root(); |
35 |
|
|
|
36 |
|
|
croak "Missing destination" unless $self->{'_destination'}; |
37 |
|
|
|
38 |
|
|
|
39 |
pterjan |
2907 |
if (system("/usr/bin/rsync -alH --delete --delete-after $root/$target/ $self->{_destination}/$target/")) { |
40 |
pterjan |
552 |
$self->{_error} = "Rsync command failed ($!)"; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
return; |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
=head1 COPYRIGHT AND LICENSE |
47 |
|
|
|
48 |
|
|
Copyright (C) 2010, Mageia |
49 |
|
|
|
50 |
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
51 |
|
|
|
52 |
|
|
=cut |
53 |
|
|
|
54 |
|
|
1; |
55 |
|
|
|