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 |
|
---|
10 | package MondoRescue::Inventory;
|
---|
11 |
|
---|
12 | use strict 'vars';
|
---|
13 | use Data::Dumper;
|
---|
14 | use English;
|
---|
15 | use File::Basename;
|
---|
16 | use File::Copy;
|
---|
17 | use POSIX qw(strftime);
|
---|
18 | use lib qw (lib);
|
---|
19 | use ProjectBuilder::Base;
|
---|
20 | use ProjectBuilder::Conf;
|
---|
21 |
|
---|
22 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
23 |
|
---|
24 | use Exporter;
|
---|
25 |
|
---|
26 | # Export, by default, all the functions into the namespace of
|
---|
27 | # any code which uses this module.
|
---|
28 |
|
---|
29 | our @ISA = qw(Exporter);
|
---|
30 | our @EXPORT = qw(mr_exit);
|
---|
31 |
|
---|
32 | =pod
|
---|
33 |
|
---|
34 | =head1 NAME
|
---|
35 |
|
---|
36 | MondoRescue::Inventory, part of the mondorescue.org
|
---|
37 |
|
---|
38 | =head1 DESCRIPTION
|
---|
39 |
|
---|
40 | This modules provides inventory functions for the Mondorescue project in order to report
|
---|
41 | the precise context of the system to be archived (Hardware, Firmware and Software as much as possible)
|
---|
42 | This module aims to be OS independent
|
---|
43 |
|
---|
44 | =head1 USAGE
|
---|
45 |
|
---|
46 | =over 4
|
---|
47 |
|
---|
48 | =item B<mr_inv_hw>
|
---|
49 |
|
---|
50 | This function reports Hardware inventory of the system to archive
|
---|
51 |
|
---|
52 | =cut
|
---|
53 |
|
---|
54 | sub 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 |
|
---|
68 | sub mr_inv_hw_context {
|
---|
69 |
|
---|
70 | my %pb;
|
---|
71 | my ($ddir, $dver, $dfam);
|
---|
72 | my $cmdline = "/dev/null";
|
---|
73 | ($ddir, $dver, $dfam, $pb{'dtype'}, $pb{'suf'}, $pb{'upd'}, $pb{'arch'}) = pb_distro_init();
|
---|
74 | pb_log(2,"DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $pb{'dtype'}, $pb{'suf'})."\n");
|
---|
75 |
|
---|
76 | if (($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 | }
|
---|
81 | return(pb_get_content($cmdline));
|
---|
82 | }
|
---|
83 |
|
---|
84 | =item B<mr_inv_fw>
|
---|
85 |
|
---|
86 | This function reports Firmware inventory of the system to archive
|
---|
87 |
|
---|
88 | =cut
|
---|
89 |
|
---|
90 | sub mr_inv_fw {
|
---|
91 |
|
---|
92 | # Linked to bkphw
|
---|
93 | # On Proliant use hpacucli, conrep, hponcfg
|
---|
94 | }
|
---|
95 |
|
---|
96 | =item B<mr_inv_sw>
|
---|
97 |
|
---|
98 | This function reports Software inventory of the system to archive
|
---|
99 |
|
---|
100 | =cut
|
---|
101 |
|
---|
102 | sub mr_inv_sw {
|
---|
103 |
|
---|
104 | # Commands presence - use FindBin
|
---|
105 | # deplist
|
---|
106 | # mountlist
|
---|
107 | }
|
---|