[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',
|
---|
[2149] | 11 | INSTALLDIRS => 'perl',
|
---|
[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) {
|
---|
| 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 | #
|
---|
| 83 | mr_install_dir default = $target
|
---|
| 84 | #
|
---|
| 85 | #
|
---|
| 86 | # conf dir
|
---|
| 87 | #
|
---|
| 88 | mr_conf_dir default = $confdir/PBPROJ
|
---|
| 89 | #
|
---|
| 90 | # cache directory
|
---|
| 91 | #
|
---|
| 92 | mr_cache_dir default = $cachedir/PBPROJ
|
---|
| 93 | #
|
---|
| 94 | # share directory
|
---|
| 95 | #
|
---|
| 96 | mr_share_dir default = $sharedir/PBPROJ
|
---|
| 97 | EOF
|
---|
| 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 | #
|
---|
| 124 | package MondoRescue::DynConf;
|
---|
| 125 |
|
---|
| 126 | use strict 'vars';
|
---|
| 127 |
|
---|
| 128 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
| 129 |
|
---|
| 130 | use Exporter;
|
---|
| 131 |
|
---|
| 132 | # Export, by default, all the functions into the namespace of
|
---|
| 133 | # any code which uses this module.
|
---|
| 134 | our \@ISA = qw(Exporter);
|
---|
| 135 | our \@EXPORT = qw(mr_dynconf_init);
|
---|
| 136 |
|
---|
| 137 | =pod
|
---|
| 138 |
|
---|
| 139 | =head1 NAME
|
---|
| 140 |
|
---|
| 141 | MondoRescue::DynConf, part of the mondorescue.org project
|
---|
| 142 |
|
---|
| 143 | =head1 DESCRIPTION
|
---|
| 144 |
|
---|
| 145 | This 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 |
|
---|
| 153 | This function returns all the installation PATH info needed by the project
|
---|
| 154 | It takes no parameter and returns 3 values
|
---|
| 155 | First value is the conf dir
|
---|
| 156 | Second value is the project name
|
---|
| 157 |
|
---|
| 158 | =cut
|
---|
| 159 |
|
---|
| 160 | sub mr_dynconf_init {
|
---|
| 161 | return($confdir,PBPROJ);
|
---|
| 162 | }
|
---|
| 163 | 1;
|
---|
| 164 | =pod
|
---|
| 165 | =back
|
---|
| 166 |
|
---|
| 167 | =head1 WEB SITES
|
---|
| 168 |
|
---|
| 169 | 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/>.
|
---|
| 170 |
|
---|
| 171 | =head1 USER MAILING LIST
|
---|
| 172 |
|
---|
| 173 | The mailing list of the project is available at L<mailto:mondo\@lists.sf.net>
|
---|
| 174 |
|
---|
| 175 | =head1 AUTHORS
|
---|
| 176 |
|
---|
| 177 | The Mondorescue.org team L<http://www.mondorescue.org/> lead by Bruno Cornec L<mailto:bruno\@mondorescue.org>.
|
---|
| 178 |
|
---|
| 179 | =head1 COPYRIGHT
|
---|
| 180 |
|
---|
| 181 | mrmini is distributed under the GPL v2.0 license
|
---|
| 182 | described in the file C<COPYING> included with the distribution.
|
---|
| 183 |
|
---|
| 184 | =cut
|
---|
| 185 |
|
---|
| 186 |
|
---|
| 187 | EOF
|
---|
| 188 | close(DYN);
|
---|
| 189 | return($text);
|
---|
| 190 | }
|
---|