[Libosinfo] [PATCH v2 1/3] install-scripts: Add get-supported-injection-media API
Giuseppe Scrivano
gscrivan at redhat.com
Wed Feb 26 14:21:53 UTC 2014
Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
data/schemas/libosinfo.rng | 11 +++++++++++
osinfo/libosinfo.syms | 4 ++++
osinfo/osinfo_install_script.c | 16 +++++++++++++++-
osinfo/osinfo_install_script.h | 5 ++++-
osinfo/osinfo_loader.c | 16 ++++++++++++++--
5 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 0675217..a4fe2b7 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -616,6 +616,9 @@
<ref name='driver-signing-reqs'/>
</element>
</optional>
+ <zeroOrMore>
+ <ref name='supported-injection-media'/>
+ </zeroOrMore>
<element name='template'>
<choice>
<group>
@@ -770,4 +773,12 @@
</data>
</element>
</define>
+
+ <define name='supported-injection-media'>
+ <element name='supported-injection-media'>
+ <data type="string">
+ <param name="pattern">initrd|web|cdrom</param>
+ </data>
+ </element>
+ </define>
</grammar>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index c3b967c..79a9683 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -495,6 +495,10 @@ LIBOSINFO_0.2.9 {
osinfo_release_status_get_type;
} LIBOSINFO_0.2.8;
+LIBOSINFO_0.2.10 {
+ osinfo_install_script_get_supported_injection_media;
+} LIBOSINFO_0.2.9;
+
/* Symbols in next release...
LIBOSINFO_0.0.2 {
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 7444c8d..394de43 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -1,7 +1,7 @@
/*
* libosinfo:
*
- * Copyright (C) 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2009-2012, 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1309,6 +1309,20 @@ int osinfo_install_script_get_post_install_drivers_signing_req(OsinfoInstallScri
OSINFO_DEVICE_DRIVER_SIGNING_REQ_NONE);
}
+/**
+ * osinfo_install_script_get_supported_injection_media:
+ * @script: the install script
+ *
+ * Returns: (transfer container)(element-type utf8): a list of supported media
+ * for install script injection.
+ */
+GList *osinfo_install_script_get_supported_injection_media(OsinfoInstallScript *script)
+{
+ return osinfo_entity_get_param_value_list
+ (OSINFO_ENTITY(script),
+ OSINFO_INSTALL_SCRIPT_PROP_SUPPORTED_INJECTION_MEDIA);
+}
+
/*
* Local variables:
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index c39b786..e9c0dfb 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -1,7 +1,7 @@
/*
* libosinfo: OS installation script
*
- * Copyright (C) 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2009-2012, 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -57,6 +57,7 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate;
#define OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS "can-post-install-drivers"
#define OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DRIVERS_SIGNING_REQ "pre-install-drivers-signing-req"
#define OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DRIVERS_SIGNING_REQ "post-install-drivers-signing-req"
+#define OSINFO_INSTALL_SCRIPT_PROP_SUPPORTED_INJECTION_MEDIA "supported-injection-media"
/* object */
struct _OsinfoInstallScript
@@ -195,6 +196,8 @@ gboolean osinfo_install_script_get_can_post_install_drivers(OsinfoInstallScript
int osinfo_install_script_get_pre_install_drivers_signing_req(OsinfoInstallScript *script);
int osinfo_install_script_get_post_install_drivers_signing_req(OsinfoInstallScript *script);
+GList *osinfo_install_script_get_supported_injection_media(OsinfoInstallScript *script);
+
#endif /* __OSINFO_INSTALL_SCRIPT_H__ */
/*
* Local variables:
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index e9ce8e1..cc0c6b4 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1,7 +1,7 @@
/*
* libosinfo:
*
- * Copyright (C) 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2009-2012, 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -777,7 +777,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
};
gchar *value = NULL;
xmlNodePtr *nodes = NULL;
- int nnodes;
+ int i, nnodes;
if (!id) {
OSINFO_ERROR(err, _("Missing install script id property"));
@@ -835,6 +835,18 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
}
g_free(nodes);
+ nnodes = osinfo_loader_nodeset("./supported-injection-media", ctxt, &nodes, err);
+ if (error_is_set(err))
+ goto error;
+
+ for (i = 0 ; i < nnodes ; i++) {
+ osinfo_entity_add_param(OSINFO_ENTITY(installScript),
+ OSINFO_INSTALL_SCRIPT_PROP_SUPPORTED_INJECTION_MEDIA,
+ (const gchar *)nodes[i]->children->content);
+ }
+ g_free(nodes);
+
+
osinfo_db_add_install_script(loader->priv->db, installScript);
return;
--
1.8.5.3
More information about the Libosinfo
mailing list