git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More misc fixes to non-srcdir builds.
[libguestfs.git]
/
inspector
/
virt-inspector.pl
diff --git
a/inspector/virt-inspector.pl
b/inspector/virt-inspector.pl
index
02d8851
..
3754ced
100755
(executable)
--- a/
inspector/virt-inspector.pl
+++ b/
inspector/virt-inspector.pl
@@
-26,8
+26,8
@@
use Sys::Guestfs::Lib qw(open_guest get_partitions resolve_windows_path
use Pod::Usage;
use Getopt::Long;
use Data::Dumper;
use Pod::Usage;
use Getopt::Long;
use Data::Dumper;
-use File::Temp qw/tempdir/;
use XML::Writer;
use XML::Writer;
+use Locale::TextDomain 'libguestfs';
# Optional:
eval "use YAML::Any;";
# Optional:
eval "use YAML::Any;";
@@
-89,6
+89,14
@@
Display brief help.
=cut
=cut
+my $version;
+
+=item B<--version>
+
+Display version number and exit.
+
+=cut
+
my $uri;
=item B<--connect URI> | B<-c URI>
my $uri;
=item B<--connect URI> | B<-c URI>
@@
-173,6
+181,7
@@
default.
=cut
GetOptions ("help|?" => \$help,
=cut
GetOptions ("help|?" => \$help,
+ "version" => \$version,
"connect|c=s" => \$uri,
"text" => sub { $output = "text" },
"none" => sub { $output = "none" },
"connect|c=s" => \$uri,
"text" => sub { $output = "text" },
"none" => sub { $output = "none" },
@@
-187,7
+196,13
@@
GetOptions ("help|?" => \$help,
"windows-registry" => \$windows_registry,
) or pod2usage (2);
pod2usage (1) if $help;
"windows-registry" => \$windows_registry,
) or pod2usage (2);
pod2usage (1) if $help;
-pod2usage ("$0: no image or VM names given") if @ARGV == 0;
+if ($version) {
+ my $g = Sys::Guestfs->new ();
+ my %h = $g->version ();
+ print "$h{major}.$h{minor}.$h{release}$h{extra}\n";
+ exit
+}
+pod2usage (__"virt-inspector: no image or VM names given") if @ARGV == 0;
my $rw = 0;
$rw = 1 if $output eq "fish";
my $rw = 0;
$rw = 1 if $output eq "fish";
@@
-279,7
+294,7
@@
if ($output !~ /.*fish$/) {
if ($output eq "fish" || $output eq "ro-fish") {
my @osdevs = keys %$oses;
# This only works if there is a single OS.
if ($output eq "fish" || $output eq "ro-fish") {
my @osdevs = keys %$oses;
# This only works if there is a single OS.
- die "--fish output is only possible with a single OS\n" if @osdevs != 1;
+ die
__
"--fish output is only possible with a single OS\n" if @osdevs != 1;
my $root_dev = $osdevs[0];
my $root_dev = $osdevs[0];
@@
-293,7
+308,7
@@
if ($output eq "fish" || $output eq "ro-fish") {
# Have to mount / first. Luckily '/' is early in the ASCII
# character set, so this should be OK.
foreach (sort keys %$mounts) {
# Have to mount / first. Luckily '/' is early in the ASCII
# character set, so this should be OK.
foreach (sort keys %$mounts) {
- print "-m $mounts->{$_}:$_ " if $_ ne "swap";
+ print "-m $mounts->{$_}:$_ " if $_ ne "swap"
&& $_ ne "none"
;
}
print "\n"
}
}
print "\n"
}
@@
-305,7
+320,7
@@
elsif ($output eq "perl") {
# YAML output
elsif ($output eq "yaml") {
# YAML output
elsif ($output eq "yaml") {
- die "virt-inspector: no YAML support\n"
+ die
__
"virt-inspector: no YAML support\n"
unless exists $INC{"YAML/Any.pm"};
print Dump(%$oses);
unless exists $INC{"YAML/Any.pm"};
print Dump(%$oses);
@@
-340,13
+355,13
@@
sub output_text_os
print $os->{version}, " " if exists $os->{version};
print "on ", $os->{root_device}, ":\n";
print $os->{version}, " " if exists $os->{version};
print "on ", $os->{root_device}, ":\n";
- print " Mountpoints:\n";
+ print
__
" Mountpoints:\n";
my $mounts = $os->{mounts};
foreach (sort keys %$mounts) {
printf " %-30s %s\n", $mounts->{$_}, $_
}
my $mounts = $os->{mounts};
foreach (sort keys %$mounts) {
printf " %-30s %s\n", $mounts->{$_}, $_
}
- print " Filesystems:\n";
+ print
__
" Filesystems:\n";
my $filesystems = $os->{filesystems};
foreach (sort keys %$filesystems) {
print " $_:\n";
my $filesystems = $os->{filesystems};
foreach (sort keys %$filesystems) {
print " $_:\n";
@@
-364,7
+379,7
@@
sub output_text_os
my %aliases = %{$os->{modprobe_aliases}};
my @keys = sort keys %aliases;
if (@keys) {
my %aliases = %{$os->{modprobe_aliases}};
my @keys = sort keys %aliases;
if (@keys) {
- print " Modprobe aliases:\n";
+ print
__
" Modprobe aliases:\n";
foreach (@keys) {
printf " %-30s %s\n", $_, $aliases{$_}->{modulename}
}
foreach (@keys) {
printf " %-30s %s\n", $_, $aliases{$_}->{modulename}
}
@@
-375,7
+390,7
@@
sub output_text_os
my %modvers = %{$os->{initrd_modules}};
my @keys = sort keys %modvers;
if (@keys) {
my %modvers = %{$os->{initrd_modules}};
my @keys = sort keys %modvers;
if (@keys) {
- print " Initrd modules:\n";
+ print
__
" Initrd modules:\n";
foreach (@keys) {
my @modules = @{$modvers{$_}};
print " $_:\n";
foreach (@keys) {
my @modules = @{$modvers{$_}};
print " $_:\n";
@@
-384,13
+399,13
@@
sub output_text_os
}
}
}
}
- print " Applications:\n";
+ print
__
" Applications:\n";
my @apps = @{$os->{apps}};
foreach (@apps) {
print " $_->{name} $_->{version}\n"
}
my @apps = @{$os->{apps}};
foreach (@apps) {
print " $_->{name} $_->{version}\n"
}
- print " Kernels:\n";
+ print
__
" Kernels:\n";
my @kernels = @{$os->{kernels}};
foreach (@kernels) {
print " $_->{version}\n";
my @kernels = @{$os->{kernels}};
foreach (@kernels) {
print " $_->{version}\n";
@@
-401,7
+416,7
@@
sub output_text_os
}
if (exists $os->{root}->{registry}) {
}
if (exists $os->{root}->{registry}) {
- print " Windows Registry entries:\n";
+ print
__
" Windows Registry entries:\n";
# These are just lumps of text - dump them out.
foreach (@{$os->{root}->{registry}}) {
print "$_\n";
# These are just lumps of text - dump them out.
foreach (@{$os->{root}->{registry}}) {
print "$_\n";
@@
-755,6
+770,8
@@
from L<http://home.eunet.no/~pnordahl/ntpasswd/>.
Richard W.M. Jones L<http://et.redhat.com/~rjones/>
Richard W.M. Jones L<http://et.redhat.com/~rjones/>
+Matthew Booth L<mbooth@redhat.com>
+
=head1 COPYRIGHT
Copyright (C) 2009 Red Hat Inc.
=head1 COPYRIGHT
Copyright (C) 2009 Red Hat Inc.