#!/usr/bin/perl -w
#
# $Id$
# Copyright B. Cornec 2005-2016
# Provided under the GPL v2
#
# Test mr_disk_type to detect whether a disk is MBR or GPT
#
use strict;
use Data::Dumper;
# For pbdebug
use ProjectBuilder::Base;
use MondoRescue::Disk;

=pod

=head1 NAME

mr-disk-type query whether a device has a MBR of GPT partition format

=head1 DESCRIPTION

mr-disk-type query whether a device has a MBR of GPT partition format

=head1 SYNOPSIS

mr-disk-tye /path/to/device

=head1 ARGUMENTS

=over 4

=item B</path/to/device> 

This is the path of the device name to query

=back

=head1 WEB SITES

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/>.

=head1 USER MAILING LIST

For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>

=head1 AUTHORS

The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.

=head1 COPYRIGHT

MondoRescue is distributed under the GPL v2.0 license or later,
described in the file C<COPYING> included with the distribution.

=cut

if ((defined $ARGV[0]) && ($ARGV[0] eq "-v")) {
	shift;
	$pbdebug = 2;
}

my $txt = "";
my $txt2 = "";
my $ans = "";

if (defined $ARGV[0]) {
	foreach my $i (@ARGV) {
		$ans = mr_disk_type($i);
		pb_log(0, "Device $i has a $ans partition type\n");
	}
}

# In case we gave only one param (MondoRescue) then return 0 for success, 1 otherwise
if (not defined  $ARGV[1]) {
	exit(0) if (defined $ans);
	exit(1);
}
