[Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript

Christophe Fergeau cfergeau at redhat.com
Mon Dec 17 21:07:51 UTC 2012


When generating the unattended installation script, we can now
use osinfo_install_config_get_param_list() to get OS-specific
values when available. This will only work when an
OsinfoInstallConfigParamList is associated with the
OsinfoInstallConfig being processed.
---
 osinfo/osinfo_install_script.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index d72c394..8dbef9e 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -30,6 +30,7 @@
 #include <libxslt/xsltutils.h>
 #include <libxslt/xsltInternals.h>
 #include <glib/gi18n-lib.h>
+#include "osinfo_install_config_private.h"
 #include "osinfo_install_script_private.h"
 
 G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY);
@@ -604,6 +605,7 @@ static xsltStylesheetPtr osinfo_install_script_load_template(const gchar *uri,
 
 static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConfig *config,
                                                                OsinfoEntity *entity,
+                                                               gboolean is_install_config,
                                                                const gchar *name,
                                                                GError **error)
 {
@@ -635,9 +637,15 @@ static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConf
 
     tmp1 = keys = osinfo_entity_get_param_keys(entity);
     while (tmp1) {
-        GList *values = osinfo_entity_get_param_value_list(entity, tmp1->data);
-        GList *tmp2 = values;
+        GList *values;
+        GList *tmp2;
 
+        if (is_install_config)
+            values = osinfo_install_config_get_param_value_list(OSINFO_INSTALL_CONFIG(entity), tmp1->data);
+        else
+            values = osinfo_entity_get_param_value_list(entity, tmp1->data);
+
+        tmp2 = values;
         while (tmp2) {
             if (!(data = xmlNewDocNode(NULL, NULL, (const xmlChar*)tmp1->data,
                                        (const xmlChar*)tmp2->data))) {
@@ -687,6 +695,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
 
     if (!(node = osinfo_install_script_generate_entity_config(config,
                                                               OSINFO_ENTITY(script),
+                                                              FALSE,
                                                               "script",
                                                               error)))
         goto error;
@@ -698,6 +707,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
 
     if (!(node = osinfo_install_script_generate_entity_config(config,
                                                               OSINFO_ENTITY(os),
+                                                              FALSE,
                                                               "os",
                                                               error)))
         goto error;
@@ -709,6 +719,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
 
     if (!(node = osinfo_install_script_generate_entity_config(config,
                                                               OSINFO_ENTITY(config),
+                                                              TRUE,
                                                               "config",
                                                               error)))
         goto error;
-- 
1.8.0.2




More information about the Libosinfo mailing list