[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [libosinfo 07/10] install-script: Add driver install capability API



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

Add API to query install scripts whether they can pre- and post-install
drivers, meaning at the beginning and end of installation, respectively.
---
 data/schemas/libosinfo.rng     | 10 ++++++++++
 osinfo/libosinfo.syms          |  2 ++
 osinfo/osinfo_install_script.c | 25 +++++++++++++++++++++++++
 osinfo/osinfo_install_script.h |  5 +++++
 osinfo/osinfo_loader.c         |  2 ++
 5 files changed, 44 insertions(+)

diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 3eff268..51b0c20 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -528,6 +528,16 @@
             <text/>
           </element>
         </optional>
+        <optional>
+          <element name='can-pre-install-drivers'>
+            <ref name='bool'/>
+          </element>
+        </optional>
+        <optional>
+          <element name='can-post-install-drivers'>
+            <ref name='bool'/>
+          </element>
+        </optional>
         <element name='template'>
           <choice>
             <group>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 1d7b983..6a8f725 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -358,6 +358,8 @@ LIBOSINFO_0.2.2 {
 	osinfo_install_script_get_path_format;
 
 	osinfo_install_script_get_product_key_format;
+	osinfo_install_script_get_can_pre_install_drivers;
+	osinfo_install_script_get_can_post_install_drivers;
 
 	osinfo_os_get_device_drivers;
 	osinfo_os_add_device_driver;
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 5d80e23..b891aaf 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -1103,6 +1103,31 @@ OsinfoPathFormat osinfo_install_script_get_path_format(OsinfoInstallScript *scri
          OSINFO_PATH_FORMAT_UNIX);
 }
 
+/**
+ * osinfo_install_script_get_can_pre_install_drivers:
+ * @script: the install script
+ *
+ * Whether install script can install drivers at the very beginning of
+ * installation. This is needed for devices for which the OS in question does
+ * not have out of the box support for and devices are required/prefered to be
+ * available during actual installation.
+ *
+ * Returns: TRUE if install script supports pre-installable drivers, FASLSE otherwise.
+ */
+gboolean osinfo_install_script_get_can_pre_install_drivers(OsinfoInstallScript *script)
+{
+    return osinfo_entity_get_param_value_boolean
+        (OSINFO_ENTITY(script),
+         OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS);
+}
+
+gboolean osinfo_install_script_get_can_post_install_drivers(OsinfoInstallScript *script)
+{
+    return osinfo_entity_get_param_value_boolean
+        (OSINFO_ENTITY(script),
+         OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS);
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index a265e15..8dbd66b 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -53,6 +53,8 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate;
 #define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT "product-key-format"
 #define OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME  "expected-filename"
 #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"
 
 /* object */
 struct _OsinfoInstallScript
@@ -156,6 +158,9 @@ void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoI
 GList *osinfo_install_script_get_config_param_list(const OsinfoInstallScript *script);
 OsinfoPathFormat osinfo_install_script_get_path_format(OsinfoInstallScript *script);
 
+gboolean osinfo_install_script_get_can_pre_install_drivers(OsinfoInstallScript *script);
+gboolean osinfo_install_script_get_can_post_install_drivers(OsinfoInstallScript *script);
+
 #endif /* __OSINFO_INSTALL_SCRIPT_H__ */
 /*
  * Local variables:
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 027053b..226c023 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -635,6 +635,8 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
         OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT,
         OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT,
         OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME,
+        OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS,
+        OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS,
         NULL
     };
     gchar *value = NULL;
-- 
1.8.0.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]