source: LMDZ6/branches/Amaury_dev/tools/fcm/sbin/fcm-recover-trac-env @ 5095

Last change on this file since 5095 was 5095, checked in by abarral, 2 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/usr/bin/perl
2#-------------------------------------------------------------------------------
3# Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
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    filter_projects
28    get_projects_from_trac_backup
29    recover_trac_environment
30    recover_trac_files
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{trac-backup-dir=s},
44        q{trac-live-dir=s},
45    );
46    if (!$result) {
47        pod2usage(1);
48    }
49    if (exists($option{help})) {
50        pod2usage(q{-verbose} => 1);
51    }
52    option2config(\%option);
53    my @projects = filter_projects([get_projects_from_trac_backup()], \@ARGV);
54    for my $project (@projects) {
55        recover_trac_environment($project);
56    }
57    if (!@ARGV) {
58        recover_trac_files();
59    }
60}
61
62__END__
63
64=head1 NAME
65
66fcm-recover-trac-env
67
68=head1 SYNOPSIS
69
70    fcm-recover-trac-env [OPTIONS] [PROJECT ...]
71
72=head1 OPTIONS
73
74=over 4
75
76=item --help, -h, --usage
77
78Prints help and exits.
79
80=item --trac-backup-dir=DIR
81
82Specifies the root location of the backup directory. See
83L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
84
85=item --trac-live-dir=DIR
86
87Specifies the root location of the live directory. See
88L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
89
90=back
91
92=head1 ARGUMENTS
93
94=over 4
95
96=item PROJECT
97
98Specifies one or more project to recover. If no project is specified, the
99program searches the backup directory for projects and files to recover.
100
101=back
102
103=head1 DESCRIPTION
104
105This program recovers Trac environments and files from the backup directory to
106the live directory.
107
108=head1 COPYRIGHT
109
110Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
111
112=cut
Note: See TracBrowser for help on using the repository browser.