[Libosinfo] [PATCH 2/4] install-scripts: Add requires-initrd-injection API

Fabiano Fidêncio fidencio at redhat.com
Sun Dec 1 03:09:35 UTC 2013


Some OSes, to provide unattended installation support, require the
configuration file injection on its initrd.
---
 data/schemas/libosinfo.rng     |  5 +++++
 osinfo/libosinfo.syms          |  2 ++
 osinfo/osinfo_install_script.c | 16 ++++++++++++++++
 osinfo/osinfo_install_script.h |  3 +++
 osinfo/osinfo_loader.c         |  1 +
 5 files changed, 27 insertions(+)

diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 0675217..9563fdc 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -616,6 +616,11 @@
             <ref name='driver-signing-reqs'/>
           </element>
         </optional>
+        <optional>
+          <element name='requires-initrd-injection'>
+            <ref name='boolean'/>
+          </element>
+        </optional>
         <element name='template'>
           <choice>
             <group>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 637ad09..d388e35 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -459,6 +459,8 @@ LIBOSINFO_0.2.9 {
 
 	osinfo_os_variantlist_get_type;
 	osinfo_os_variantlist_new;
+
+	osinfo_install_script_get_requires_initrd_injection;
 } LIBOSINFO_0.2.8;
 
 /* Symbols in next release...
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 7444c8d..81ab3c8 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -1309,6 +1309,22 @@ int osinfo_install_script_get_post_install_drivers_signing_req(OsinfoInstallScri
          OSINFO_DEVICE_DRIVER_SIGNING_REQ_NONE);
 }
 
+/**
+ * osinfo_install_script_get_requires_initrd_injection:
+ * @script: the install script
+ *
+ * Whether install script should be injected into the initrd file to be used
+ * in the installion. This is needed for Debian/Ubuntu automated installation.
+ *
+ * Returns: TRUE if install script requires initrd injection, FALSE otherwise.
+ */
+gboolean osinfo_install_script_get_requires_initrd_injection(OsinfoInstallScript *script)
+{
+    return osinfo_entity_get_param_value_boolean
+        (OSINFO_ENTITY(script),
+         OSINFO_INSTALL_SCRIPT_PROP_REQUIRES_INITRD_INJECTION);
+}
+
 
 /*
  * Local variables:
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index c39b786..9b57a33 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -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_REQUIRES_INITRD_INJECTION "requires-initrd-injection"
 
 /* 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);
 
+gboolean osinfo_install_script_get_requires_initrd_injection (OsinfoInstallScript *script);
+
 #endif /* __OSINFO_INSTALL_SCRIPT_H__ */
 /*
  * Local variables:
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index e9ce8e1..a884913 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -773,6 +773,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
         { OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS, G_TYPE_BOOLEAN },
         { OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DRIVERS_SIGNING_REQ, G_TYPE_STRING },
         { OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DRIVERS_SIGNING_REQ, G_TYPE_STRING },
+        { OSINFO_INSTALL_SCRIPT_PROP_REQUIRES_INITRD_INJECTION, G_TYPE_BOOLEAN },
         { NULL, G_TYPE_INVALID }
     };
     gchar *value = NULL;
-- 
1.8.4.2




More information about the Libosinfo mailing list