From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> --- data/install-scripts/windows-sif.xml | 2 ++ data/install-scripts/windows-unattend.xml | 2 ++ data/schemas/libosinfo.rng | 10 ++++++++++ osinfo/libosinfo.syms | 2 ++ osinfo/osinfo_install_script.c | 28 ++++++++++++++++++++++++++++ osinfo/osinfo_install_script.h | 5 +++++ osinfo/osinfo_loader.c | 20 ++++++++++++++++++++ 7 files changed, 69 insertions(+) diff --git a/data/install-scripts/windows-sif.xml b/data/install-scripts/windows-sif.xml index c072f4b..262e6ec 100644 --- a/data/install-scripts/windows-sif.xml +++ b/data/install-scripts/windows-sif.xml @@ -6,6 +6,7 @@ <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format> <expected-filename>winnt.sif</expected-filename> <can-pre-install-drivers>true</can-pre-install-drivers> + <pre-install-driver-format>windows</pre-install-driver-format> <config> <param name="admin-password" policy="optional"/> <param name="reg-product-key" policy="required"/> @@ -72,6 +73,7 @@ <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format> <expected-filename>winnt.sif</expected-filename> <can-pre-install-drivers>true</can-pre-install-drivers> + <pre-install-driver-format>windows</pre-install-driver-format> <config> <param name="admin-password" policy="optional"/> <param name="reg-product-key" policy="required"/> diff --git a/data/install-scripts/windows-unattend.xml b/data/install-scripts/windows-unattend.xml index e140617..e306ec4 100644 --- a/data/install-scripts/windows-unattend.xml +++ b/data/install-scripts/windows-unattend.xml @@ -5,6 +5,7 @@ <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format> <expected-filename>autounattend.xml</expected-filename> <can-pre-install-drivers>true</can-pre-install-drivers> + <pre-install-driver-format>windows</pre-install-driver-format> <config> <param name="admin-password" policy="optional"/> <param name="hardware-arch" policy="optional"/> @@ -220,6 +221,7 @@ <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format> <expected-filename>autounattend.xml</expected-filename> <can-pre-install-drivers>true</can-pre-install-drivers> + <pre-install-driver-format>windows</pre-install-driver-format> <config> <param name="admin-password" policy="optional"/> <param name="hardware-arch" policy="required"/> diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng index 74fc9ce..042ba53 100644 --- a/data/schemas/libosinfo.rng +++ b/data/schemas/libosinfo.rng @@ -579,11 +579,21 @@ <ref name='bool'/> </element> </optional> + <zeroOrMore> + <element name='pre-install-driver-format'> + <ref name='driver-formats'/> + </element> + </zeroOrMore> <optional> <element name='can-post-install-drivers'> <ref name='bool'/> </element> </optional> + <zeroOrMore> + <element name='post-install-driver-format'> + <ref name='driver-formats'/> + </element> + </zeroOrMore> <element name='template'> <choice> <group> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index 1ad4d82..5a61e93 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -404,6 +404,8 @@ LIBOSINFO_0.2.4 { osinfo_device_driver_format_get_type; osinfo_device_driver_get_format; osinfo_entity_get_param_value_enum_list; + osinfo_install_script_get_pre_install_driver_formats; + osinfo_install_script_get_post_install_driver_formats; } LIBOSINFO_0.2.3; /* Symbols in next release... diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 276c756..8b70365 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -1230,6 +1230,34 @@ gboolean osinfo_install_script_get_can_post_install_drivers(OsinfoInstallScript OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS); } +/** + * osinfo_install_script_get_pre_install_driver_formats: + * + * Returns: (transfer container) (element-type OsinfoDeviceDriverFormat): + */ +GList *osinfo_install_script_get_pre_install_driver_formats(OsinfoInstallScript *script) +{ + return osinfo_entity_get_param_value_enum_list + (OSINFO_ENTITY(script), + OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DEVICE_DRIVER_FORMAT, + OSINFO_TYPE_DEVICE_DRIVER_FORMAT, + OSINFO_DEVICE_DRIVER_FORMAT_SCRIPT); +} + +/** + * osinfo_install_script_get_post_install_driver_formats: + * + * Returns: (transfer container) (element-type OsinfoDeviceDriverFormat): + */ +GList *osinfo_install_script_get_post_install_driver_formats(OsinfoInstallScript *script) +{ + return osinfo_entity_get_param_value_enum_list + (OSINFO_ENTITY(script), + OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DEVICE_DRIVER_FORMAT, + OSINFO_TYPE_DEVICE_DRIVER_FORMAT, + OSINFO_DEVICE_DRIVER_FORMAT_SCRIPT); +} + /* * Local variables: * indent-tabs-mode: nil diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h index d91751e..f9c0aaf 100644 --- a/osinfo/osinfo_install_script.h +++ b/osinfo/osinfo_install_script.h @@ -55,6 +55,8 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate; #define OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT "path-format" #define OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS "can-pre-install-drivers" #define OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS "can-post-install-drivers" +#define OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DEVICE_DRIVER_FORMAT "pre-install-driver-format" +#define OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DEVICE_DRIVER_FORMAT "post-install-driver-format" /* object */ struct _OsinfoInstallScript @@ -163,6 +165,9 @@ OsinfoPathFormat osinfo_install_script_get_path_format(OsinfoInstallScript *scri gboolean osinfo_install_script_get_can_pre_install_drivers(OsinfoInstallScript *script); gboolean osinfo_install_script_get_can_post_install_drivers(OsinfoInstallScript *script); +GList *osinfo_install_script_get_pre_install_driver_formats(OsinfoInstallScript *script); +GList *osinfo_install_script_get_post_install_driver_formats(OsinfoInstallScript *script); + #endif /* __OSINFO_INSTALL_SCRIPT_H__ */ /* * Local variables: diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index a190018..0c9cc0b 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -705,6 +705,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader, gchar *value = NULL; xmlNodePtr *nodes = NULL; int nnodes; + int i; if (!id) { OSINFO_ERROR(err, _("Missing install script id property")); @@ -762,6 +763,25 @@ static void osinfo_loader_install_script(OsinfoLoader *loader, } g_free(nodes); + nnodes = osinfo_loader_nodeset("./*", ctxt, &nodes, err); + if (error_is_set(err)) + goto error; + + for (i = 0 ; i < nnodes ; i++) { + if (!nodes[i]->children || + nodes[i]->children->type != XML_TEXT_NODE || + (strcmp((const gchar *)nodes[i]->name, + OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DEVICE_DRIVER_FORMAT) != 0 && + strcmp((const gchar *)nodes[i]->name, + OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DEVICE_DRIVER_FORMAT))) + continue; + + osinfo_entity_set_param(OSINFO_ENTITY(installScript), + (const gchar *)nodes[i]->name, + (const gchar *)nodes[i]->children->content); + } + g_free(nodes); + osinfo_db_add_install_script(loader->priv->db, installScript); return; -- 1.8.1.2 _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo