source: branches/3.2/MondoRescue/bin/mr-disk-type @ 3592

Last change on this file since 3592 was 3592, checked in by bruno, 3 years ago

Fix a compatibility issue with mr-disk-type not returning only the type of disk but a full sentence (William Montgomery)

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/usr/bin/perl -w
2#
3# $Id$
4# Copyright B. Cornec 2005-2016
5# Provided under the GPL v2
6#
7# Test mr_disk_type to detect whether a disk is MBR or GPT
8#
9use strict;
10use Data::Dumper;
11# For pbdebug
12use ProjectBuilder::Base;
13use MondoRescue::Disk;
14
15=pod
16
17=head1 NAME
18
19mr-disk-type query whether a device has a MBR of GPT partition format
20
21=head1 DESCRIPTION
22
23mr-disk-type query whether a device has a MBR of GPT partition format
24
25=head1 SYNOPSIS
26
27mr-disk-tye /path/to/device
28
29=head1 ARGUMENTS
30
31=over 4
32
33=item B</path/to/device>
34
35This is the path of the device name to query
36
37=back
38
39=head1 WEB SITES
40
41The 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/>.
42
43=head1 USER MAILING LIST
44
45For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
46
47=head1 AUTHORS
48
49The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
50
51=head1 COPYRIGHT
52
53MondoRescue is distributed under the GPL v2.0 license or later,
54described in the file C<COPYING> included with the distribution.
55
56=cut
57
58if ((defined $ARGV[0]) && ($ARGV[0] eq "-v")) {
59    shift;
60    $pbdebug = 2;
61}
62
63my $txt = "";
64my $txt2 = "";
65my $ans = "";
66
67if (defined $ARGV[0]) {
68    foreach my $i (@ARGV) {
69        $ans = mr_disk_type($i);
70        pb_log(2, "Device $i has a $ans partition type\n");
71        pb_log(0, "$ans\n");
72    }
73}
74
75# In case we gave only one param (MondoRescue) then return 0 for success, 1 otherwise
76if (not defined  $ARGV[1]) {
77    exit(0) if (defined $ans);
78    exit(1);
79}
Note: See TracBrowser for help on using the repository browser.