New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fcm-backup-trac-env in vendors/FCM-2017.10.0/sbin – NEMO

source: vendors/FCM-2017.10.0/sbin/fcm-backup-trac-env @ 13905

Last change on this file since 13905 was 10672, checked in by nicolasmartin, 5 years ago

Reimport latest FCM release

File size: 2.8 KB
Line 
1#!/usr/bin/perl
2#-------------------------------------------------------------------------------
3# (C) British Crown Copyright 2006-17 Met Office.
4#
5# This file is part of FCM, tools for managing and building source code.
6#
7# FCM is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# FCM is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with FCM. If not, see <http://www.gnu.org/licenses/>.
19#-------------------------------------------------------------------------------
20
21use strict;
22use warnings;
23
24use FindBin;
25use lib "$FindBin::Bin/../lib";
26use FCM::Admin::System qw{
27    backup_trac_environment
28    backup_trac_files
29    filter_projects
30    get_projects_from_trac_live
31};
32use FCM::Admin::Util qw{option2config};
33use Getopt::Long qw{GetOptions};
34use Pod::Usage qw{pod2usage};
35
36main();
37
38sub main {
39    my %option;
40    my $result = GetOptions(
41        \%option,
42        q{help|usage|h},
43        q{no-verify-integrity},
44        q{trac-backup-dir=s},
45        q{trac-live-dir=s},
46    );
47    if (!$result) {
48        pod2usage(1);
49    }
50    if (exists($option{help})) {
51        pod2usage(q{-verbose} => 1);
52    }
53    option2config(\%option);
54    my @projects = filter_projects([get_projects_from_trac_live()], \@ARGV);
55    for my $project (@projects) {
56        backup_trac_environment(\%option, $project);
57    }
58    if (!@ARGV) {
59        backup_trac_files();
60    }
61}
62
63__END__
64
65=head1 NAME
66
67fcm-backup-trac-env
68
69=head1 SYNOPSIS
70
71    fcm-backup-trac-env [OPTIONS] [PROJECT ...]
72
73=head1 OPTIONS
74
75=over 4
76
77=item --help, -h, --usage
78
79Prints help and exits.
80
81=item --no-verify-integrity
82
83If this option is specified, the program will not verify the integrity of the
84database before running the backup.
85
86=item --trac-backup-dir=DIR
87
88Specifies the root location of the backup directory. See
89L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
90
91=item --trac-live-dir=DIR
92
93Specifies the root location of the live directory. See
94L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
95
96=back
97
98=head1 ARGUMENTS
99
100=over 4
101
102=item PROJECT
103
104Specifies one or more project to back up. If no project is specified, the
105program searches the live directory for projects and other files to back up.
106
107=back
108
109=head1 DESCRIPTION
110
111This program archives Trac environments, and other files in the live directory
112to the backup directory.
113
114=head1 COPYRIGHT
115
116E<169> Crown copyright Met Office. All rights reserved.
117
118=cut
Note: See TracBrowser for help on using the repository browser.