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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux