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

Last change on this file since 2538 was 2468, checked in by Bruno Cornec, 14 years ago

Inventory precisions added

File size: 2.1 KB
Line 
1#!/usr/bin/perl -w
2#
3# Subroutines brought by the MondoRescue project to do HW/FW/SW inventory
4#
5# $Id$
6#
7# Copyright B. Cornec 2008
8# Provided under the GPL v2
9
10package MondoRescue::Inventory;
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_exit);
31
32=pod
33
34=head1 NAME
35
36MondoRescue::Inventory, part of the mondorescue.org
37
38=head1 DESCRIPTION
39
40This modules provides inventory functions for the Mondorescue project in order to report
41the precise context of the system to be archived (Hardware, Firmware and Software as much as possible)
42This module aims to be OS independent
43
44=head1 USAGE
45
46=over 4
47
48=item B<mr_inv_hw>
49
50This function reports Hardware inventory of the system to archive
51
52=cut
53
54sub mr_inv_hw {
55
56 # Keyboard
57 # Raid SW - DM
58 # Partitions
59 # FS/swaps
60 # LVM / ...
61 # PCI / USB / lssd / ...
62 # messages/dmesg
63 # Kernel / Initrd
64 # Kernel Modules
65 # cmdline
66}
67
68sub mr_inv_hw_context {
69
70my %pb;
71my ($ddir, $dver, $dfam);
72my $cmdline = "/dev/null";
73($ddir, $dver, $dfam, $pb{'dtype'}, $pb{'suf'}, $pb{'upd'}, $pb{'arch'}) = pb_distro_init();
74pb_log(2,"DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $pb{'dtype'}, $pb{'suf'})."\n");
75
76if (($pb{{'dtype'} eq "rpm") || ($pb{{'dtype'} eq "deb") || ($pb{{'dtype'} eq "ebuild") || ($pb{{'dtype'} eq "tgz")) {
77 cmdline = "/proc/cmdline";
78} elsif ($pb{{'dtype'} eq "pkg") {
79 cmdline = "/proc/cmdline";
80}
81return(pb_get_content($cmdline));
82}
83
84=item B<mr_inv_fw>
85
86This function reports Firmware inventory of the system to archive
87
88=cut
89
90sub mr_inv_fw {
91
92 # Linked to bkphw
93 # On Proliant use hpacucli, conrep, hponcfg
94}
95
96=item B<mr_inv_sw>
97
98This function reports Software inventory of the system to archive
99
100=cut
101
102sub mr_inv_sw {
103
104 # Commands presence - use FindBin
105 # deplist
106 # mountlist
107}
Note: See TracBrowser for help on using the repository browser.