forward cron mail to sysadmin@fsf.org
[mharc.git] / bin / mhonarc-check
1 #!/usr/bin/perl
2 ##---------------------------------------------------------------------------##
3 ## File:
4 ## $Id: mhonarc-check,v 1.6 2002/09/15 05:05:54 ehood Exp $
5 ## Description:
6 ## Checks if mhonarc can be loaded.
7 ##---------------------------------------------------------------------------##
8 ## Copyright (C) 2002 Earl Hood <earl@earlhood.com>
9 ##
10 ## This program is free software; you can redistribute it and/or modify
11 ## it under the terms of the GNU General Public License as published by
12 ## the Free Software Foundation; either version 2 of the License, or
13 ## (at your option) any later version.
14 ##
15 ## This program is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ## GNU General Public License for more details.
19 ##
20 ## You should have received a copy of the GNU General Public License
21 ## along with this program; if not, write to the Free Software
22 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 ## 02111-1307, USA
24 ##---------------------------------------------------------------------------##
25
26 package MHArc::mhonarc_check;
27
28 ##--------------------------------------------------------------------------##
29 # <x-boot-strap>
30 BEGIN { die qq/CGI use FORBIDDEN!\n/ if (defined($ENV{'GATEWAY_INTERFACE'})); }
31 my $Dir; BEGIN { $Dir = `dirname $0`; chomp $Dir; }
32 use lib "$Dir/../lib"; # Add relative lib to search path
33 # </x-boot-strap>
34 ##--------------------------------------------------------------------------##
35 # <x-config>
36 use MHArc::Config;
37 my $config = MHArc::Config->load("$Dir/../lib/config.sh");
38 # </x-config>
39 ##--------------------------------------------------------------------------##
40
41
42 eval {
43 require 'mhamain.pl';
44 print "You are using MHonArc v$mhonarc::VERSION\n";
45 };
46 if ($@) {
47 print qq/Unable to load MHonArc: $@\n/;
48 print <<'EOT';
49 * If MHonArc is installed, you may need to set the MHONARC_LIB
50 * variable in lib/config.sh to the directory pathname location
51 * of MHonArc's library files.
52 * @INC setting:
53 EOT
54 foreach (@INC) {
55 print qq/\t$_\n/;
56 }
57 exit 1;
58
59 } else {
60 exit 0;
61 }
62
63 ##--------------------------------------------------------------------------##
64 __END__
65
66 =head1 NAME
67
68 mhonarc-check - Checks that mharc scripts will be able to load MHonArc
69
70 =head1 SYNOPSIS
71
72 mhonarc-check
73
74 =head1 DESCRIPTION
75
76 This program does a simple check to see that an installation of mharc
77 can load the MHonArc libraries. If the check fails, the program
78 returns a non-zero exit status and prints out what can be done to
79 fix the problem.
80
81 =head1 VERSION
82
83 C<$Id: mhonarc-check,v 1.6 2002/09/15 05:05:54 ehood Exp $>
84
85 =head1 AUTHOR
86
87 Earl Hood, earl@earlhood.com
88
89 This program is part of the mharc archiving system and comes with
90 ABSOLUTELY NO WARRANTY and may be copied only under the terms of
91 the GNU General Public License, which may be found in the mhArc
92 distribution.
93
94 =cut
95