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

Last change on this file since 3110 was 3110, checked in by bruno, 5 years ago
  • Store a status for devel ersion of mondo
File size: 2.8 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
64($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");
65($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");
66($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");
67
68my $sep = "-----------------------------------------------\n";
69
70pb_log(0,"$ENV{'PBPKG'} v$mr->{'version'} start date: $mr->{'start_date'}\n");
71pb_log(0,$sep);
72pb_log(0,"$ARCH architecture detected\n");
73pb_log(0,"$ENV{'PBPKG'} called with the following arguments: ".join(" ",@ARGV)."\n");
74pb_log(1,$sep);
75pb_log(1,"CONFDIR: $mr->{'confdir'}\n");
76pb_log(1,"SBIN: $mr->{'install_dir'}/sbin\n");
77if (-r "$ENV{'HOME'}/.mondorescuerc") {
78    pb_log(0,$sep);
79    pb_log(0,"Conf file $ENV{'HOME'}/.mondorescuerc\n");
80    pb_display_file("$ENV{'HOME'}/.mondorescuerc",$mr->{'logdesc'}) if ($pbdebug ge 0);
81}
82if (-r "$mr->{'confdir'}/mondorescue.conf") {
83    pb_log(0,$sep);
84    pb_log(0,"Conf file $mr->{'confdir'}/mondorescue.conf\n");
85    pb_display_file("$mr->{'confdir'}/mondorescue.conf",$mr->{'logdesc'}) if ($pbdebug ge 0);
86}
87
88#
89# Prepare cache dir
90#
91# To be checked more
92pb_rm_rf("$mr->{'cache_dir'}/*");
93pb_mkdir_p($mr->{'cache_dir'});
94
95my $mrmini_fdisk = "$mr->{'install_dir'}/parted2fdik";
96my $mrmini_deplist = "$mr->{'confdir'}/deplist.d";
97
98# Full OS inventory
99pb_log(0,$sep);
100mr_inv_os();
101}
Note: See TracBrowser for help on using the repository browser.