[Libosinfo] [PATCH v2] win8: Add install script

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Wed Jan 9 01:19:09 UTC 2013


From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>

Using the desktop profile, I was able to do an express installation
against GNOME Boxes.

I'm adding a seperate script for windows 8 rather than re-using the
existing unattended.xml we have for windows 7 because windows 8 requires
product key to be specified while it remains optional for windows 7.
---
 data/install-scripts/Makefile.am            |   1 +
 data/install-scripts/windows-8-unattend.xml | 419 ++++++++++++++++++++++++++++
 data/oses/windows.xml.in                    |   3 +-
 3 files changed, 422 insertions(+), 1 deletion(-)
 create mode 100644 data/install-scripts/windows-8-unattend.xml

diff --git a/data/install-scripts/Makefile.am b/data/install-scripts/Makefile.am
index cb24e09..29715d2 100644
--- a/data/install-scripts/Makefile.am
+++ b/data/install-scripts/Makefile.am
@@ -6,6 +6,7 @@ database_DATA =     \
   windows-cmd.xml   \
   windows-reg.xml   \
   windows-unattend.xml \
+  windows-8-unattend.xml \
   $(NULL)
 
 EXTRA_DIST = $(database_DATA)
diff --git a/data/install-scripts/windows-8-unattend.xml b/data/install-scripts/windows-8-unattend.xml
new file mode 100644
index 0000000..cc6472b
--- /dev/null
+++ b/data/install-scripts/windows-8-unattend.xml
@@ -0,0 +1,419 @@
+<libosinfo version="0.0.1">
+  <install-script id='http://microsoft.com/windows/8/unattend/jeos'>
+    <profile>jeos</profile>
+    <path-format>dos</path-format>
+    <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format>
+   <expected-filename>autounattend.xml</expected-filename>
+   <can-pre-install-drivers>true</can-pre-install-drivers>
+    <config>
+      <param name="admin-password" policy="optional"/>
+      <param name="hardware-arch" policy="optional"/>
+      <param name="l10n-language" policy="optional" value-map="http://microsoft.com/win/8/l10n-language-reverse"/>
+      <param name="user-login" policy="optional"/>
+      <param name="user-password" policy="optional"/>
+      <param name="user-realname" policy="optional"/>
+      <param name="reg-product-key" policy="required"/>
+      <param name="target-disk" policy="optional"/>
+      <param name="pre-install-drivers-disk" policy="optional"/>
+      <param name="pre-install-drivers-location" policy="optional"/>
+    </config>
+    <template>
+      <xsl:stylesheet
+        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+        version="1.0">
+
+        <xsl:output method="xml" indent="yes"/>
+
+        <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="arch">
+	  <xsl:choose>
+	    <xsl:when test="count(config/hardware-arch) > 0">
+	      <xsl:value-of select="config/hardware-arch"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>x86</xsl:text>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:template>
+
+        <xsl:template name="pre-install-drivers-disk">
+          <xsl:choose>
+            <xsl:when test="config/pre-install-drivers-disk != ''">
+              <xsl:value-of select="config/pre-install-drivers-disk"/>
+            </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>A</xsl:text>
+	    </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
+        <xsl:template name="pre-install-drivers-location">
+          <xsl:choose>
+            <xsl:when test="config/pre-install-drivers-location != ''">
+              <xsl:value-of select="config/pre-install-drivers-location"/>
+            </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:text>\</xsl:text>
+	    </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
+	<xsl:template match="/install-script-config">
+	  <unattend xmlns="urn:schemas-microsoft-com:unattend">
+	    <settings pass="windowsPE">
+              <component name="Microsoft-Windows-PnpCustomizationsWinPE" 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">
+                  <xsl:call-template name="arch"/>
+                </xsl:attribute>
+                <DriverPaths>
+                  <PathAndCredentials wcm:keyValue="1" wcm:action="add">
+                    <Path><xsl:call-template name="pre-install-drivers-disk"/>:<xsl:call-template name="pre-install-drivers-location"/></Path>
+                  </PathAndCredentials>
+                </DriverPaths>
+              </component>
+	      <component name="Microsoft-Windows-Setup" 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">
+		  <xsl:call-template name="arch"/>
+		</xsl:attribute>
+		<DiskConfiguration>
+		  <WillShowUI>OnError</WillShowUI>
+		  <Disk>
+		    <CreatePartitions>
+		      <CreatePartition>
+			<Order>1</Order>
+			<Size>1</Size>
+			<Type>Primary</Type>
+		      </CreatePartition>
+		    </CreatePartitions>
+		    <DiskID>0</DiskID>
+		    <WillWipeDisk>true</WillWipeDisk>
+		    <ModifyPartitions>
+		      <ModifyPartition>
+			<Active>true</Active>
+			<Extend>true</Extend>
+			<Format>NTFS</Format>
+                        <Label><xsl:call-template name="target-disk"/> drive</Label>
+                        <Letter><xsl:call-template name="target-disk"/></Letter>
+			<Order>1</Order>
+			<PartitionID>1</PartitionID>
+		      </ModifyPartition>
+		    </ModifyPartitions>
+		  </Disk>
+		</DiskConfiguration>
+		<ImageInstall>
+		  <OSImage>
+		    <InstallTo>
+		      <DiskID>0</DiskID>
+		      <PartitionID>1</PartitionID>
+		    </InstallTo>
+		    <WillShowUI>OnError</WillShowUI>
+		  </OSImage>
+		</ImageInstall>
+		<UserData>
+		  <AcceptEula>true</AcceptEula>
+                  <ProductKey>
+                    <Key><xsl:value-of select="config/reg-product-key"/></Key>
+                  </ProductKey>
+		</UserData>
+	      </component>
+	      <component name="Microsoft-Windows-International-Core-WinPE" 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">
+		  <xsl:call-template name="arch"/>
+		</xsl:attribute>
+		<SetupUILanguage>
+		  <UILanguage><xsl:value-of select="config/l10n-language"/></UILanguage>
+		</SetupUILanguage>
+		<SystemLocale><xsl:value-of select="config/l10n-language"/></SystemLocale>
+		<UILanguage><xsl:value-of select="config/l10n-language"/></UILanguage>
+		<UserLocale><xsl:value-of select="config/l10n-language"/></UserLocale>
+	      </component>
+	    </settings>
+	    <settings pass="oobeSystem">
+	      <component name="Microsoft-Windows-Shell-Setup" 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">
+		  <xsl:call-template name="arch"/>
+		</xsl:attribute>
+		<UserAccounts>
+		  <AdministratorPassword>
+		    <Value><xsl:value-of select="config/admin-password"/></Value>
+		    <PlainText>true</PlainText>
+		  </AdministratorPassword>
+
+		  <xsl:if test="count(config/user-login) > 0">
+		    <LocalAccounts>
+		      <LocalAccount wcm:action="add">
+			<Password>
+			  <Value><xsl:value-of select="config/user-password"/></Value>
+			  <PlainText>false</PlainText>
+			</Password>
+			<Name><xsl:value-of select="config/user-login"/></Name>
+			<DisplayName><xsl:value-of select="config/user-realname"/></DisplayName>
+			<Group>users</Group>
+		      </LocalAccount>
+		    </LocalAccounts>
+		  </xsl:if>
+		</UserAccounts>
+		<xsl:if test="count(config/user-login) > 0">
+		  <AutoLogon>
+		    <Password>
+		      <Value><xsl:value-of select="config/user-password"/></Value>
+		      <PlainText>true</PlainText>
+		    </Password>
+		    <Enabled>true</Enabled>
+		    <LogonCount>5</LogonCount>
+		    <Username><xsl:value-of select="config/user-login"/></Username>
+		  </AutoLogon>
+		</xsl:if>
+		<OOBE>
+		  <NetworkLocation>Work</NetworkLocation>
+		  <HideEULAPage>true</HideEULAPage>
+		  <ProtectYourPC>3</ProtectYourPC>
+		  <SkipMachineOOBE>true</SkipMachineOOBE>
+		  <SkipUserOOBE>true</SkipUserOOBE>
+		</OOBE>
+		<FirstLogonCommands>
+		  <SynchronousCommand wcm:action="add">
+		    <Order>1</Order>
+		    <Description>Turn Off Network Selection pop-up</Description>
+		    <CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine>
+		  </SynchronousCommand>
+		  <SynchronousCommand wcm:action="add">
+		    <Order>2</Order>
+		    <Description>Shutting down Windows</Description>
+		    <CommandLine>cmd /C shutdown /s /t 0</CommandLine>
+		  </SynchronousCommand>
+		</FirstLogonCommands>
+	      </component>
+	    </settings>
+	  </unattend>
+	</xsl:template>
+      </xsl:stylesheet>
+    </template>
+  </install-script>
+
+  <!-- DESKTOP PROFILE -->
+  <install-script id='http://microsoft.com/windows/8/unattend/desktop'>
+   <profile>desktop</profile>
+   <path-format>dos</path-format>
+   <product-key-format>$$$$$-$$$$$-$$$$$-$$$$$-$$$$$</product-key-format>
+   <expected-filename>autounattend.xml</expected-filename>
+   <can-pre-install-drivers>true</can-pre-install-drivers>
+   <config>
+    <param name="admin-password" policy="optional"/>
+    <param name="hardware-arch" policy="required"/>
+    <param name="l10n-language" policy="optional" value-map="http://microsoft.com/win/8/l10n-language-reverse"/>
+    <param name="user-login" policy="optional"/>
+    <param name="user-password" policy="optional"/>
+    <param name="user-realname" policy="optional"/>
+    <param name="hostname" policy="required"/>
+    <param name="reg-product-key" policy="required"/>
+    <param name="target-disk" policy="optional"/>
+    <param name="pre-install-drivers-disk" policy="optional"/>
+    <param name="pre-install-drivers-location" policy="optional"/>
+   </config>
+    <template>
+     <xsl:stylesheet
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+      version="1.0">
+
+      <xsl:output method="xml" indent="yes"/>
+
+      <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="arch">
+       <xsl:choose>
+        <xsl:when test="config/hardware-arch = 'x86_64'">
+         <xsl:text>amd64</xsl:text>
+        </xsl:when>
+        <xsl:when test="config/hardware-arch = 'i386'">
+         <xsl:text>x86</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:text>x86</xsl:text>
+        </xsl:otherwise>
+       </xsl:choose>
+     </xsl:template>
+
+     <xsl:template name="pre-install-drivers-disk">
+       <xsl:choose>
+         <xsl:when test="config/pre-install-drivers-disk != ''">
+           <xsl:value-of select="config/pre-install-drivers-disk"/>
+         </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:text>A</xsl:text>
+	 </xsl:otherwise>
+       </xsl:choose>
+     </xsl:template>
+
+     <xsl:template name="pre-install-drivers-location">
+       <xsl:choose>
+         <xsl:when test="config/pre-install-drivers-location != ''">
+           <xsl:value-of select="config/pre-install-drivers-location"/>
+         </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:text>\</xsl:text>
+	 </xsl:otherwise>
+       </xsl:choose>
+     </xsl:template>
+
+     <xsl:template match="/install-script-config">
+      <unattend xmlns="urn:schemas-microsoft-com:unattend">
+       <settings pass="windowsPE">
+         <component name="Microsoft-Windows-PnpCustomizationsWinPE" 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">
+             <xsl:call-template name="arch"/>
+           </xsl:attribute>
+           <DriverPaths>
+             <PathAndCredentials wcm:keyValue="1" wcm:action="add">
+               <Path><xsl:call-template name="pre-install-drivers-disk"/>:<xsl:call-template name="pre-install-drivers-location"/></Path>
+             </PathAndCredentials>
+           </DriverPaths>
+        </component>
+        <component name="Microsoft-Windows-Setup" 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">
+          <xsl:call-template name="arch"/>
+         </xsl:attribute>
+         <DiskConfiguration>
+          <WillShowUI>OnError</WillShowUI>
+          <Disk>
+           <CreatePartitions>
+            <CreatePartition>
+             <Order>1</Order>
+             <Size>1</Size>
+             <Type>Primary</Type>
+            </CreatePartition>
+           </CreatePartitions>
+           <DiskID>0</DiskID>
+           <WillWipeDisk>true</WillWipeDisk>
+           <ModifyPartitions>
+            <ModifyPartition>
+             <Active>true</Active>
+             <Extend>true</Extend>
+             <Format>NTFS</Format>
+             <Label><xsl:call-template name="target-disk"/> drive</Label>
+             <Letter><xsl:call-template name="target-disk"/></Letter>
+             <Order>1</Order>
+             <PartitionID>1</PartitionID>
+            </ModifyPartition>
+           </ModifyPartitions>
+          </Disk>
+         </DiskConfiguration>
+         <ImageInstall>
+          <OSImage>
+           <InstallTo>
+            <DiskID>0</DiskID>
+            <PartitionID>1</PartitionID>
+           </InstallTo>
+           <WillShowUI>OnError</WillShowUI>
+          </OSImage>
+         </ImageInstall>
+         <UserData>
+          <AcceptEula>true</AcceptEula>
+          <ProductKey>
+           <Key><xsl:value-of select="config/reg-product-key"/></Key>
+          </ProductKey>
+         </UserData>
+        </component>
+        <component name="Microsoft-Windows-International-Core-WinPE" 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">
+          <xsl:call-template name="arch"/>
+         </xsl:attribute>
+         <SetupUILanguage>
+          <UILanguage><xsl:value-of select="config/l10n-language"/></UILanguage>
+         </SetupUILanguage>
+         <SystemLocale><xsl:value-of select="config/l10n-language"/></SystemLocale>
+         <UILanguage><xsl:value-of select="config/l10n-language"/></UILanguage>
+         <UserLocale><xsl:value-of select="config/l10n-language"/></UserLocale>
+        </component>
+       </settings>
+       <xsl:if test="os/version > 6.0">
+        <settings pass="specialize">
+         <component name="Microsoft-Windows-Shell-Setup" 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">
+           <xsl:call-template name="arch"/>
+          </xsl:attribute>
+          <ComputerName><xsl:value-of select="config/hostname"/></ComputerName>
+         </component>
+        </settings>
+       </xsl:if>
+       <settings pass="oobeSystem">
+        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="BOXES_CPU" 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">
+          <xsl:call-template name="arch"/>
+         </xsl:attribute>
+         <UserAccounts>
+          <AdministratorPassword>
+           <Value><xsl:value-of select="config/admin-password"/></Value>
+           <PlainText>true</PlainText>
+          </AdministratorPassword>
+          <xsl:if test="count(config/user-login) > 0">
+           <LocalAccounts>
+            <LocalAccount wcm:action="add">
+             <Password>
+              <Value><xsl:value-of select="config/user-password"/></Value>
+              <PlainText>true</PlainText>
+             </Password>
+             <Description><xsl:value-of select="config/user-realname"/></Description>
+             <DisplayName><xsl:value-of select="config/user-realname"/></DisplayName>
+             <Group>Administrators;Power Users</Group>
+             <Name><xsl:value-of select="config/user-login"/></Name>
+            </LocalAccount>
+           </LocalAccounts>
+         </xsl:if>
+         </UserAccounts>
+         <xsl:if test="count(config/user-login) > 0">
+          <AutoLogon>
+           <Password>
+            <Value><xsl:value-of select="config/user-password"/></Value>
+            <PlainText>true</PlainText>
+           </Password>
+           <Enabled>true</Enabled>
+           <LogonCount>5</LogonCount>
+           <Username><xsl:value-of select="config/user-login"/></Username>
+          </AutoLogon>
+         </xsl:if>
+         <OOBE>
+          <xsl:if test="os/version > 6.0">
+           <NetworkLocation>Work</NetworkLocation>
+           <SkipMachineOOBE>true</SkipMachineOOBE>
+           <SkipUserOOBE>true</SkipUserOOBE>
+          </xsl:if>
+          <HideEULAPage>true</HideEULAPage>
+          <ProtectYourPC>3</ProtectYourPC>
+         </OOBE>
+         <xsl:if test="os/version > 6.0">
+          <FirstLogonCommands>
+           <SynchronousCommand wcm:action="add">
+            <Order>1</Order>
+            <Description>Turn Off Network Selection pop-up</Description>
+            <CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine>
+           </SynchronousCommand>
+          </FirstLogonCommands>
+         </xsl:if>
+        </component>
+       </settings>
+      </unattend>
+     </xsl:template>
+    </xsl:stylesheet>
+   </template>
+  </install-script>
+</libosinfo>
diff --git a/data/oses/windows.xml.in b/data/oses/windows.xml.in
index 310de62..364fcaa 100644
--- a/data/oses/windows.xml.in
+++ b/data/oses/windows.xml.in
@@ -822,7 +822,8 @@
     </devices>
 
     <installer>
-      <script id='http://microsoft.com/windows/unattend'/>
+      <script id='http://microsoft.com/windows/8/unattend/jeos'/>
+      <script id='http://microsoft.com/windows/8/unattend/desktop'/>
     </installer>
   </os>
 
-- 
1.8.0.2




More information about the Libosinfo mailing list