[Libosinfo] [PATCH 1/2] win7, winxp, installer: 'ComputerName' must be <= 15 characters

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Mon May 12 15:38:34 UTC 2014


Since 'ComputerName' is supposed to be max 15 characters, unattended
installation breaks if this is set to a string longer than that. Lets crop the
string to ensure that doesn't happen.

http://technet.microsoft.com/en-us/library/ff715676.aspx
---
 data/install-scripts/windows-sif.xml      | 9 ++++++++-
 data/install-scripts/windows-unattend.xml | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/data/install-scripts/windows-sif.xml b/data/install-scripts/windows-sif.xml
index dc28533..71aa731 100644
--- a/data/install-scripts/windows-sif.xml
+++ b/data/install-scripts/windows-sif.xml
@@ -122,6 +122,13 @@
          </xsl:choose>
         </xsl:template>
 
+        <xsl:template name="computer-name">
+         <xsl:variable name="hostname">
+          <xsl:value-of select="config/hostname"/>
+         </xsl:variable>
+         <xsl:value-of select="substring($hostname, 1, 15)"/>
+        </xsl:template>
+
 	<xsl:template match="/install-script-config">
 ;SetupMgrTag
 [Data]
@@ -177,7 +184,7 @@
   </xsl:otherwise>
 </xsl:choose>
     FullName="<xsl:value-of select="config/user-realname"/>"
-    ComputerName="<xsl:value-of select="config/hostname"/>"
+    ComputerName="<xsl:call-template name="computer-name"/>"
 
 <xsl:if test="os/version = 5.0">
 [Display]
diff --git a/data/install-scripts/windows-unattend.xml b/data/install-scripts/windows-unattend.xml
index 046bf0f..3159281 100644
--- a/data/install-scripts/windows-unattend.xml
+++ b/data/install-scripts/windows-unattend.xml
@@ -305,6 +305,13 @@
        </xsl:choose>
      </xsl:template>
 
+     <xsl:template name="computer-name">
+       <xsl:variable name="hostname">
+         <xsl:value-of select="config/hostname"/>
+       </xsl:variable>
+       <xsl:value-of select="substring($hostname, 1, 15)"/>
+     </xsl:template>
+
      <xsl:template match="/install-script-config">
       <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
@@ -388,7 +395,7 @@
           <xsl:attribute name="processorArchitecture">
            <xsl:call-template name="arch"/>
           </xsl:attribute>
-          <ComputerName><xsl:value-of select="config/hostname"/></ComputerName>
+          <ComputerName><xsl:call-template name="computer-name"/></ComputerName>
          </component>
          <component name="Microsoft-Windows-Deployment" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
           <xsl:attribute name="processorArchitecture">
-- 
1.9.0




More information about the Libosinfo mailing list