<libosinfo version="0.0.1">
  <!-- DESKTOP PROFILE -->
  <install-script id='http://microsoft.com/windows/cmd/desktop'>
    <profile>desktop</profile>
    <path-format>dos</path-format>
    <expected-filename>windows.cmd</expected-filename>
    <can-post-install-drivers/>
    <post-install-drivers-signing-req>strict</post-install-drivers-signing-req>
    <config>
      <param name="admin-password" policy="optional"/>
      <param name="user-realname" policy="required"/>
      <param name="avatar-location" policy="optional"/>
      <param name="avatar-disk" policy="optional"/>
      <param name="target-disk" policy="optional"/>
      <param name="script-disk" policy="optional"/>
      <param name="post-install-drivers-disk" policy="optional"/>
      <param name="post-install-drivers-location" policy="optional"/>
      <param name="driver-signing" policy="optional"/>
    </config>
    <injection-method>floppy</injection-method>
    <avatar-format>
      <mime-type>image/bmp</mime-type>
      <width>48</width>
      <height>48</height>
      <alpha>false</alpha>
    </avatar-format>
    <template>
      <xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">
        <xsl:output method="text"/>

        <xsl:template name="target-disk">
          <xsl:choose>
            <xsl:when test="config/target-disk != ''">
              <xsl:value-of select="config/target-disk"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>C</xsl:text>
            </xsl:otherwise>
          </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 name="post-install-drivers-disk">
          <xsl:choose>
            <xsl:when test="config/post-install-drivers-disk != ''">
              <xsl:value-of select="config/post-install-drivers-disk"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>A</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>

        <xsl:template name="avatar-destination">
          <xsl:call-template name="target-disk"/>
          <xsl:choose>
            <xsl:when test="os/version &lt; 6.0">
              <xsl:text>:\Documents and Settings\All Users\Application Data\Microsoft\User Account Pictures\</xsl:text>
              <xsl:value-of select="config/user-realname"/>
              <xsl:text>.bmp</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>:\ProgramData\Microsoft\User Account Pictures\user.bmp</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>

	<xsl:template match="/install-script-config">
<xsl:if test="os/version &lt; 6.0">
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
REGEDIT /S <xsl:call-template name="script-disk"/>:\windows.reg
</xsl:if>
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="avatar-destination"/>
<xsl:text>&#xa;</xsl:text>

<xsl:call-template name="post-install-drivers-disk"/>:
<xsl:if test="config/driver-signing = 'false' and os/version &gt; 5.1">
bcdedit.exe -set loadoptions DDISABLE_INTEGRITY_CHECKS
bcdedit.exe -set TESTSIGNING ON
</xsl:if>

for %%i in ("<xsl:call-template name="post-install-drivers-disk"/>:<xsl:value-of select="config/post-install-drivers-location"/>\*.cmd") do cmd /c %%i

EXIT
	</xsl:template>
      </xsl:stylesheet>
    </template>
  </install-script>
</libosinfo>
