use strict;
use warnings;
+use Carp qw(croak);
+
use Sys::Guestfs;
use File::Temp qw/tempdir/;
use Locale::TextDomain 'libguestfs';
} elsif (ref ($first) eq "SCALAR") {
@images = ($first);
} else {
- die __"open_guest: first parameter must be a string or an arrayref"
+ croak __"open_guest: first parameter must be a string or an arrayref"
}
my ($conn, $dom);
if (-e $images[0]) {
foreach (@images) {
- die __x("guest image {imagename} does not exist or is not readable",
+ croak __x("guest image {imagename} does not exist or is not readable",
imagename => $_)
unless -r $_;
}
eval {
$boot{default} = $g->aug_get("/files/$grub_conf/default");
};
- if($@) {
- warn __"No grub default specified";
- }
$os->{boot} = \%boot;
}
# Disregard old-style compressed ext2 files and only work with real
# compressed cpio files, since cpio takes ages to (fail to) process anything
# else.
- if ($g->file ($path) =~ /cpio/) {
+ if ($g->exists($path) && $g->file($path) =~ /cpio/) {
eval {
@modules = $g->initrd_list ($path);
};