source: MondoRescue/branches/3.3/MondoRescue/bin/mr-mkiso@ 3650

Last change on this file since 3650 was 3650, checked in by Bruno Cornec, 7 years ago
  • Fix versions given back for mr-* tools
  • Log pb and mr versions in mindi log
  • mr-getparam now prints a version
  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/usr/bin/perl -w
2#
3# $Id$
4# Copyright B. Cornec 2016-today
5# Provided under the GPL v2
6#
7# Create an ISO image for the MondoRescue project
8#
9use strict 'vars';
10use ProjectBuilder::Base;
11use ProjectBuilder::Version;
12use ProjectBuilder::Distribution;
13use ProjectBuilder::Conf;
14use MondoRescue::Version;
15use MondoRescue::Base;
16use Data::Dumper;
17use Getopt::Long qw(:config auto_abbrev no_ignore_case);
18use English;
19use Carp qw/confess cluck/;
20
21=pod
22
23=head1 NAME
24
25mr-mkiso Create an ISO image
26
27=head1 DESCRIPTION
28
29mr-mkiso Create an ISO image for the MondoRescue project
30
31=head1 SYNOPSIS
32
33mr-mkiso [-v][-h] -o target.iso [options] directories
34
35=head1 ARGUMENTS
36
37=over 4
38
39=item B<directories>
40
41These are the directories whose content needs to be used tobuild the ISO
42
43=back
44
45=head1 OPTIONS
46
47=over 4
48
49=item B<-o|--output>
50
51Name of the ISO image to produce
52
53=item B<options>
54
55additional options that will be passed to the tool used to create the ISO (mkisofs, genisoimage, xorriso, ...)
56
57=item B<-v|--verbose>
58
59Increase verbosity
60
61=item B<-h|--help>
62
63Print a brief help message and exits.
64
65=item B<--man>
66
67Prints the manual page and exits.
68
69=back
70
71=head1 WEB SITES
72
73The 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/>.
74
75=head1 USER MAILING LIST
76
77For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
78
79=head1 AUTHORS
80
81The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
82
83=head1 COPYRIGHT
84
85MondoRescue is distributed under the GPL v2.0 license or later,
86described in the file C<COPYING> included with the distribution.
87
88=cut
89
90# Global variables
91my ($mrver,$mrrev) = mr_version_init();
92my $appname = "mr-mkiso";
93my %opts; # CLI Options
94
95# Initialize the syntax string
96
97pb_syntax_init("$appname Version $mrver-$mrrev\n");
98
99GetOptions("help|?|h" => \$opts{'h'},
100 "man" => \$opts{'man'},
101 "output|o" => \$opts{'iso'},
102 "verbose|v+" => \$opts{'v'},
103) || pb_syntax(-1,0);
104
105my $iso = undef;
106
107if (defined $opts{'h'}) {
108 pb_syntax(0,1);
109}
110if (defined $opts{'man'}) {
111 pb_syntax(0,2);
112}
113if (defined $opts{'v'}) {
114 $pbdebug++;
115}
116if (defined $opts{'iso'}) {
117 $iso = $opts{'iso'};
118} else {
119 pb_syntax(0,1);
120 die "No name given for the ISO to generate";
121}
122
123mr_init();
124my $pbos = pb_distro_get_context();
125# Get the mode we want to use to create the ISO
126my ($mode) = pb_distro_get_param($pbos,pb_conf_get_if("mr_iso_mode"));
127confess "Unable to find mr_iso_mode in configuration file, please add it" if (not defined $mode);
128
129if ($mode eq "best") {
130 # If xorriso exists then use it
131 if (defined pb_check_req("xorriso",0)) {
132 $mode = "xorriso";
133 } else {
134 # If not then use the default command
135 $mode = "mkisofs";
136 }
137}
138# Now get the parameters linked to that mode
139my ($isocmd,$optgen,$optmindi,$optmr) = pb_distro_get_param($pbos,pb_conf_get_if("mr_cmd_$mode","mr_opt_gen_$mode","mr_opt_mindi_$mode","mr_opt_mr_$mode"));
140
141pb_log(0,"mode = $mode\nmr_cmd_$mode = $isocmd\nmr_opt_gen_$mode = $optgen\nmr_opt_mindi_$mode = $optmindi\nmr_opt_mr_$mode = $optmr\n");
Note: See TracBrowser for help on using the repository browser.