[2149] | 1 | use 5.006001;
|
---|
| 2 | use ExtUtils::MakeMaker;
|
---|
| 3 |
|
---|
| 4 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
---|
| 5 | # the contents of the Makefile that is written.
|
---|
| 6 | WriteMakefile(
|
---|
[2650] | 7 | NAME => 'PBPKG',
|
---|
| 8 | DISTNAME => 'PBPKG',
|
---|
| 9 | VERSION => 'PBVER',
|
---|
| 10 | INST_SCRIPT => 'blib/bin',
|
---|
[2659] | 11 | INSTALLDIRS => 'vendor',
|
---|
[2650] | 12 | PREREQ_PM => {
|
---|
| 13 | #HTTP::Headers => 1.59,
|
---|
| 14 | #Template => 0,
|
---|
| 15 | }, # e.g., Module::Name => 1.1
|
---|
[2149] | 16 | #ABSTRACT_FROM => 'bin/', # retrieve abstract from module
|
---|
[2650] | 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)',
|
---|
[2539] | 22 | },
|
---|
[2650] | 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)',
|
---|
[2149] | 28 | },
|
---|
| 29 | );
|
---|
[2650] | 30 |
|
---|
| 31 | package MY;
|
---|
| 32 |
|
---|
| 33 | sub 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) {
|
---|
[2659] | 63 | $confdir = "$target/etc";
|
---|
[2650] | 64 | }
|
---|
[2659] | 65 | if (not defined $cachedir) {
|
---|
| 66 | $cachedir = "$target/var/cache";
|
---|
| 67 | }
|
---|
[2650] | 68 | } else {
|
---|
| 69 | $cachedir = $cachedir || "$target/var/cache";
|
---|
| 70 | if (not defined $confdir) {
|
---|
| 71 | die "CONFDIR should be defined if PREFIX is defined";
|
---|
| 72 | }
|
---|
[2659] | 73 | if (not defined $cachedir) {
|
---|
| 74 | die "CACHEDIR should be defined if PREFIX is defined";
|
---|
| 75 | }
|
---|
[2650] | 76 | }
|
---|
[2659] | 77 | $sharedir = $sharedir || "$target/share";
|
---|
| 78 | $mandir = $mandir || "$sharedir/man";
|
---|
[2650] | 79 |
|
---|
| 80 | my $conff = "etc/PBPROJ.conf";
|
---|
| 81 | open(CONF, ">> $conff") || die "Unable to append to $conff";
|
---|
| 82 | print CONF << "EOF";
|
---|
| 83 | #
|
---|
| 84 | # Configuration information added at install time
|
---|
| 85 | #
|
---|
| 86 | #
|
---|
| 87 | # installation target
|
---|
| 88 | #
|
---|
| 89 | mr_install_dir default = $target
|
---|
| 90 | #
|
---|
| 91 | # conf dir
|
---|
| 92 | #
|
---|
| 93 | mr_conf_dir default = $confdir/PBPROJ
|
---|
| 94 | #
|
---|
| 95 | # cache directory
|
---|
| 96 | #
|
---|
| 97 | mr_cache_dir default = $cachedir/PBPROJ
|
---|
| 98 | #
|
---|
| 99 | # share directory
|
---|
| 100 | #
|
---|
| 101 | mr_share_dir default = $sharedir/PBPROJ
|
---|
[2659] | 102 | #
|
---|
| 103 | # version
|
---|
| 104 | #
|
---|
| 105 | mr_version default = PBVER-rPBREV
|
---|
[2650] | 106 | EOF
|
---|
| 107 | close(CONF);
|
---|
| 108 | # Create the dynamic content for MondoRescue
|
---|
| 109 | my $dynf = "lib/MondoRescue/DynConf.pm";
|
---|
| 110 | open(DYN, "> $dynf") || die "Unable to create $dynf";
|
---|
| 111 |
|
---|
| 112 | $text .= "install ::\n";
|
---|
[2659] | 113 | $text .= "\t".'@echo PBPKG PBVER-rPBREV will be installed under $(DESTDIR)'."\n";
|
---|
[2650] | 114 | $text .= "\t".'install -m 755 -d $(DESTDIR)'."$confdir/PBPROJ".' $(DESTDIR)'."$cachedir/PBPROJ".' $(DESTDIR)'."$sharedir/PBPROJ\n";
|
---|
| 115 | $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";
|
---|
| 116 | $text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5\n";
|
---|
[2659] | 117 | $text .= "\t".'cp lib/MondoRescue/DynConf.pm $(DESTDIR)/$(VENDORLIBEXP)/MondoRescue/'."\n";
|
---|
[2650] | 118 |
|
---|
| 119 | # Now generate a perl module used by every other one in the project
|
---|
| 120 | print DYN << "EOF";
|
---|
| 121 | #!/usr/bin/perl -w
|
---|
| 122 | #
|
---|
| 123 | # Declare variables for the MondoRescue project
|
---|
| 124 | # This module has been GENERATED at installation time
|
---|
| 125 | # DO NOT MODIFY WITHOUT GOOD REASONS.
|
---|
| 126 | #
|
---|
| 127 | # Copyright B. Cornec 2008
|
---|
| 128 | # Provided under the GPL v2
|
---|
| 129 | #
|
---|
| 130 | package MondoRescue::DynConf;
|
---|
| 131 |
|
---|
| 132 | use strict 'vars';
|
---|
| 133 |
|
---|
| 134 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
| 135 |
|
---|
| 136 | use Exporter;
|
---|
| 137 |
|
---|
| 138 | # Export, by default, all the functions into the namespace of
|
---|
| 139 | # any code which uses this module.
|
---|
| 140 | our \@ISA = qw(Exporter);
|
---|
| 141 | our \@EXPORT = qw(mr_dynconf_init);
|
---|
| 142 |
|
---|
| 143 | =pod
|
---|
| 144 |
|
---|
| 145 | =head1 NAME
|
---|
| 146 |
|
---|
| 147 | MondoRescue::DynConf, part of the mondorescue.org project
|
---|
| 148 |
|
---|
| 149 | =head1 DESCRIPTION
|
---|
| 150 |
|
---|
| 151 | This modules provides environment variables setup for the Mondorescue project
|
---|
| 152 |
|
---|
| 153 | =head1 USAGE
|
---|
| 154 |
|
---|
| 155 | =over 4
|
---|
| 156 |
|
---|
| 157 | =item B<mr_dynconf_init>
|
---|
| 158 |
|
---|
| 159 | This function returns all the installation PATH info needed by the project
|
---|
[2659] | 160 | It takes no parameter and returns 2 values
|
---|
[2650] | 161 | First value is the conf dir
|
---|
| 162 | Second value is the project name
|
---|
| 163 |
|
---|
| 164 | =cut
|
---|
| 165 |
|
---|
| 166 | sub mr_dynconf_init {
|
---|
[2659] | 167 | return("$confdir/PBPROJ","PBPROJ");
|
---|
[2650] | 168 | }
|
---|
| 169 | 1;
|
---|
| 170 | =pod
|
---|
| 171 | =back
|
---|
| 172 |
|
---|
| 173 | =head1 WEB SITES
|
---|
| 174 |
|
---|
| 175 | The 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/>.
|
---|
| 176 |
|
---|
| 177 | =head1 USER MAILING LIST
|
---|
| 178 |
|
---|
| 179 | The mailing list of the project is available at L<mailto:mondo\@lists.sf.net>
|
---|
| 180 |
|
---|
| 181 | =head1 AUTHORS
|
---|
| 182 |
|
---|
| 183 | The Mondorescue.org team L<http://www.mondorescue.org/> lead by Bruno Cornec L<mailto:bruno\@mondorescue.org>.
|
---|
| 184 |
|
---|
| 185 | =head1 COPYRIGHT
|
---|
| 186 |
|
---|
| 187 | mrmini is distributed under the GPL v2.0 license
|
---|
| 188 | described in the file C<COPYING> included with the distribution.
|
---|
| 189 |
|
---|
| 190 | =cut
|
---|
| 191 |
|
---|
| 192 |
|
---|
| 193 | EOF
|
---|
| 194 | close(DYN);
|
---|
| 195 | return($text);
|
---|
| 196 | }
|
---|