summaryrefslogtreecommitdiffstats
path: root/perl/lib
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-03-08 19:27:02 +0000
committerRichard Jones <rjones@redhat.com>2010-03-08 19:35:22 +0000
commit4851466ec5adbbc039222201f7c3b1bc3b97e84e (patch)
tree328168f9ae55116c53b37d3ff65f136b796781b0 /perl/lib
parented6fc794c8a2f64f8b987137b54551f4380177f3 (diff)
downloadlibguestfs-4851466ec5adbbc039222201f7c3b1bc3b97e84e.tar.gz
libguestfs-4851466ec5adbbc039222201f7c3b1bc3b97e84e.tar.xz
libguestfs-4851466ec5adbbc039222201f7c3b1bc3b97e84e.zip
inspector: Add product_name field to output.
This is a free text string containing the "product name" of the OS. It's mainly useful for Windows guests, and a forthcoming patch will get this field from the Windows Registry.
Diffstat (limited to 'perl/lib')
-rw-r--r--perl/lib/Sys/Guestfs/Lib.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 98cdb883..31833bcf 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -814,6 +814,7 @@ sub _check_linux_root
$_ = $g->cat ("/etc/redhat-release");
if (/Fedora release (\d+)(?:\.(\d+))?/) {
+ chomp; $r->{product_name} = $_;
$r->{osdistro} = "fedora";
$r->{os_major_version} = "$1";
$r->{os_minor_version} = "$2" if(defined($2));
@@ -821,6 +822,8 @@ sub _check_linux_root
}
elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux)/) {
+ chomp; $r->{product_name} = $_;
+
my $distro = $1;
if($distro eq "Red Hat Enterprise Linux") {
@@ -874,6 +877,7 @@ sub _check_linux_root
$_ = $g->cat ("/etc/debian_version");
if (/(\d+)\.(\d+)/) {
+ chomp; $r->{product_name} = $_;
$r->{osdistro} = "debian";
$r->{os_major_version} = "$1";
$r->{os_minor_version} = "$2";
@@ -1097,6 +1101,10 @@ Operating system userspace architecture, eg. "i386", "x86_64".
Operating system distribution, eg. "debian".
+=item product_name
+
+Free text product name.
+
=item major_version
Operating system major version, eg. "4".
@@ -1168,6 +1176,8 @@ sub _get_os_version
my $r = shift;
$r->{os} = $r->{root}->{fsos} if exists $r->{root}->{fsos};
+ $r->{product_name} = $r->{root}->{product_name}
+ if exists $r->{root}->{product_name};
$r->{distro} = $r->{root}->{osdistro} if exists $r->{root}->{osdistro};
$r->{major_version} = $r->{root}->{os_major_version}
if exists $r->{root}->{os_major_version};