[Libosinfo] [PATCH 6/8] installer: API to query signed device driver requirement

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Mon Jan 28 03:18:45 UTC 2013


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

---
 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            | 34 +++++++++++++++++++++++++++++++
 osinfo/osinfo_install_script.h            |  5 +++++
 osinfo/osinfo_loader.c                    |  2 ++
 7 files changed, 57 insertions(+)

diff --git a/data/install-scripts/windows-sif.xml b/data/install-scripts/windows-sif.xml
index 8634e3a..972d9b1 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>
+    <can-pre-install-unsigned-drivers>true</can-pre-install-unsigned-drivers>
     <pre-install-driver-format>windows</pre-install-driver-format>
     <config>
       <param name="admin-password" policy="optional"/>
@@ -74,6 +75,7 @@
     <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format>
     <expected-filename>winnt.sif</expected-filename>
     <can-pre-install-drivers>true</can-pre-install-drivers>
+    <can-pre-install-unsigned-drivers>true</can-pre-install-unsigned-drivers>
     <pre-install-driver-format>windows</pre-install-driver-format>
     <config>
       <param name="admin-password" policy="optional"/>
diff --git a/data/install-scripts/windows-unattend.xml b/data/install-scripts/windows-unattend.xml
index e306ec4..43020bc 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>
+   <can-pre-install-unsigned-drivers>true</can-pre-install-unsigned-drivers>
    <pre-install-driver-format>windows</pre-install-driver-format>
     <config>
       <param name="admin-password" policy="optional"/>
@@ -221,6 +222,7 @@
    <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format>
    <expected-filename>autounattend.xml</expected-filename>
    <can-pre-install-drivers>true</can-pre-install-drivers>
+   <can-pre-install-unsigned-drivers>true</can-pre-install-unsigned-drivers>
    <pre-install-driver-format>windows</pre-install-driver-format>
    <config>
     <param name="admin-password" policy="optional"/>
diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index a3eb01c..62a7243 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -590,6 +590,11 @@
           </element>
         </optional>
         <optional>
+          <element name='can-pre-install-unsigned-drivers'>
+            <ref name='bool'/>
+          </element>
+        </optional>
+        <optional>
           <element name='can-post-install-drivers'>
             <ref name='bool'/>
           </element>
@@ -599,6 +604,11 @@
             <ref name='driver-formats'/>
           </element>
         </optional>
+        <optional>
+          <element name='can-post-install-unsigned-drivers'>
+            <ref name='bool'/>
+          </element>
+        </optional>
         <element name='template'>
           <choice>
             <group>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 8998bf4..a70c7de 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_device_driver_get_signed;
+	osinfo_install_script_get_can_pre_install_unsigned_drivers;
+	osinfo_install_script_get_can_post_install_unsigned_drivers;
 	osinfo_install_script_get_pre_install_driver_format;
 	osinfo_install_script_get_post_install_driver_format;
 } LIBOSINFO_0.2.3;
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index ca45b60..67d4391 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -1250,6 +1250,40 @@ OsinfoDeviceDriverFormat osinfo_install_script_get_post_install_driver_format(Os
          OSINFO_DEVICE_DRIVER_FORMAT_EXECUTABLE);
 }
 
+/**
+ * osinfo_install_script_get_can_pre_install_unsigned_drivers:
+ * @script: the install script
+ *
+ * If install script can install drivers at the very beginning of installation,
+ * this function can be used to query if it can handle unsigned drivers.
+ *
+ * Returns: TRUE if install script supports unsigned pre-installable drivers,
+ *          FASLSE otherwise.
+ */
+gboolean osinfo_install_script_get_can_pre_install_unsigned_drivers(OsinfoInstallScript *script)
+{
+    return osinfo_entity_get_param_value_boolean
+        (OSINFO_ENTITY(script),
+         OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_UNSIGNED_DRIVERS);
+}
+
+/**
+ * osinfo_install_script_get_can_post_install_unsigned_drivers:
+ * @script: the install script
+ *
+ * If install script can install drivers at the end of installation, this
+ * function can be used to query if it can handle unsigned drivers.
+ *
+ * Returns: TRUE if install script supports unsigned post-installable drivers,
+ *          FASLSE otherwise.
+ */
+gboolean osinfo_install_script_get_can_post_install_unsigned_drivers(OsinfoInstallScript *script)
+{
+    return osinfo_entity_get_param_value_boolean
+        (OSINFO_ENTITY(script),
+         OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_UNSIGNED_DRIVERS);
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index 82486ef..35a85e4 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -57,6 +57,8 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate;
 #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"
+#define OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_UNSIGNED_DRIVERS "can-pre-install-unsigned-drivers"
+#define OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_UNSIGNED_DRIVERS "can-post-install-unsigned-drivers"
 
 /* object */
 struct _OsinfoInstallScript
@@ -168,6 +170,9 @@ gboolean osinfo_install_script_get_can_post_install_drivers(OsinfoInstallScript
 OsinfoDeviceDriverFormat osinfo_install_script_get_pre_install_driver_format(OsinfoInstallScript *script);
 OsinfoDeviceDriverFormat osinfo_install_script_get_post_install_driver_format(OsinfoInstallScript *script);
 
+gboolean osinfo_install_script_get_can_pre_install_unsigned_drivers(OsinfoInstallScript *script);
+gboolean osinfo_install_script_get_can_post_install_unsigned_drivers(OsinfoInstallScript *script);
+
 #endif /* __OSINFO_INSTALL_SCRIPT_H__ */
 /*
  * Local variables:
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 776a4b6..19780a1 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -704,6 +704,8 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
         OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS,
         OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DEVICE_DRIVER_FORMAT,
         OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DEVICE_DRIVER_FORMAT,
+        OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_UNSIGNED_DRIVERS,
+        OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_UNSIGNED_DRIVERS,
         NULL
     };
     gchar *value = NULL;
-- 
1.8.1




More information about the Libosinfo mailing list