source: devel/mr/lib/MondoRescue/Base.pm @ 2538

Last change on this file since 2538 was 2538, checked in by bruno, 9 years ago

r3572@localhost: bruno | 2010-01-07 23:38:36 +0100
Reorg of files begining to start working on LVM low level fundtions and scripts

File size: 1.4 KB
Line 
1#!/usr/bin/perl -w
2#
3# Base subroutines brought by the MondoRescue project
4#
5# $Id$
6#
7# Copyright B. Cornec 2008
8# Provided under the GPL v2
9
10package MondoRescue::Base;
11
12use strict 'vars';
13use Data::Dumper;
14use English;
15use File::Basename;
16use File::Copy;
17use POSIX qw(strftime);
18use lib qw (lib);
19use ProjectBuilder::Base;
20use ProjectBuilder::Conf;
21
22# Inherit from the "Exporter" module which handles exporting functions.
23
24use Exporter;
25
26# Export, by default, all the functions into the namespace of
27# any code which uses this module.
28
29our @ISA = qw(Exporter);
30our @EXPORT = qw(mr_init mr_exit);
31
32=pod
33
34=head1 NAME
35
36MondoRescue::Base, part of the mondorescue.org
37
38=head1 DESCRIPTION
39
40This modules provides low level and generic functions for the Mondorescue project
41
42=head1 USAGE
43
44=over 4
45
46=item B<mr_init>
47
48This function initialize MondoRescue, point to the right conf files, setup stuff
49It takes 1 parameter, the message to print if needed
50
51=cut
52
53sub mr_exit {
54
55my $msg = shift || "";
56
57if (defined $msg) {
58    pb_log($pbdebug,$msg);
59}
60
61pb_conf_init();
62}
63=item B<mr_exit>
64
65This function closes opened files, clean up the environment and exits MondoRescue
66It takes 2 parameters, the exit code, and the message to print if needed
67
68=cut
69
70sub mr_exit {
71
72my $code = shift;
73my $msg = shift || "";
74
75if (defined $msg) {
76    pb_log($pbdebug,$msg);
77}
78die "ERROR returned\n" if ($code < 0);
79exit($code);
80}
Note: See TracBrowser for help on using the repository browser.