1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
package Modules::ModulesConf;
# $Id: ModulesConf.pm,v 1.4 2003/01/19 23:26:20 sdague Exp $
# Copyright (c) 2001 International Business Machines
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Sean Dague <sean@dague.net>
=head1 NAME
Modules::ModulesConf - setup for modules.conf
=head1 SYNOPSIS
my $modulesconf = new Modules::ModulesConf(%vars);
if ($modulesconf->footprint()) {
$modulesconf->setup();
}
my @fileschanged = $modulesconf->files();
=head1 DESCRIPTION
=cut
use strict;
use Carp;
use base qw(Modules::Generic);
use vars qw($VERSION);
$VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
push @Hardware::conftypes, qw(Modules::ModulesConf);
sub new {
my $class = shift;
my %vars = @_;
my %this = (
_root => $vars{root},
_postcommand => "",
_otherfiles => [],
_filesmod => [],
_modulesfile => "/etc/modules.conf",
);
bless \%this, $class;
}
=head1 METHODS
The following methods exist in this module:
=over 4
=item footprint()
This method returns 1 if B</etc/modules.conf> is being used on the machine.
The test succeeds and returns 1 in two cases:
Case 1: /etc/modules.conf exists B<and> /etc/modutils/aliases does not exist.
Case 2: /etc/conf.modules B<and> /etc/modutils/aliases both do not exist.
Otherwise, this method will return undef.
=cut
sub footprint {
my $this = shift;
my $file = $this->chroot("/etc/modules.conf");
my $nofile = $this->chroot("/etc/modutils/aliases");
my $antifile = $this->chroot("/etc/conf.modules");
if((-e $file) && (!-e $nofile)) {
return 1;
}
if((!-e $antifile) && (!-e $nofile)) {
return 1;
}
return undef;
}
=back
=head1 AUTHOR
Sean Dague <sean@dague.net>
Joe Greenseid <jgreenseid@users.sourceforge.net>
=head1 SEE ALSO
L<Hardware>, L<Util::FileMod>, L<perl>
=cut
1;
|