[3219] | 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(
|
---|
| 7 | NAME => 'PBPKG',
|
---|
| 8 | DISTNAME => 'PBPKG',
|
---|
| 9 | VERSION => 'PBVER',
|
---|
| 10 | INST_SCRIPT => 'blib/bin',
|
---|
| 11 | INSTALLDIRS => 'vendor',
|
---|
| 12 | PREREQ_PM => {
|
---|
| 13 | #HTTP::Headers => 1.59,
|
---|
| 14 | #Template => 0,
|
---|
| 15 | }, # e.g., Module::Name => 1.1
|
---|
| 16 | #ABSTRACT_FROM => 'bin/', # retrieve abstract from module
|
---|
| 17 | AUTHOR => 'Bruno Cornec <bruno#mondorescue.org>',
|
---|
[3226] | 18 | EXE_FILES => [ qw( bin/mr-analyze-lvm
|
---|
| 19 | bin/mr-check-lvm
|
---|
[3553] | 20 | bin/mr-disk-list
|
---|
| 21 | bin/mr-disk-type
|
---|
[3447] | 22 | bin/mr-device-mounted
|
---|
[3226] | 23 | bin/mr-process-ldd
|
---|
| 24 | bin/mr-read-all-link
|
---|
[3251] | 25 | bin/mr-kernel-get-modules
|
---|
[3265] | 26 | bin/mr-net-get-config
|
---|
[3487] | 27 | bin/mr-label
|
---|
[3226] | 28 | ) ],
|
---|
[3219] | 29 | );
|
---|
| 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 = "$target/etc";
|
---|
| 64 | }
|
---|
| 65 | if (not defined $cachedir) {
|
---|
| 66 | $cachedir = "$target/var/cache";
|
---|
| 67 | }
|
---|
| 68 | } else {
|
---|
| 69 | $cachedir = $cachedir || "$target/var/cache";
|
---|
| 70 | if (not defined $confdir) {
|
---|
| 71 | die "CONFDIR should be defined if PREFIX is defined";
|
---|
| 72 | }
|
---|
| 73 | if (not defined $cachedir) {
|
---|
| 74 | die "CACHEDIR should be defined if PREFIX is defined";
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 | $sharedir = $sharedir || "$target/share";
|
---|
| 78 | $mandir = $mandir || "$sharedir/man";
|
---|
| 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
|
---|
| 102 | #
|
---|
| 103 | # version
|
---|
| 104 | #
|
---|
| 105 | mr_version default = PBVER-rPBREV
|
---|
| 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";
|
---|
| 113 | $text .= "\t".'@echo PBPKG PBVER-rPBREV will be installed under $(DESTDIR)'."\n";
|
---|
| 114 | $text .= "\t".'install -m 755 -d $(DESTDIR)'."$confdir/PBPROJ".' $(DESTDIR)'."$cachedir/PBPROJ".' $(DESTDIR)'."$sharedir/PBPROJ\n";
|
---|
[3239] | 115 | $text .= "\t".'cp etc/PBPROJ.conf $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist ; install -m 755 -d ".' $(DESTDIR)'."$mandir/man5 ; perl -p -e 's/^# //; s/^#//' etc/PBPROJ.conf | pod2man --name=PBPROJ.conf --release=PBVER-rPBREV --section=5 > ".'$(DESTDIR)'."$mandir/man5/PBPROJ.conf.5\n";
|
---|
[3240] | 116 | $text .= "\t".'(cd $(DESTDIR)'."$confdir/PBPROJ/ ; md5sum PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5)\n";
|
---|
[3219] | 117 | $text .= "\t".'if [ ! -f "'.'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf".'" ]; then echo "# Local configuration file for Mondorescue" > $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf".'; echo "# Adapt content taken from the distribution conf file PBPROJ.conf.dist which should remain untouched" >> $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf ; fi\n";
|
---|
| 118 | $text .= "\t".'cp lib/MondoRescue/DynConf.pm $(DESTDIR)/$(VENDORLIBEXP)/MondoRescue/'."\n";
|
---|
| 119 |
|
---|
| 120 | # Now generate a perl module used by every other one in the project
|
---|
| 121 | print DYN << "EOF";
|
---|
| 122 | #!/usr/bin/perl -w
|
---|
| 123 | #
|
---|
| 124 | # Declare variables for the MondoRescue project
|
---|
| 125 | # This module has been GENERATED at installation time
|
---|
| 126 | # DO NOT MODIFY WITHOUT GOOD REASONS.
|
---|
| 127 | #
|
---|
| 128 | # Copyright B. Cornec 2008-2014
|
---|
| 129 | # Provided under the GPL v2
|
---|
| 130 | #
|
---|
| 131 | package MondoRescue::DynConf;
|
---|
| 132 |
|
---|
| 133 | use strict 'vars';
|
---|
| 134 |
|
---|
| 135 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
| 136 |
|
---|
| 137 | use Exporter;
|
---|
| 138 |
|
---|
| 139 | # Export, by default, all the functions into the namespace of
|
---|
| 140 | # any code which uses this module.
|
---|
| 141 | our \@ISA = qw(Exporter);
|
---|
| 142 | our \@EXPORT = qw(mr_dynconf_init);
|
---|
| 143 |
|
---|
| 144 | =pod
|
---|
| 145 |
|
---|
| 146 | =head1 NAME
|
---|
| 147 |
|
---|
| 148 | MondoRescue::DynConf, part of the mondorescue.org project
|
---|
| 149 |
|
---|
| 150 | =head1 DESCRIPTION
|
---|
| 151 |
|
---|
| 152 | This modules provides environment variables setup for the Mondorescue project
|
---|
| 153 |
|
---|
| 154 | =head1 USAGE
|
---|
| 155 |
|
---|
| 156 | =over 4
|
---|
| 157 |
|
---|
| 158 | =item B<mr_dynconf_init>
|
---|
| 159 |
|
---|
| 160 | This function returns all the installation PATH info needed by the project
|
---|
| 161 | It takes no parameter and returns 2 values
|
---|
| 162 | First value is the conf dir
|
---|
| 163 | Second value is the project name
|
---|
| 164 |
|
---|
| 165 | =cut
|
---|
| 166 |
|
---|
| 167 | sub mr_dynconf_init {
|
---|
| 168 | return("$confdir/PBPROJ","PBPROJ");
|
---|
| 169 | }
|
---|
| 170 | 1;
|
---|
| 171 | =pod
|
---|
| 172 | =back
|
---|
| 173 |
|
---|
| 174 | =head1 WEB SITES
|
---|
| 175 |
|
---|
| 176 | 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/>.
|
---|
| 177 |
|
---|
| 178 | =head1 USER MAILING LIST
|
---|
| 179 |
|
---|
| 180 | The mailing list of the project is available at L<mailto:mondo\@lists.sf.net>
|
---|
| 181 |
|
---|
| 182 | =head1 AUTHORS
|
---|
| 183 |
|
---|
| 184 | The Mondorescue.org team L<http://www.mondorescue.org/> lead by Bruno Cornec L<mailto:bruno\@mondorescue.org>.
|
---|
| 185 |
|
---|
| 186 | =head1 COPYRIGHT
|
---|
| 187 |
|
---|
| 188 | mrmini is distributed under the GPL v2.0 license
|
---|
| 189 | described in the file C<COPYING> included with the distribution.
|
---|
| 190 |
|
---|
| 191 | =cut
|
---|
| 192 |
|
---|
| 193 |
|
---|
| 194 | EOF
|
---|
| 195 | close(DYN);
|
---|
| 196 | return($text);
|
---|
| 197 | }
|
---|