#!/usr/bin/perl -w # # $Id$ # Copyright B. Cornec 2005-2015 # Provided under the GPL v2 # # Test mr_device_mounted to know if a device is mounted # use strict; use Data::Dumper; # For pbdebug use ProjectBuilder::Base; use MondoRescue::Disk; =pod =head1 NAME mr-device-mounted query whether a device is mounted or not =head1 DESCRIPTION mr-device-mounted query whether a device is mounted or not =head1 SYNOPSIS mr-device-mounted /path/to/device =head1 ARGUMENTS =over 4 =item B 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. Bug reports should be filled using the trac instance of the project at L. =head1 USER MAILING LIST For community exchanges around MondoRescue please use the list L =head1 AUTHORS The MondoRescue team lead by Bruno Cornec L. =head1 COPYRIGHT MondoRescue is distributed under the GPL v2.0 license or later, described in the file C 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_device_mounted($i); $txt = " not" if (not defined $ans); $txt2 = " on $ans" if (defined $ans); pb_log(0, "Device $i is$txt mounted$txt2\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); }