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