source: devel/mrmini/lib/MondoRescue/Mini/Base.pm @ 2668

Last change on this file since 2668 was 2668, checked in by bruno, 8 years ago

r3939@athonet: bruno | 2010-06-30 16:50:32 +0200
Renaming of conf file parameters to be more specific

File size: 2.9 KB
Line 
1#!/usr/bin/perl -w
2#
3# Base subroutines for mrmini
4# Mini-distribution maker for the MondoRescue project
5#
6# $Id$
7#
8# Copyright B. Cornec 2008-2010
9# Provided under the GPL v2
10
11package MondoRescue::Mini::Base;
12
13use strict 'vars';
14use Data::Dumper;
15use English;
16use lib qw (lib);
17use ProjectBuilder::Base;
18use ProjectBuilder::Conf;
19use MondoRescue::DynConf;
20use MondoRescue::Base;
21use MondoRescue::LVM;
22use MondoRescue::Inventory;
23
24# Inherit from the "Exporter" module which handles exporting functions.
25
26use Exporter;
27
28# Export, by default, all the functions into the namespace of
29# any code which uses this module.
30
31our @ISA = qw(Exporter);
32our @EXPORT = qw(mr_mini_main);
33
34=pod
35
36=head1 NAME
37
38MondoRescue::Mini::Base, part of the mondorescue.org
39
40=head1 DESCRIPTION
41
42This modules provides low level and generic functions for the mrmini tool
43
44=head1 USAGE
45
46=item B<mr_mini_main>
47
48Main function for mini. Can be called from outside
49
50=cut
51
52sub mr_mini_main {
53
54#
55# Configuration parameters
56#
57# Checks
58die "mr->confdir not declared in environment" if (not defined $mr->{'confdir'});
59
60# Better ?
61my $ARCH = `uname -m`;
62chomp($ARCH);
63
64pb_conf_add("$mr->{'confdir'}/$ENV{'PBPROJ'}.conf.dist");
65($mr->{'boot_size'},$mr->{'boot_cd'},$mr->{'boot_usb'},$mr->{'boot_tape'},$mr->{'kernel'},$mr->{'fstab'}) =  mr_conf_get("mr_boot_size","mr_boot_cd","mr_boot_usb","mr_boot_tape","mr_kernel","mr_fstab");
66($mr->{'tape_mods'},$mr->{'scsi_mods'},$mr->{'ide_mods'},$mr->{'pcmcia_mods'},$mr->{'usb_mods'},$mr->{'net_mods'},$mr->{'cdrom_mods'},$mr->{'deny_mods'},$mr->{'force_mods'}) =  mr_conf_get("mr_tape_mods","mr_scsi_mods","mr_ide_mods","mr_pcmcia_mods","mr_usb_mods","mr_net_mods","mr_cdrom_mods","mr_extra_mods","mr_deny_mods","mr_force_mods");
67($mr->{'cache_dir'},$mr->{'boot_msg'},$mr->{'burn_cmd'},$mr->{'burn_opt'}) = mr_conf_get("mr_cache_dir","mr_boot_msg","mr_burn_cmd","mr_burn_opt");
68
69#
70# Manage log file
71#
72$pbLOG = $mr->{'logdesc'};
73$pbdebug = 1  if ($pbdebug == -1);
74pb_log_init($pbdebug, $pbLOG);
75
76my $sep = "-----------------------------------------------\n";
77
78pb_log(0,"$ENV{'PBPKG'} v$mr->{'version'} start date: $mr->{'start_date'}\n");
79pb_log(0,$sep);
80pb_log(0,"$ARCH architecture detected\n");
81pb_log(0,"$ENV{'PBPKG'} called with the following arguments: ".join(" ",@ARGV)."\n");
82pb_log(1,$sep);
83pb_log(1,"CONFDIR: $mr->{'confdir'}\n");
84pb_log(1,"SBIN: $mr->{'install_dir'}/sbin\n");
85if (-r "$ENV{'HOME'}/.mondorescuerc") {
86    pb_log(0,$sep);
87    pb_log(0,"Conf file $ENV{'HOME'}/.mondorescuerc\n");
88    pb_display_file("$ENV{'HOME'}/.mondorescuerc",$pbLOG);
89}
90if (-r "$mr->{'confdir'}/mondorescue.conf") {
91    pb_log(0,$sep);
92    pb_log(0,"Conf file $mr->{'confdir'}/mondorescue.conf\n");
93    pb_display_file("$mr->{'confdir'}/mondorescue.conf",$pbLOG);
94}
95
96#
97# Prepare cache dir
98#
99# To be checked more
100pb_rm_rf("$mr->{'cache_dir'}/*");
101pb_mkdir_p($mr->{'cache_dir'});
102
103my $mrmini_fdisk = "$mr->{'install_dir'}/parted2fdik";
104my $mrmini_deplist = "$mr->{'confdir'}/deplist.d";
105
106# Full OS inventory
107mr_inv_os();
108}
Note: See TracBrowser for help on using the repository browser.