[virt-tools-list] [libosinfo 5/6] Detection tool should set env for media ID

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Thu Nov 24 15:19:02 UTC 2011


From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>

Detection tool now prints an environment variable 'OSINFO_MEDIA' with
the value of the ID of the media in the OS that was positively matched
against the media in question.

This implies setting of a udev property for the device by the same name.
---
 data/95-osinfo.rules.in |    6 ++++--
 tools/osinfo-detect.c   |    2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/data/95-osinfo.rules.in b/data/95-osinfo.rules.in
index 2d0defd..917858c 100644
--- a/data/95-osinfo.rules.in
+++ b/data/95-osinfo.rules.in
@@ -28,12 +28,14 @@ ACTION=="change", \
  ENV{ID_FS_TYPE}!="iso9660", \
  OSINFO_BOOTABLE="", \
  OSINFO_INSTALLER="" \
- OSINFO_LIVE=""
+ OSINFO_LIVE="" \
+ OSINFO_MEDIA=""
 
 ACTION=="change", \
  SUBSYSTEM=="block", \
  ENV{ID_FS_TYPE}!="udf", \
  OSINFO_BOOTABLE="", \
  OSINFO_INSTALLER="" \
- OSINFO_LIVE=""
+ OSINFO_LIVE="" \
+ OSINFO_MEDIA=""
 
diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c
index 750f98f..5413dec 100644
--- a/tools/osinfo-detect.c
+++ b/tools/osinfo-detect.c
@@ -91,6 +91,8 @@ static void print_os(OsinfoOs *os, OsinfoMedia *media)
             g_print("OSINFO_INSTALLER=%s\n", id);
         if (osinfo_media_get_live (media))
             g_print("OSINFO_LIVE=%s\n", id);
+        g_print("OSINFO_MEDIA=%s\n",
+                osinfo_entity_get_id(OSINFO_ENTITY(media)));
     } else {
         const gchar *name = osinfo_product_get_name(OSINFO_PRODUCT(os));
 
-- 
1.7.7.1




More information about the virt-tools-list mailing list