[virt-tools-list] [libosinfo v5 04/12] Allow apps to specify install script disk
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Wed Nov 14 02:40:43 UTC 2012
From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
---
data/install-scripts/windows-cmd.xml | 14 +++++++++++++-
data/install-scripts/windows-sif.xml | 2 +-
osinfo/libosinfo.syms | 3 +++
osinfo/osinfo_install_config.c | 28 ++++++++++++++++++++++++++++
osinfo/osinfo_install_config.h | 5 +++++
5 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/data/install-scripts/windows-cmd.xml b/data/install-scripts/windows-cmd.xml
index 91f7716..19e3e8c 100644
--- a/data/install-scripts/windows-cmd.xml
+++ b/data/install-scripts/windows-cmd.xml
@@ -9,6 +9,7 @@
<param name="avatar-location" policy="optional"/>
<param name="avatar-disk" policy="optional"/>
<param name="target-disk" policy="optional"/>
+ <param name="script-disk" policy="optional"/>
</config>
<template filename="windows.cmd">
<xsl:stylesheet
@@ -27,13 +28,24 @@
</xsl:choose>
</xsl:template>
+ <xsl:template name="script-disk">
+ <xsl:choose>
+ <xsl:when test="config/script-disk != ''">
+ <xsl:value-of select="config/script-disk"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>A</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<xsl:template match="/install-script-config">
sc config TlntSvr start= auto
net user <xsl:value-of select="config/user-realname"/> <xsl:text> </xsl:text> <xsl:value-of select="config/admin-password"/> /add /passwordreq:no
net localgroup administrators <xsl:value-of select="config/user-realname"/> /add
net accounts /maxpwage:unlimited
if not "<xsl:value-of select="config/avatar-location"/>"=="" copy "<xsl:value-of select="config/avatar-disk"/>:\<xsl:value-of select="config/avatar-location"/>" "<xsl:call-template name="target-disk"/>:\Documents and Settings\All Users\Application Data\Microsoft\User Account Pictures\<xsl:value-of select="config/user-realname"/>.bmp"
-REGEDIT /S a:\windows.reg
+REGEDIT /S <xsl:call-template name="script-disk"/>:\windows.reg
EXIT
</xsl:template>
</xsl:stylesheet>
diff --git a/data/install-scripts/windows-sif.xml b/data/install-scripts/windows-sif.xml
index 635620f..da5fc46 100644
--- a/data/install-scripts/windows-sif.xml
+++ b/data/install-scripts/windows-sif.xml
@@ -176,7 +176,7 @@
<xsl:if test="os/version > 5.0">
[SetupParams]
- UserExecute = "a:\windows.cmd"
+ UserExecute = "<xsl:value-of select="config/script-disk"/>:\windows.cmd"
[WindowsFirewall]
Profiles = WindowsFirewall.TurnOffFirewall
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index c67235e..de33a70 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -333,6 +333,9 @@ LIBOSINFO_0.2.2 {
osinfo_install_config_get_target_disk;
osinfo_install_config_set_target_disk;
+ osinfo_install_config_get_script_disk;
+ osinfo_install_config_set_script_disk;
+
osinfo_install_script_get_path_format;
} LIBOSINFO_0.2.1;
diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c
index b1874ef..f146aec 100644
--- a/osinfo/osinfo_install_config.c
+++ b/osinfo/osinfo_install_config.c
@@ -362,6 +362,34 @@ const gchar *osinfo_install_config_get_target_disk(OsinfoInstallConfig *config)
}
/**
+ * osinfo_install_config_set_script_disk:
+ *
+ * Sets the #OSINFO_INSTALL_CONFIG_PROP_SCRIPT_DISK parameter.
+ *
+ * Please read documentation on #osinfo_install_config_set_target_disk() for
+ * explanation on the format of @disk string.
+ */
+void osinfo_install_config_set_script_disk(OsinfoInstallConfig *config,
+ const gchar *disk)
+{
+ osinfo_entity_set_param(OSINFO_ENTITY(config),
+ OSINFO_INSTALL_CONFIG_PROP_SCRIPT_DISK,
+ disk);
+}
+
+/**
+ * osinfo_install_config_get_script_disk:
+ *
+ * Returns: The value of #OSINFO_INSTALL_CONFIG_PROP_SCRIPT_DISK parameter,
+ * or NULL.
+ */
+const gchar *osinfo_install_config_get_script_disk(OsinfoInstallConfig *config)
+{
+ return osinfo_entity_get_param_value(OSINFO_ENTITY(config),
+ OSINFO_INSTALL_CONFIG_PROP_SCRIPT_DISK);
+}
+
+/**
* osinfo_install_config_set_avatar_location:
*
* Sets the #OSINFO_INSTALL_CONFIG_PROP_AVATAR_LOCATION parameter.
diff --git a/osinfo/osinfo_install_config.h b/osinfo/osinfo_install_config.h
index cf5b455..788d464 100644
--- a/osinfo/osinfo_install_config.h
+++ b/osinfo/osinfo_install_config.h
@@ -56,6 +56,7 @@
#define OSINFO_INSTALL_CONFIG_PROP_HOSTNAME "hostname"
#define OSINFO_INSTALL_CONFIG_PROP_TARGET_DISK "target-disk"
+#define OSINFO_INSTALL_CONFIG_PROP_SCRIPT_DISK "script-disk"
#define OSINFO_INSTALL_CONFIG_PROP_AVATAR_LOCATION "avatar-location"
#define OSINFO_INSTALL_CONFIG_PROP_AVATAR_DISK "avatar-disk"
@@ -159,6 +160,10 @@ void osinfo_install_config_set_target_disk(OsinfoInstallConfig *config,
const gchar *disk);
const gchar *osinfo_install_config_get_target_disk(OsinfoInstallConfig *config);
+void osinfo_install_config_set_script_disk(OsinfoInstallConfig *config,
+ const gchar *disk);
+const gchar *osinfo_install_config_get_script_disk(OsinfoInstallConfig *config);
+
void osinfo_install_config_set_avatar_location(OsinfoInstallConfig *config,
const gchar *location);
const gchar *osinfo_install_config_get_avatar_location(OsinfoInstallConfig *config);
--
1.8.0
More information about the virt-tools-list
mailing list