Changeset 2667 for devel


Ignore:
Timestamp:
Jun 27, 2010, 3:27:16 PM (9 years ago)
Author:
bruno
Message:

r3936@dhcp184-49-175-19: bruno | 2010-06-26 09:48:04 +0200

  • Inventory now in better shape. Needs useful and exhaustive content now.
Location:
devel
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • devel/mr/etc/mondorescue.conf

    r2659 r2667  
    1616
    1717#
    18 # Location of the fstab file
     18# Location of some configuration files
     19#
     20# depends on genre
     21mr_cmdline linux = /proc/cmdline
     22mr_cmdline bsd = /tmp/cmdline
     23# TBC
     24mr_cmdline solaris = /proc/cmdline
    1925#
    2026mr_fstab default = /etc/fstab
     27mr_raidtab linux = /etc/raidtab
     28mr_swap linux = /proc/swaps
     29mr_partitions linux = /proc/partitions
     30mr_filesystems linux = /proc/filesystems
     31mr_modules linux = /proc/modules
     32mr_xen linux = /proc/sys/xen
     33
     34# Location of some commands
     35#
     36mr_mount linux = /bin/mount
     37mr_df linux = /bin/df
     38mr_lsmod linux = /sbin/lsmod
    2139
    2240#
  • devel/mr/lib/MondoRescue/Base.pm

    r2666 r2667  
    117117=item B<mr_conf_get>
    118118
    119 This function get parameters in configuration files and returns from the least significant level (default) to the emost significant level (application name), passing by the project name.
     119This function get parameters in configuration files and returns from the least significant level (default) to the most significant level (application name), passing by the project name.
    120120It takes a list of parameters to find and returns the values corresponding
    121121
  • devel/mr/lib/MondoRescue/Inventory.pm

    r2468 r2667  
    1919use ProjectBuilder::Base;
    2020use ProjectBuilder::Conf;
     21use ProjectBuilder::Distribution;
     22use MondoRescue::LVM;
     23use MondoRescue::Kernel;
    2124
    2225# Inherit from the "Exporter" module which handles exporting functions.
     
    2831
    2932our @ISA = qw(Exporter);
    30 our @EXPORT = qw(mr_exit);
     33our @EXPORT = qw(mr_inv_os $mr_os);
     34
     35# Globals
     36our %mr_hw;
     37our $mr_hw = \%mr_hw;
     38our %mr_os;
     39our $mr_os = \%mr_hw;
    3140
    3241=pod
     
    6675}
    6776
    68 sub mr_inv_hw_context {
     77sub mr_inv_os {
    6978
    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");
     79($mr_os->{'name'}, $mr_os->{'version'}, $mr_os->{'family'}, $mr_os->{'type'}, $mr_os->{'os'}, $mr_os->{'suffix'}, $mr_os->{'update'}, $mr_os->{'arch'}) = pb_distro_init();
    7580
    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";
     81# Get some conf file content when they exist; Depends on genre or more precise tuple
     82for my $p ("mr_cmdline","mr_fstab","mr_raidtab","mr_swap","mr_partitions","mr_filesystems","mr_modules","mr_xen") {
     83    my $key = $p;
     84    $key =~ s/mr_//;
     85    my ($pp) = pb_conf_get_if($p);
     86    if (defined $pp) {
     87        my $file = pb_distro_get_param($mr_os->{'name'},$mr_os->{'version'},$mr_os->{'arch'},$pp,$mr_os->{'family'},$mr_os->{'type'},$mr_os->{'os'});
     88        if (-r $file) {
     89            pb_log(2,"DEBUG: File found: $file\n");
     90            $mr_os->{'files'}->{$key} = pb_get_content($file);
     91        } else {
     92            pb_log(2,"WARNING: $file not found\n");
     93        }
     94    }
    8095}
    81 return(pb_get_content($cmdline));
     96
     97# Get some commands result content when they exist; Depends on genre or more precise tuple
     98for my $p ("mr_mount","mr_lsmod","mr_df") {
     99    my $key = $p;
     100    $key =~ s/mr_//;
     101    my ($pp) = pb_conf_get_if($p);
     102    if (defined $pp) {
     103        my $cmd = pb_distro_get_param($mr_os->{'name'},$mr_os->{'version'},$mr_os->{'arch'},$pp,$mr_os->{'family'},$mr_os->{'type'},$mr_os->{'os'});
     104        pb_log(2,"DEBUG: Cmd found: $cmd\n");
     105        $mr_os->{'cmd'}->{$key} = `$cmd`;
     106    }
     107}
     108#
     109# LVM setup
     110#
     111($mr_os->{'lvmver'},$mr_os->{'$lvmcmd'}) = mr_lvm_check();
     112
     113# Summary of conf printed.
     114pb_log(1,"OS Inventory: ".Dumper($mr_os)."\n");
    82115}
    83116
  • devel/mrmini/etc/mrmini.conf

    r2666 r2667  
    9191
    9292#
     93# type of bootloader. Key is ostype-arch
     94#
     95mr_bootloader rpm-i386 = lilo,grub
     96mr_bootloader rpm-ia64 = elilo
     97mr_bootloader deb-i386 = lilo,grub
     98mr_bootloader deb-ia64 = elilo
     99mr_bootloader ebuild-i386 = lilo,grub
     100mr_bootloader ebuild-ia64 = elilo
     101mr_bootloader tgz-i386 = lilo,grub
     102mr_bootloader tgz-ia64 = elilo
     103mr_bootloader port-i386 = unknown
     104mr_bootloader port-ia64 = unknown
     105mr_bootloader pkg-i386 = unknown
     106
     107#
    93108# Location of the logfile
    94109#
  • devel/mrmini/lib/MondoRescue/Mini/Base.pm

    r2666 r2667  
    2020use MondoRescue::Base;
    2121use MondoRescue::LVM;
     22use MondoRescue::Inventory;
    2223
    2324# Inherit from the "Exporter" module which handles exporting functions.
     
    7980pb_log(0,"$ARCH architecture detected\n");
    8081pb_log(0,"$ENV{'PBPKG'} called with the following arguments: ".join(" ",@ARGV)."\n");
    81 pb_log(0,$sep);
     82pb_log(1,$sep);
    8283pb_log(1,"CONFDIR: $mr->{'confdir'}\n");
    8384pb_log(1,"SBIN: $mr->{'install_dir'}/sbin\n");
     
    9293    pb_display_file("$mr->{'confdir'}/mondorescue.conf",$pbLOG);
    9394}
    94 pb_log(0,$sep);
    9595
    9696#
    9797# Prepare cache dir
    9898#
     99# To be checked more
    99100pb_rm_rf("$mr->{'cache_dir'}/*");
    100101pb_mkdir_p($mr->{'cache_dir'});
     
    103104my $mrmini_deplist = "$mr->{'confdir'}/deplist.d";
    104105
    105 #
    106 # LVM setup
    107 #
    108 my ($lvmver,$lvmcmd) = mr_lvm_check();
    109 
    110 pb_log(0,"LVM $lvmver command set to $lvmcmd\n");
    111 pb_log(0,$sep);
     106# Full OS inventory
     107mr_inv_os();
    112108}
  • devel/mrmini/sbin/mrmini

    r2666 r2667  
    159159# ---------------------------------------------------------------------------
    160160
    161 # Initialize the syntax string
     161# Catch signals
     162$SIG{INT} = \&mr_exit;
     163$SIG{QUIT} = \&mr_exit;
     164$SIG{ABRT} = \&mr_exit;
     165$SIG{KILL} = \&mr_exit;
     166$SIG{TERM} = \&mr_exit;
    162167
    163168#
     
    176181($mr->{'install_dir'},$mr->{'version'}) =  mr_conf_get("mr_install_dir","mr_version");
    177182
     183# Initialize the syntax string
    178184pb_syntax_init("$ENV{'PBPKG'} Version $mr->{'version'}\n");
    179185pb_display_init("text","");
Note: See TracChangeset for help on using the changeset viewer.