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 | #
|
---|
9 | use strict 'vars';
|
---|
10 | use ProjectBuilder::Base;
|
---|
11 | use ProjectBuilder::Version;
|
---|
12 | use ProjectBuilder::Distribution;
|
---|
13 | use ProjectBuilder::Conf;
|
---|
14 | use MondoRescue::Version;
|
---|
15 | use MondoRescue::Base;
|
---|
16 | use Data::Dumper;
|
---|
17 | use Getopt::Long qw(:config auto_abbrev no_ignore_case);
|
---|
18 | use English;
|
---|
19 | use Carp qw/confess cluck/;
|
---|
20 |
|
---|
21 | =pod
|
---|
22 |
|
---|
23 | =head1 NAME
|
---|
24 |
|
---|
25 | mr-mkiso Create an ISO image
|
---|
26 |
|
---|
27 | =head1 DESCRIPTION
|
---|
28 |
|
---|
29 | mr-mkiso Create an ISO image for the MondoRescue project
|
---|
30 |
|
---|
31 | =head1 SYNOPSIS
|
---|
32 |
|
---|
33 | mr-mkiso [-v][-h] -o target.iso [options] directories
|
---|
34 |
|
---|
35 | =head1 ARGUMENTS
|
---|
36 |
|
---|
37 | =over 4
|
---|
38 |
|
---|
39 | =item B<directories>
|
---|
40 |
|
---|
41 | These 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 |
|
---|
51 | Name of the ISO image to produce
|
---|
52 |
|
---|
53 | =item B<options>
|
---|
54 |
|
---|
55 | additional options that will be passed to the tool used to create the ISO (mkisofs, genisoimage, xorriso, ...)
|
---|
56 |
|
---|
57 | =item B<-v|--verbose>
|
---|
58 |
|
---|
59 | Increase verbosity
|
---|
60 |
|
---|
61 | =item B<-h|--help>
|
---|
62 |
|
---|
63 | Print a brief help message and exits.
|
---|
64 |
|
---|
65 | =item B<--man>
|
---|
66 |
|
---|
67 | Prints the manual page and exits.
|
---|
68 |
|
---|
69 | =back
|
---|
70 |
|
---|
71 | =head1 WEB SITES
|
---|
72 |
|
---|
73 | 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/>.
|
---|
74 |
|
---|
75 | =head1 USER MAILING LIST
|
---|
76 |
|
---|
77 | For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
|
---|
78 |
|
---|
79 | =head1 AUTHORS
|
---|
80 |
|
---|
81 | The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
|
---|
82 |
|
---|
83 | =head1 COPYRIGHT
|
---|
84 |
|
---|
85 | MondoRescue is distributed under the GPL v2.0 license or later,
|
---|
86 | described in the file C<COPYING> included with the distribution.
|
---|
87 |
|
---|
88 | =cut
|
---|
89 |
|
---|
90 | # Global variables
|
---|
91 | my ($mrver,$mrrev) = mr_version_init();
|
---|
92 | my $appname = "mr-mkiso";
|
---|
93 | my %opts; # CLI Options
|
---|
94 |
|
---|
95 | # Initialize the syntax string
|
---|
96 |
|
---|
97 | pb_syntax_init("$appname Version $mrver-$mrrev\n");
|
---|
98 |
|
---|
99 | GetOptions("help|?|h" => \$opts{'h'},
|
---|
100 | "man" => \$opts{'man'},
|
---|
101 | "output|o" => \$opts{'iso'},
|
---|
102 | "verbose|v+" => \$opts{'v'},
|
---|
103 | ) || pb_syntax(-1,0);
|
---|
104 |
|
---|
105 | my $iso = undef;
|
---|
106 |
|
---|
107 | if (defined $opts{'h'}) {
|
---|
108 | pb_syntax(0,1);
|
---|
109 | }
|
---|
110 | if (defined $opts{'man'}) {
|
---|
111 | pb_syntax(0,2);
|
---|
112 | }
|
---|
113 | if (defined $opts{'v'}) {
|
---|
114 | $pbdebug++;
|
---|
115 | }
|
---|
116 | if (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 |
|
---|
123 | mr_init();
|
---|
124 | my $pbos = pb_distro_get_context();
|
---|
125 | # Get the mode we want to use to create the ISO
|
---|
126 | my ($mode) = pb_distro_get_param($pbos,pb_conf_get_if("mr_iso_mode"));
|
---|
127 | confess "Unable to find mr_iso_mode in configuration file, please add it" if (not defined $mode);
|
---|
128 |
|
---|
129 | if ($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
|
---|
139 | my ($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 |
|
---|
141 | pb_log(0,"mode = $mode\nmr_cmd_$mode = $isocmd\nmr_opt_gen_$mode = $optgen\nmr_opt_mindi_$mode = $optmindi\nmr_opt_mr_$mode = $optmr\n");
|
---|