[Libosinfo] [PATCH 2/3] install-script: Add needs-internet param

Lasse Schuirmann lasse.schuirmann at gmail.com
Sun Aug 10 13:55:07 UTC 2014


Add API to query install scripts whether they can work properly without
an internet connection or not.
---
 data/schemas/libosinfo.rng     |  5 +++++
 osinfo/libosinfo.syms          |  5 +++++
 osinfo/osinfo_install_script.c | 17 +++++++++++++++++
 osinfo/osinfo_install_script.h |  3 +++
 osinfo/osinfo_loader.c         |  1 +
 5 files changed, 31 insertions(+)

diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 4f4edac..e693674 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -597,6 +597,11 @@
           </element>
         </optional>
         <optional>
+          <element name='needs-internet'>
+            <ref name='bool'/>
+          </element>
+        </optional>
+        <optional>
           <element name='can-pre-install-drivers'>
             <ref name='bool'/>
           </element>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index abcc8bb..86de581 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -500,6 +500,11 @@ LIBOSINFO_0.2.10 {
 	osinfo_install_script_injection_method_get_type;
 } LIBOSINFO_0.2.9;
 
+  LIBOSINFO_0.2.11 {
+    global:
+	osinfo_install_script_get_needs_internet;
+  } LIBOSINFO_0.2.10;
+
 /* Symbols in next release...
 
   LIBOSINFO_0.0.2 {
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 8cb06cc..66a49e4 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -1326,6 +1326,23 @@ unsigned int osinfo_install_script_get_injection_methods(OsinfoInstallScript *sc
          OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK);
 }
 
+/**
+ * osinfo_install_script_get_needs_internet:
+ * @script: the install script
+ *
+ * Some install scripts can not ensure that they work without an internet connection.
+ *
+ * Returns: TRUE if script needs an internet connection, FALSE otherwise
+ * internet connection.
+ */
+gboolean osinfo_install_script_get_needs_internet(OsinfoInstallScript *script)
+{
+    return osinfo_entity_get_param_value_boolean_with_default
+        (OSINFO_ENTITY(script),
+         OSINFO_INSTALL_SCRIPT_PROP_NEEDS_INTERNET,
+         FALSE);
+}
+
 
 /*
  * Local variables:
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index d328a96..f8083b4 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -55,6 +55,7 @@ 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_NEEDS_INTERNET     "needs-internet"
 #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_INJECTION_METHOD "injection-method"
@@ -220,6 +221,8 @@ int osinfo_install_script_get_post_install_drivers_signing_req(OsinfoInstallScri
 
 unsigned int osinfo_install_script_get_injection_methods(OsinfoInstallScript *script);
 
+gboolean osinfo_install_script_get_needs_internet(OsinfoInstallScript *script);
+
 #endif /* __OSINFO_INSTALL_SCRIPT_H__ */
 /*
  * Local variables:
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index b8d6e45..845eda3 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -822,6 +822,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
         { OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT, G_TYPE_STRING },
         { OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT, G_TYPE_STRING },
         { OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME, G_TYPE_STRING },
+        { OSINFO_INSTALL_SCRIPT_PROP_NEEDS_INTERNET, G_TYPE_BOOLEAN },
         { OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS, G_TYPE_BOOLEAN },
         { OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS, G_TYPE_BOOLEAN },
         { OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DRIVERS_SIGNING_REQ, G_TYPE_STRING },
-- 
1.9.3




More information about the Libosinfo mailing list