source: MondoRescue/branches/3.2/MondoRescue/Makefile.PL@ 3586

Last change on this file since 3586 was 3553, checked in by Bruno Cornec, 8 years ago

Help Fix #790

  • Fix perl functions to handle disk type (MBR vs GPT) on RHEL7 and unify output format
  • Adds perl function to list all disks on the system
  • Adds perl program to unit test these functions
  • which_partition_format now uses mr-disk-type
File size: 5.3 KB
Line 
1use 5.006001;
2use ExtUtils::MakeMaker;
3
4# See lib/ExtUtils/MakeMaker.pm for details of how to influence
5# the contents of the Makefile that is written.
6WriteMakefile(
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>',
18 EXE_FILES => [ qw( bin/mr-analyze-lvm
19 bin/mr-check-lvm
20 bin/mr-disk-list
21 bin/mr-disk-type
22 bin/mr-device-mounted
23 bin/mr-process-ldd
24 bin/mr-read-all-link
25 bin/mr-kernel-get-modules
26 bin/mr-net-get-config
27 bin/mr-label
28 ) ],
29);
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 = "$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#
89mr_install_dir default = $target
90#
91# conf dir
92#
93mr_conf_dir default = $confdir/PBPROJ
94#
95# cache directory
96#
97mr_cache_dir default = $cachedir/PBPROJ
98#
99# share directory
100#
101mr_share_dir default = $sharedir/PBPROJ
102#
103# version
104#
105mr_version default = PBVER-rPBREV
106EOF
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";
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";
116 $text .= "\t".'(cd $(DESTDIR)'."$confdir/PBPROJ/ ; md5sum PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5)\n";
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#
131package MondoRescue::DynConf;
132
133use strict 'vars';
134
135# Inherit from the "Exporter" module which handles exporting functions.
136
137use Exporter;
138
139# Export, by default, all the functions into the namespace of
140# any code which uses this module.
141our \@ISA = qw(Exporter);
142our \@EXPORT = qw(mr_dynconf_init);
143
144=pod
145
146=head1 NAME
147
148MondoRescue::DynConf, part of the mondorescue.org project
149
150=head1 DESCRIPTION
151
152This 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
160This function returns all the installation PATH info needed by the project
161It takes no parameter and returns 2 values
162First value is the conf dir
163Second value is the project name
164
165=cut
166
167sub mr_dynconf_init {
168 return("$confdir/PBPROJ","PBPROJ");
169}
1701;
171=pod
172=back
173
174=head1 WEB SITES
175
176The 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
180The mailing list of the project is available at L<mailto:mondo\@lists.sf.net>
181
182=head1 AUTHORS
183
184The Mondorescue.org team L<http://www.mondorescue.org/> lead by Bruno Cornec L<mailto:bruno\@mondorescue.org>.
185
186=head1 COPYRIGHT
187
188mrmini is distributed under the GPL v2.0 license
189described in the file C<COPYING> included with the distribution.
190
191=cut
192
193
194EOF
195 close(DYN);
196 return($text);
197}
Note: See TracBrowser for help on using the repository browser.