Changeset 2650


Ignore:
Timestamp:
Jun 13, 2010, 12:36:38 PM (9 years ago)
Author:
bruno
Message:

r3875@localhost: bruno | 2010-06-12 12:31:38 +0200

  • Review completely the installation process for mrmini, and first packages buildable
Location:
devel
Files:
2 deleted
4 edited
3 moved

Legend:

Unmodified
Added
Removed
  • devel/mr/Makefile.PL

    r2539 r2650  
    55# the contents of the Makefile that is written.
    66WriteMakefile(
    7     NAME        => 'PBPKG',
    8     DISTNAME    => 'PBPKG',
    9     VERSION      => 'PBVER',
    10     INST_SCRIPT  => 'blib/bin',
     7    NAME        => 'PBPKG',
     8    DISTNAME    => 'PBPKG',
     9    VERSION   => 'PBVER',
     10    INST_SCRIPT  => 'blib/bin',
    1111    INSTALLDIRS  => 'perl',
    12     PREREQ_PM    => {
    13             #HTTP::Headers                    => 1.59,
    14             #Template                        => 0,
    15     },    # e.g., Module::Name => 1.1
     12    PREREQ_PM   => {
     13            #HTTP::Headers                  => 1.59,
     14            #Template                        => 0,
     15    },  # e.g., Module::Name => 1.1
    1616    #ABSTRACT_FROM => 'bin/',   # retrieve abstract from module
    17     AUTHOR        => 'Bruno Cornec <bruno#mondorescue.org>',
    18     EXE_FILES    => [ qw( sbin/mranalyze-lvm sbin/mrcheck-lvm ) ],
    19     MAN1PODS      => {
    20             'sbin/mranalyze-lvm' => '$(INST_MAN1DIR)/mranalyze-lvm.$(MAN1EXT)', 
    21             'sbin/mrcheck-lvm' => '$(INST_MAN1DIR)/mranalyze-lvm.$(MAN1EXT)', 
     17    AUTHOR      => 'Bruno Cornec <bruno#mondorescue.org>',
     18    EXE_FILES    => [ qw( sbin/mranalyze-lvm sbin/mrcheck-lvm ) ],
     19    MAN1PODS      => {
     20            'sbin/mranalyze-lvm' => '$(INST_MAN1DIR)/mranalyze-lvm.$(MAN1EXT)',
     21            'sbin/mrcheck-lvm' => '$(INST_MAN1DIR)/mranalyze-lvm.$(MAN1EXT)',
    2222                    },
    23     MAN3PODS      => { 
    24                         'lib/MondoRescue/Base.pm' => '$(INST_MAN3DIR)/MondoRescue::Base.$(MAN3EXT)',
    25                         'lib/MondoRescue/LVM.pm' => '$(INST_MAN3DIR)/MondoRescue::LVM.$(MAN3EXT)',
    26                         'lib/MondoRescue/Inventory.pm' => '$(INST_MAN3DIR)/MondoRescue::Inventory.$(MAN3EXT)',
     23    MAN3PODS      => { 
     24            'lib/MondoRescue/Base.pm' => '$(INST_MAN3DIR)/MondoRescue::Base.$(MAN3EXT)',
     25            'lib/MondoRescue/LVM.pm' => '$(INST_MAN3DIR)/MondoRescue::LVM.$(MAN3EXT)',
     26            'lib/MondoRescue/Inventory.pm' => '$(INST_MAN3DIR)/MondoRescue::Inventory.$(MAN3EXT)',
     27            'lib/MondoRescue/DynConf.pm' => '$(INST_MAN3DIR)/MondoRescue::DynConf.$(MAN3EXT)',
    2728                },
    2829);
     30
     31package MY;
     32
     33sub postamble {
     34
     35        # Determine location of etc conf files
     36        my $text ="";
     37
     38        # Grab out any CONFDIR or other build param
     39        my $confdir = undef;
     40        my $target = undef;
     41        my $mandir = undef;
     42        my $cachedir = undef;
     43        my $sharedir = undef;
     44
     45        while (my $arg = shift @ARGV) {
     46                my ($key, $value) = split /=/, $arg;
     47                if ($key =~ /^CONFDIR$/) {
     48                        $confdir = $value;
     49                } elsif ($key =~ /^MANDIR$/) {
     50                        $mandir = $value;
     51                } elsif ($key =~ /^CACHEDIR$/) {
     52                        $cachedir = $value;
     53                } elsif ($key =~ /^SHAREDIR$/) {
     54                        $sharedir = $value;
     55                } elsif ($key =~ /^TARGET$/) {
     56                        $target = $value;
     57                }
     58        }
     59
     60        if (not defined $target) {
     61            $target = "/usr/local";
     62            if (not defined $confdir) {
     63                $confdir = "/usr/local/etc";
     64            }
     65        } else {
     66            $sharedir = $sharedir || "$target/share";
     67            $mandir = $mandir || "$sharedir/man";
     68            $cachedir = $cachedir || "$target/var/cache";
     69            if (not defined $confdir) {
     70                die "CONFDIR should be defined if PREFIX is defined";
     71            }
     72        }
     73
     74        my $conff = "etc/PBPROJ.conf";
     75        open(CONF, ">> $conff") || die "Unable to append to $conff";
     76        print CONF << "EOF";
     77#
     78# Configuration information added at install time
     79#
     80#
     81# installation target
     82#
     83mr_install_dir default = $target
     84#
     85#
     86# conf dir
     87#
     88mr_conf_dir default = $confdir/PBPROJ
     89#
     90# cache directory
     91#
     92mr_cache_dir default = $cachedir/PBPROJ
     93#
     94# share directory
     95#
     96mr_share_dir default = $sharedir/PBPROJ
     97EOF
     98        close(CONF);
     99        # Create the dynamic content for MondoRescue
     100        my $dynf = "lib/MondoRescue/DynConf.pm";
     101        open(DYN, "> $dynf") || die "Unable to create $dynf";
     102
     103        $text .= "install ::\n";
     104        $text .= "\t".'@echo PBPKG PBVER-PBREV will be installed under $(DESTDIR)'."\n";
     105        $text .= "\t".'install -m 755 -d $(DESTDIR)'."$confdir/PBPROJ".' $(DESTDIR)'."$cachedir/PBPROJ".' $(DESTDIR)'."$sharedir/PBPROJ\n";
     106        $text .= "\t".'cp etc/PBPROJ.conf $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist ; install -m 755 -d ".' $(DESTDIR)'."$mandir/man5 ; pod2man etc/PBPROJ.conf > ".'$(DESTDIR)'."$mandir/man5/PBPROJ.conf.5\n";
     107        $text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5\n";
     108        $text .= "\t".'cp lib/MondoRescue/DynConf.pm $(DESTDIR)/$(INST_LIBDIR)/'."\n";
     109        $text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5\n";
     110        #$text .= "\t".'if [ -f etc/PBKG.conf ]; then cp etc/PBPKG.conf $(DESTDIR)'."$confdir/PBPROJ/PBKG.conf.dist ; install -m 755 -d ".' $(DESTDIR)'."$mandir/man5 ; pod2man etc/PBPKG.conf > ".'$(DESTDIR)'."$mandir/man5/PBPKG.conf.5 ; fi\n";
     111        #$text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPKG.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPKG.conf.dist.md5\n";
     112
     113        # Now generate a perl module used by every other one in the project
     114        print DYN << "EOF";
     115#!/usr/bin/perl -w
     116#
     117# Declare variables for the MondoRescue project
     118# This module has been GENERATED at installation time
     119# DO NOT MODIFY WITHOUT GOOD REASONS.
     120#
     121# Copyright B. Cornec 2008
     122# Provided under the GPL v2
     123#
     124package MondoRescue::DynConf;
     125
     126use strict 'vars';
     127
     128# Inherit from the "Exporter" module which handles exporting functions.
     129 
     130use Exporter;
     131 
     132# Export, by default, all the functions into the namespace of
     133# any code which uses this module.
     134our \@ISA = qw(Exporter);
     135our \@EXPORT = qw(mr_dynconf_init);
     136
     137=pod
     138
     139=head1 NAME
     140
     141MondoRescue::DynConf, part of the mondorescue.org project
     142
     143=head1 DESCRIPTION
     144
     145This modules provides environment variables setup for the Mondorescue project
     146
     147=head1 USAGE
     148
     149=over 4
     150
     151=item B<mr_dynconf_init>
     152
     153This function returns all the installation PATH info needed by the project
     154It takes no parameter and returns 3 values
     155First value is the conf dir
     156Second value is the project name
     157
     158=cut
     159
     160sub mr_dynconf_init {
     161    return($confdir,PBPROJ);
     162}
     1631;
     164=pod
     165=back
     166
     167=head1 WEB SITES
     168
     169The main Web site of the project is available at L<http://www.mondorescue.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>.
     170
     171=head1 USER MAILING LIST
     172
     173The mailing list of the project is available at L<mailto:mondo\@lists.sf.net>
     174
     175=head1 AUTHORS
     176
     177The Mondorescue.org team L<http://www.mondorescue.org/> lead by Bruno Cornec L<mailto:bruno\@mondorescue.org>.
     178
     179=head1 COPYRIGHT
     180
     181mrmini is distributed under the GPL v2.0 license
     182described in the file C<COPYING> included with the distribution.
     183
     184=cut
     185
     186
     187EOF
     188    close(DYN);
     189    return($text);
     190}
  • devel/mr/etc/mondorescue.conf

    r2648 r2650  
    77# DO NOT CHANGE THAT FILE IN ANYWAY AS ITS MD5 SUM IS USED AS A CHECK !!
    88# Anyway changing some values in your own configuration file may render
    9 # mrmini instable or cause failures. Use with care.
     9# MondoRescue tools instable or cause failures. Use with care.
    1010
    1111# Temporary directory
  • devel/mr/lib/MondoRescue/Base.pm

    r2541 r2650  
    6060}
    6161
     62
    6263# Get the various location determined at installation time
    63 my ($confdir,$localdir,$pbproj) = mr_dynconf_init();
     64my ($etcdir,$pbproj) = mr_dynconf_init();
    6465
    6566# Temp dir
     
    6869# First use the main configuration file
    6970pb_conf_init($pbproj);
    70 pb_conf_add("$confdir/$pbproj.conf");
     71#
     72# Conf files Management
     73# the $MRMINI_CONF/mondorescue.conf.dist is delivered as part of the project and
     74# its checksum is verified as we need good default values that we can trust
     75#
     76open(MD5,"$etcdir/$pbproj.conf.dist.md5") || die "Unable to read mandatory $etcdir/$pbproj.conf.dist.md5: $!";
     77my $omd5 = <MD5>;
     78chop($omd5);
     79close(MD5);
     80open(CONF,"$etcdir/$pbproj.conf.dist") || die "Unable to read mandatory $etcdir/$pbproj.conf.dist: $!";
     81my $md5 = Digest::MD5->new;
     82binmode(CONF);
     83$md5->addfile(CONF);
     84die "Invalid MD5 found sum for $etcdir/$pbproj.conf.dist: $md5->hexdigest" if ($omd5 ne $md5->hexdigest);
     85close(CONF);
     86
     87pb_conf_add("$etcdir/$pbproj.conf.dist");
    7188}
    7289
  • devel/mr/lib/MondoRescue/LVM.pm

    r2648 r2650  
    277277    s/^[\s]*//;
    278278
     279=pod
     280
     281The structure contains an array of LVs called lvs and starting at 1, containing the name of the PV as provided by the pv_name attribute of the pvs command
     282
     283=cut
     284
    279285    my ($vg_name,$lv_uuid,$lv_name,$lv_attr,$lv_major,$lv_minor,$lv_read_ahead,$lv_kernel_major,$lv_kernel_minor,$lv_kernel_read_ahead,$lv_size,$seg_count,$origin,$origin_size,$snap_percent,$copy_percent,$move_pv,$convert_lv,$lv_tags,$mirror_log,$modules) = split(/:/);
    280 =pod
    281 
    282 The structure contains an array of LVs called lvs and starting at 1, containing the name of the PV as provided by the pv_name attribute of the pvs command
    283 pv_name              - Name of the physical volume PV
    284 
    285 =cut
    286 
    287     # Array of PVs for that VG
    288     $lvm->{$vg_name}->{'pvs'}->[$lvm->{$vg_name}->{'pvnum'}] = $pv_name;
    289286
    290287=pod
  • devel/mrmini/sbin/mrmini

    r2648 r2650  
    5757# Handle options
    5858#
     59
     60=pod
     61=over 4
     62=item B<-v|--verbose>
     63
     64Print a brief help message and exits.
     65
     66=item B<-q|--quiet>
     67
     68Do not print any output.
     69
     70=item B<-h|--help>
     71
     72Print a brief help message and exits.
     73
     74=item B<--man>
     75
     76Prints the manual page and exits.
     77
     78=item B<-i|--iso iso_image>
     79
     80Name of the ISO image you want to created.
     81
     82=item B<-u|--usb usb_device>
     83
     84Name of the USB device on which you want to created your image.
     85
     86=item B<-t|--tape tape_device>
     87
     88Name of the Tape device on which you want to created your image.
     89
     90=item B<-o|--obdr>
     91
     92Activate OBDR mode for tape (Bootable tape devices)
     93
     94=item B<-V|--version>
     95
     96Display mrmini version and exit
     97
     98=item B<-f|--force>
     99
     100Force usage of defaults parameters or values without asking questions
     101
     102=item B<-p|--printvars variable>
     103
     104Prints the value of the variable passed as parameter
     105
     106=cut
    59107GetOptions(
    60 
    61 =over 4
    62 
    63 =cut
    64108        "verbose|v+" => \$opts{'v'},
    65 
    66 =item B<-v|--verbose>
    67 
    68 Print a brief help message and exits.
    69 
    70 =cut
    71109        "quiet|q" => \$opts{'q'},
    72 
    73 =item B<-q|--quiet>
    74 
    75 Do not print any output.
    76 
    77 =cut
    78110        "help|?|h" => \$opts{'h'},
    79 
    80 =item B<-h|--help>
    81 
    82 Print a brief help message and exits.
    83 
    84 =cut
    85111        "man" => \$opts{'man'},
    86 
    87 =item B<--man>
    88 
    89 Prints the manual page and exits.
    90 
    91 =cut
    92112        "iso|i=s" => \$opts{'i'},
    93 
    94 =item B<-i|--iso iso_image>
    95 
    96 Name of the ISO image you want to created.
    97 
    98 =cut
    99113        "usb|u=s" => \$opts{'u'},
    100 
    101 =item B<-u|--usb usb_device>
    102 
    103 Name of the USB device on which you want to created your image.
    104 
    105 =cut
    106114        "tape|t=s" => \$opts{'t'},
    107 
    108 =item B<-t|--tape tape_device>
    109 
    110 Name of the Tape device on which you want to created your image.
    111 
    112 =cut
    113115        "obdr|o" => \$opts{'o'},
    114 
    115 =item B<-o|--obdr>
    116 
    117 Activate OBDR mode for tape (Bootable tape devices)
    118 
    119 =cut
    120116        "version|V" => \$opts{'V'},
    121 
    122 =item B<-V|--version>
    123 
    124 Display mrmini version and exit
    125 
    126 =cut
    127117        "force|f" => \$opts{'f'},
    128 
    129 =item B<-f|--force>
    130 
    131 Force usage of defaults parameters or values without asking questions
    132 
    133 =cut
    134118        "printvar|p=s" => \$opts{'p'},
    135 
    136 =item B<-p|--printvars variable>
    137 
    138 Prints the value of the variable passed as parameter
    139 
    140 =cut
    141119        "log-files|l=s" => \$opts{'l'},
    142120) || pb_syntax(-1,0);
    143121
     122=pod
    144123=back
    145124
     
    215194# Global variables
    216195#
     196my ($MRMINI_PREFIX,$MRMINI_CONF,$MRMINI_LIB) = mr_setup_var();
    217197my $MRMINI_VERSION = "PBVER-rPBREV";
    218 my $MRMINI_PREFIX = "XXX";
    219 my $MRMINI_CONF = "YYY";
    220 my $MRMINI_LIB = "LLL";
    221198my $MRMINI_SBIN = "$MRMINI_PREFIX/sbin";
    222199my $MRMINI_FDISK = "$MRMINI_SBIN/parted2fdik";
     
    231208pb_temp_init();
    232209
    233 #
    234 # Conf files Management
    235 # the $MRMINI_CONF/mondorescue.conf.dist is delivered as part of the project and
    236 # its checksum is verified as we need good default values that we can trust
    237 #
    238 open(MD5,"$MRMINI_CONF/mondorescue.conf.dist.md5") || die "Unable to read mandatory $MRMINI_CONF/mondorescue.conf.dist.md5: $!";
    239 my $omd5 = <MD5>;
    240 chop($omd5);
    241 close(MD5);
    242 open(CONF,"$MRMINI_CONF/mondorescue.conf.dist") || die "Unable to read mandatory $MRMINI_CONF/mondorescue.conf.dist: $!";
    243 my $md5 = Digest::MD5->new;
    244 binmode(CONF);
    245 $md5->addfile(CONF);
    246 die "Invalid MD5 found sum for $MRMINI_CONF/mondorescue.conf.dist: $md5->hexdigest" if ($omd5 ne $md5->hexdigest);
    247 close(CONF);
    248 
    249210# Adds conf files in order
    250 pb_conf_add("$ENV{'HOME'}/.mondorescuerc","$MRMINI_CONF/mondorescue.conf","$MRMINI_CONF/mondorescue.conf.dist");
     211pb_conf_add("$ENV{'HOME'}/.mondorescuerc","$MRMINI_CONF/mondorescue.conf");
    251212
    252213#
Note: See TracChangeset for help on using the changeset viewer.