[virt-tools-list] [PATCH 1/3] differenciate between expected/output script name
Fabiano Fidêncio
fabiano at fidencio.org
Mon Oct 1 00:46:41 UTC 2012
We need to differenciate between the expected filename and the output
filename. While former always remains the same (as some operating
systems expect it with a particular name), the latter is dependent on
the output prefix (set by application)
---
data/install-scripts/windows-sif.xml | 4 ++--
data/install-scripts/windows-unattend.xml | 4 ++--
osinfo/libosinfo.syms | 1 +
osinfo/osinfo_install_script.c | 35 +++++++++++++++++++++++++++++--
osinfo/osinfo_install_script.h | 6 ++++--
osinfo/osinfo_loader.c | 2 +-
6 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/data/install-scripts/windows-sif.xml b/data/install-scripts/windows-sif.xml
index 52cca39..76f9baf 100644
--- a/data/install-scripts/windows-sif.xml
+++ b/data/install-scripts/windows-sif.xml
@@ -7,7 +7,7 @@
<param name="reg-product-key" policy="required"/>
<param name="user-realname" policy="required"/>
</config>
- <template filename="windows.sif">
+ <template filename="winnt.sif">
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
@@ -70,7 +70,7 @@
<param name="user-realname" policy="required"/>
<param name="hostname" policy="required"/>
</config>
- <template filename="windows.sif">
+ <template filename="winnt.sif">
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
diff --git a/data/install-scripts/windows-unattend.xml b/data/install-scripts/windows-unattend.xml
index 0695fa6..38fd9ab 100644
--- a/data/install-scripts/windows-unattend.xml
+++ b/data/install-scripts/windows-unattend.xml
@@ -10,7 +10,7 @@
<param name="user-realname" policy="optional"/>
<param name="reg-product-key" policy="required"/>
</config>
- <template filename="windows.xml">
+ <template filename="autounattend.xml">
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
@@ -175,7 +175,7 @@
<param name="user-realname" policy="optional"/>
<param name="hostname" policy="required"/>
</config>
- <template filename="windows.xml">
+ <template filename="autounattend.xml">
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 6676588..772e89c 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -308,6 +308,7 @@ LIBOSINFO_0.2.1 {
osinfo_entity_get_param_value_int64;
osinfo_entity_get_param_value_int64_with_default;
osinfo_entity_set_param_int64;
+ osinfo_install_script_get_expected_filename;
} LIBOSINFO_0.2.0;
/* Symbols in next release...
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index bb2c2eb..8efe5f1 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -353,10 +353,41 @@ const gchar *osinfo_install_script_get_output_prefix(OsinfoInstallScript *script
return script->priv->output_prefix;
}
-const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script)
+/**
+ * osinfo_install_script_get_expected_filename:
+ *
+ * Some operating systems (as Windows) expect that script filename has
+ * particular name to work.
+ *
+ * Returns: (transfer none): the expected script filename
+ */
+const gchar *osinfo_install_script_get_expected_filename(OsinfoInstallScript *script)
{
return osinfo_entity_get_param_value(OSINFO_ENTITY(script),
- OSINFO_INSTALL_SCRIPT_PROP_OUTPUT_FILENAME);
+ OSINFO_INSTALL_SCRIPT_PROP_FILENAME);
+}
+
+/**
+ * osinfo_install_script_get_output_filename:
+ *
+ * Some operating systems are able to use any script filename, allowing the
+ * application to set the filename as desired. libosinfo provides this
+ * functionality by set the expected filename's prefix using
+ * osinfo_install_script_set_output_prefix() function.
+ *
+ * Returns: (transfer full): the output script filename
+ */
+gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script)
+{
+ char *output_filename = osinfo_install_script_get_expected_filename(script);
+
+ if (script->priv->output_prefix)
+ output_filename = g_strjoin("-",
+ script->priv->output_prefix,
+ output_filename,
+ NULL);
+
+ return output_filename;
}
struct _OsinfoInstallScriptGenerateData {
diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
index cbfc517..d128f94 100644
--- a/osinfo/osinfo_install_script.h
+++ b/osinfo/osinfo_install_script.h
@@ -50,7 +50,7 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate;
#define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA "template-data"
#define OSINFO_INSTALL_SCRIPT_PROP_PROFILE "profile"
#define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT "product-key-format"
-#define OSINFO_INSTALL_SCRIPT_PROP_OUTPUT_FILENAME "output-filename"
+#define OSINFO_INSTALL_SCRIPT_PROP_FILENAME "filename"
#define OSINFO_INSTALL_SCRIPT_PROP_CONFIG_REQUIRED "required"
#define OSINFO_INSTALL_SCRIPT_PROP_CONFIG_OPTIONAL "optional"
@@ -93,7 +93,9 @@ void osinfo_install_script_set_output_prefix(OsinfoInstallScript *script, const
const gchar *osinfo_install_script_get_output_prefix(OsinfoInstallScript *script);
-const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script);
+gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *script);
+
+const gchar *osinfo_install_script_get_expected_filename(OsinfoInstallScript *script);
void osinfo_install_script_generate_async(OsinfoInstallScript *script,
OsinfoOs *os,
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index ab507da..117cf55 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -620,7 +620,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
goto error;
if (value)
osinfo_entity_set_param(OSINFO_ENTITY(installScript),
- OSINFO_INSTALL_SCRIPT_PROP_OUTPUT_FILENAME,
+ OSINFO_INSTALL_SCRIPT_PROP_FILENAME,
value);
g_free(value);
--
1.7.12.1
More information about the virt-tools-list
mailing list