source: MondoRescue/branches/3.3/MondoRescue/Makefile.PL@ 3648

Last change on this file since 3648 was 3648, checked in by Bruno Cornec, 7 years ago
  • Adds mr-mksio script to generate the correct command to build an ISO image
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-device-mounted
21 bin/mr-disk-list
22 bin/mr-disk-type
23 bin/mr-distro-getparam
24 bin/mr-getparam
25 bin/mr-kernel-get-modules
26 bin/mr-label
27 bin/mr-mkiso
28 bin/mr-net-get-config
29 bin/mr-process-ldd
30 bin/mr-read-all-link
31 ) ],
32);
33
34package MY;
35
36sub postamble {
37
38 # Determine location of etc conf files
39 my $text ="";
40
41 # Grab out any CONFDIR or other build param
42 my $confdir = undef;
43 my $target = undef;
44 my $mandir = undef;
45 my $cachedir = undef;
46 my $sharedir = undef;
47
48 while (my $arg = shift @ARGV) {
49 my ($key, $value) = split /=/, $arg;
50 if ($key =~ /^CONFDIR$/) {
51 $confdir = $value;
52 } elsif ($key =~ /^MANDIR$/) {
53 $mandir = $value;
54 } elsif ($key =~ /^CACHEDIR$/) {
55 $cachedir = $value;
56 } elsif ($key =~ /^SHAREDIR$/) {
57 $sharedir = $value;
58 } elsif ($key =~ /^TARGET$/) {
59 $target = $value;
60 }
61 }
62
63 if (not defined $target) {
64 $target = "/usr/local";
65 if (not defined $confdir) {
66 $confdir = "$target/etc";
67 }
68 if (not defined $cachedir) {
69 $cachedir = "$target/var/cache";
70 }
71 } else {
72 $cachedir = $cachedir || "$target/var/cache";
73 if (not defined $confdir) {
74 die "CONFDIR should be defined if PREFIX is defined";
75 }
76 if (not defined $cachedir) {
77 die "CACHEDIR should be defined if PREFIX is defined";
78 }
79 }
80 $sharedir = $sharedir || "$target/share";
81 $mandir = $mandir || "$sharedir/man";
82
83 my $conff = "etc/PBPROJ.conf";
84 open(CONF, ">> $conff") || die "Unable to append to $conff";
85 print CONF << "EOF";
86#
87# Configuration information added at install time
88#
89#
90# installation target
91#
92mr_install_dir default = $target
93#
94# conf dir
95#
96mr_conf_dir default = $confdir/PBPROJ
97#
98# cache directory
99#
100mr_cache_dir default = $cachedir/PBPROJ
101#
102# share directory
103#
104mr_share_dir default = $sharedir/PBPROJ
105#
106# version
107#
108mr_version default = PBVER-rPBREV
109EOF
110 close(CONF);
111 # Create the dynamic content for MondoRescue
112 my $dynf = "lib/MondoRescue/DynConf.pm";
113 open(DYN, "> $dynf") || die "Unable to create $dynf";
114
115 $text .= "install ::\n";
116 $text .= "\t".'@echo PBPKG PBVER-rPBREV will be installed under $(DESTDIR)'."\n";
117 $text .= "\t".'install -m 755 -d $(DESTDIR)'."$confdir/PBPROJ".' $(DESTDIR)'."$cachedir/PBPROJ".' $(DESTDIR)'."$sharedir/PBPROJ\n";
118 $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";
119 $text .= "\t".'(cd $(DESTDIR)'."$confdir/PBPROJ/ ; md5sum PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5)\n";
120 $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";
121 $text .= "\t".'cp lib/MondoRescue/DynConf.pm $(DESTDIR)/$(VENDORLIBEXP)/MondoRescue/'."\n";
122
123 # Now generate a perl module used by every other one in the project
124 print DYN << "EOF";
125#!/usr/bin/perl -w
126#
127# Declare variables for the MondoRescue project
128# This module has been GENERATED at installation time
129# DO NOT MODIFY WITHOUT GOOD REASONS.
130#
131# Copyright B. Cornec 2008-2014
132# Provided under the GPL v2
133#
134package MondoRescue::DynConf;
135
136use strict 'vars';
137
138# Inherit from the "Exporter" module which handles exporting functions.
139
140use Exporter;
141
142# Export, by default, all the functions into the namespace of
143# any code which uses this module.
144our \@ISA = qw(Exporter);
145our \@EXPORT = qw(mr_dynconf_init);
146
147=pod
148
149=head1 NAME
150
151MondoRescue::DynConf, part of the mondorescue.org project
152
153=head1 DESCRIPTION
154
155This modules provides environment variables setup for the Mondorescue project
156
157=head1 USAGE
158
159=over 4
160
161=item B<mr_dynconf_init>
162
163This function returns all the installation PATH info needed by the project
164It takes no parameter and returns 2 values
165First value is the conf dir
166Second value is the project name
167
168=cut
169
170sub mr_dynconf_init {
171 return("$confdir/PBPROJ","PBPROJ");
172}
1731;
174=pod
175=back
176
177=head1 WEB SITES
178
179The 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/>.
180
181=head1 USER MAILING LIST
182
183The mailing list of the project is available at L<mailto:mondo\@lists.sf.net>
184
185=head1 AUTHORS
186
187The Mondorescue.org team L<http://www.mondorescue.org/> lead by Bruno Cornec L<mailto:bruno\@mondorescue.org>.
188
189=head1 COPYRIGHT
190
191mrmini is distributed under the GPL v2.0 license
192described in the file C<COPYING> included with the distribution.
193
194=cut
195
196
197EOF
198 close(DYN);
199 return($text);
200}
Note: See TracBrowser for help on using the repository browser.