Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 88015f5

Browse files
acasquetemolant
authored andcommitted
Added support for Packer 1.0 and W10 Creators Update
List of changes: * gitignore updates to avoid polluting bin/ folder and adding packermerge/packages folder * Answer file updated to win 1703 * Packer scripts updated to work with Packer 1.0 * Solved autounattend.xml issues in windows 10 (autologon) * VMSConfigGen, generator of VMS section for vmgen.json * Add Windows script to install the required applications for the build and execution of the whole project. Uses Chocolatey to install the apps. * Shell script to install the required programs using Homebrew * Update to vmware-windows10: Update vm hw to v12 * Files for win10 preview (build 16215) * Fix various minor issues and edge cases with vms.json * Attach vms.json to email notification * Add script to rename the os version in the output file vms.json * Add retry when the generation process fails one time.
1 parent f1ac02a commit 88015f5

38 files changed

+1949
-81
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*.md5.txt
55
*.zip.00?
66
!scripts/**/*.exe
7-
!bin/**/*.exe
7+
bin/
88
# Packer builder outputs
99
outputs/
1010
output-hyperv-iso/
@@ -16,15 +16,18 @@ output-parallels-pvm/
1616
*.box
1717
generated/
1818
vms/output/
19+
scripts/template-output/
1920

2021
*.user
2122
tools/VMSGen/VMSGen/obj/
2223
tools/VMSGen/VMSGen/bin/
2324
tools/VMSGen/packages/
25+
tools/PackerMerge/packages
2426
tools/PackerMerge/PackerMerge/bin/
2527
tools/PackerMerge/PackerMerge/obj/
2628
tools/PackerMerge/.vs/config/applicationhost.config
2729
tools/VMSGen/.vs/config/applicationhost.config
30+
tools/VMSConfigGen/VMSConfigGen/obj
2831

2932
*.suo
3033
bin/*.vshost.exe.*
@@ -35,4 +38,5 @@ scripts/vmgen.json
3538
scripts/floppy/build.cfg
3639
scripts/vmgen.log
3740
scripts/vmgen.cfg
41+
scripts/parallels-command.txt
3842
*.user

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Currently this process only works on Windows 8.1 machines.
1212

1313
## Software Requirements
1414
* Windows 8.1 (working on a solution that works for Windows 10)
15-
* [Packer 0.8.6 For Windows and Mac](https://packer.io/downloads.html) (It's an old version, we know)
15+
* [Packer 1.0.2 For Windows and Mac](https://packer.io/downloads.html)
1616
* [VirtualBox 5.0.2 for Windows hosts](https://www.virtualbox.org/wiki/Downloads)
1717
* [VMware Workstation](http://www.vmware.com/products/workstation)
1818
* Hyper-V
@@ -22,6 +22,12 @@ Currently this process only works on Windows 8.1 machines.
2222
* [Putty](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
2323
* [Visual Studio Community](https://www.visualstudio.com/downloads/)
2424

25+
### Automatic installation in Windows computers
26+
For an automatic installation of the required software you can use the script `.\scripts\apps\winappinstaller.ps1` It uses Chocolatey for installing the programs in the previous list. It is not recommended to use the script in machines that have already some of the programs installed manually. The purpose of the script is saving time in the installation in clean machines.
27+
28+
### Automatic installation in Mac computers
29+
Although in Mac only Packer and Parallels are required, you can install them automatically using the script `.\scripts\apps\macappinstaller.sh`. The script uses Homebrew to install the apps. Parallels will require in addition of the installation the registration of a valid key. In case packer is not installing correctly write in the terminal `brew install packer` to retry the installation.
30+
2531
## Preparing the Windows build environment
2632

2733
The following are the instructions to set up an environment almost fully automated. During the VM creation process sometimes the host needs to be rebooted or some permissions are required. If you don't some manual intervention you can skip some steps like AutoLogon, etc.
@@ -118,6 +124,11 @@ Turn Apple File Sharing on
118124
```
119125
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
120126
```
127+
Activate SMB
128+
129+
```
130+
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist
131+
```
121132

122133
Share Repository folder
123134

@@ -126,10 +137,12 @@ sudo sharing -a /Users/admin/dev.microsoftedge.com-vms/
126137
```
127138

128139
### Install Packer
140+
(Note: this step is not necessary if the script `.\scripts\apps\macappinstaller.sh` has been executed.)
129141

130142
Unzip Packer files to /Users/packer
131143

132144
### Set environment variable on OS X
145+
(Note: this step is not necessary if the script `.\scripts\apps\macappinstaller.sh` has been executed.)
133146

134147
* Open up Terminal.
135148
* Run the following command:
@@ -149,6 +162,8 @@ The Apple Mac OS X operating system has SSH installed by default but the SSH dae
149162

150163
To enable it, go to "System Preferences". Under "Internet & Networking" there is a "Sharing" icon. Run that. In the list that appears, check the "Remote Login" option.
151164

165+
**Important**: once SSH is enabled in the Mac, we have to connect to it manually by Putty SSH from the Windows computer prepared to initiate the process. This way the Mac is recognized by the Putty when the process is executed. If we do not register the Mac as an accepted connection, the SSH connection will show this error in the generation process `The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's rsa2 key finger (...) Connection abandoned.`
166+
152167
## Download Windows ISOs
153168

154169
This process uses ISOs, and more precisely the Client Enterprise Evaluation. You should legally get a copy of the iso for the guest you want to build and put it directly in the the `scripts\iso` folder.
@@ -181,8 +196,7 @@ This script requires a configuration file called `vmgen.json` located in the sam
181196
"SSH_User": "admin",
182197
"SSH_Password": "password",
183198
"NetworkPath": "\\\\MAC\\microsoftedge-vms",
184-
"RepoPath" : "/Users/admin/dev.microsoftedge.com-vms",
185-
"PackerPath" : "/Users/admin/packer"
199+
"RepoPath" : "/Users/admin/dev.microsoftedge.com-vms"
186200
},
187201
"Mail": {
188202
"SMTP": "smtp.office365.com",
@@ -191,6 +205,10 @@ This script requires a configuration file called `vmgen.json` located in the sam
191205
"User": "[email protected]",
192206
"Password": ""
193207
},
208+
"OsRenaming": {
209+
"Win10": "Win10 (x64) Build xxxx",
210+
"Win81": "Win81 (x86) Build yyyy"
211+
},
194212
"VMS": {
195213
"Windows": {
196214
"HyperV": {
@@ -233,6 +251,7 @@ This script requires a configuration file called `vmgen.json` located in the sam
233251
* AzureStorage - Contains the Url and the Key of de Azure Storage Account to upload de output files.
234252
* Mac - Contains IP, SSH User & password, and a shared path.
235253
* Mail - SMTP configuration to send emails to the appropriate people
254+
* OsRenaming (optional) - Indicates the final names desired in the output JSON for the os versions. Let's say that periodically we execute the process for the Win10 and we want in the output JSON the specific build version "Win10 (x64) build 2345". This renamed version of the output JSON is the one sent by mail. If a rename is not desired simply remove this section.
236255
* VMS - Object struct to set the dev.microsoftedge.com Virtual Machines to be generated. The valid values for each level are as follows:
237256

238257
* **First Level** - Windows, Mac
@@ -251,6 +270,18 @@ To upload the generated files after a build without regenerate de VMs, we need t
251270

252271
A JSON specific version will be generated in OutputPath. If you want your result to be merge with another file, place it in the same folder with the name vms.json.
253272

273+
### Renaming the os version in the output JSON
274+
275+
**Automatic renaming**: to rename the output JSON automatically in the process, just add the `OsRenaming` section in the vmgen file. When the generation process is executed, a copy of the output JSON with the renaming will be stored in the output path, inside the notification folder. This version is the one that will be sent by email to the configured mail receiver.
276+
277+
**Manual renaming**: if you want to rename the output JSON manually you can use the `scripts\vmsrename.ps1`. For instance if we want to change the value Win10 used in the generation process for an explicit name with build and architecture:
278+
279+
```
280+
.\vmsrename.ps1 "Win10" "Win10 (x86) Build 6307"
281+
```
282+
283+
The input file `vms.json` must be in the same folder as the script, and the output file will be `vms_renamed.json`.
284+
254285
## Generate a new OS template
255286

256287
To generate a new platform perform the following steps:

scripts/answer_files/10/autounattend.xml

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<unattend xmlns="urn:schemas-microsoft-com:unattend">
33
<servicing />
44
<settings pass="windowsPE">
@@ -45,8 +45,8 @@
4545
<InstallToAvailablePartition>false</InstallToAvailablePartition>
4646
<InstallFrom>
4747
<MetaData wcm:action="add">
48-
<Key>/IMAGE/INDEX</Key>
49-
<Value>1</Value>
48+
<Key>/IMAGE/NAME</Key>
49+
<Value>Windows 10 Enterprise Evaluation</Value>
5050
</MetaData>
5151
</InstallFrom>
5252
</OSImage>
@@ -64,7 +64,7 @@
6464
</component>
6565
</settings>
6666
<settings pass="offlineServicing">
67-
<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
67+
<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6868
<EnableLUA>false</EnableLUA>
6969
</component>
7070
</settings>
@@ -94,14 +94,6 @@
9494
<NetworkLocation>Home</NetworkLocation>
9595
<ProtectYourPC>1</ProtectYourPC>
9696
</OOBE>
97-
<AutoLogon>
98-
<Password>
99-
<Value>UABhAHMAcwB3ADAAcgBkACEAUABhAHMAcwB3AG8AcgBkAA==</Value>
100-
<PlainText>false</PlainText>
101-
</Password>
102-
<Username>IEUser</Username>
103-
<Enabled>true</Enabled>
104-
</AutoLogon>
10597
<FirstLogonCommands>
10698
<SynchronousCommand wcm:action="add">
10799
<CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
@@ -151,23 +143,58 @@
151143
<Description>Disable password expiration for IEUser user</Description>
152144
</SynchronousCommand>
153145
<SynchronousCommand wcm:action="add">
154-
<CommandLine>REG ADD &quot;HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff&quot;</CommandLine>
146+
<CommandLine>REG ADD "HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine>
155147
<Description>Disable set Network Location</Description>
156148
<Order>12</Order>
157149
<RequiresUserInput>true</RequiresUserInput>
158150
</SynchronousCommand>
159151
<SynchronousCommand wcm:action="add">
160-
<CommandLine> REG ADD HKLM\System\CurrentControlSet\Services\Netlogon\Parameters /v DisablePasswordChange /t REG_DWORD /d 2 /f</CommandLine>
152+
<CommandLine> REG ADD HKLM\System\CurrentControlSet\Services\Netlogon\Parameters /v DisablePasswordChange /t REG_DWORD /d 2 /f</CommandLine>
161153
<Description>Disable computer password change</Description>
162154
<Order>13</Order>
163155
<RequiresUserInput>true</RequiresUserInput>
164156
</SynchronousCommand>
157+
<SynchronousCommand wcm:action="add">
158+
<CommandLine>REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f</CommandLine>
159+
<Description>Disable UAC</Description>
160+
<RequiresUserInput>true</RequiresUserInput>
161+
<Order>14</Order>
162+
</SynchronousCommand>
163+
<SynchronousCommand wcm:action="add">
164+
<CommandLine>cmd.exe /c powershell -File a:\setautologon.ps1</CommandLine>
165+
<Description>Autologon</Description>
166+
<RequiresUserInput>true</RequiresUserInput>
167+
<Order>15</Order>
168+
</SynchronousCommand>
165169
<SynchronousCommand wcm:action="add">
166170
<CommandLine>wscript a:\install.vbs</CommandLine>
167171
<Description>Change background with System Information</Description>
168172
<RequiresUserInput>true</RequiresUserInput>
169-
<Order>14</Order>
173+
<Order>16</Order>
174+
</SynchronousCommand>
175+
<!-- Autologon entries for 1703-->
176+
<!--
177+
<SynchronousCommand wcm:action="add">
178+
<CommandLine> REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /t REG_SZ /d "1" /f</CommandLine>
179+
<Description>Enable autologon (fix for 1703) 1/4</Description>
180+
<RequiresUserInput>true</RequiresUserInput>
181+
<Order>80</Order>
170182
</SynchronousCommand>
183+
<SynchronousCommand wcm:action="add">
184+
<CommandLine>reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /t REG_SZ /d "Passw0rd!" /f</CommandLine>
185+
<Description>Enable autologon (fix for 1703) 2/4</Description>
186+
<RequiresUserInput>true</RequiresUserInput>
187+
<Order>81</Order>
188+
</SynchronousCommand>
189+
<SynchronousCommand wcm:action="add">
190+
<CommandLine>reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogonCount" /t REG_DWORD /d 10 /f</CommandLine>
191+
<Description>Enable autologon (fix for 1703) 4/4</Description>
192+
<RequiresUserInput>true</RequiresUserInput>
193+
<Order>83</Order>
194+
</SynchronousCommand>
195+
-->
196+
197+
<!-- End autologon -->
171198
<SynchronousCommand wcm:action="add">
172199
<CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine>
173200
<Order>98</Order>
@@ -181,6 +208,22 @@
181208
</SynchronousCommand>
182209
</FirstLogonCommands>
183210
<ShowWindowsLive>false</ShowWindowsLive>
211+
<AutoLogon>
212+
<Password>
213+
<Value>UABhAHMAcwB3ADAAcgBkACEAUABhAHMAcwB3AG8AcgBkAA==</Value>
214+
<PlainText>false</PlainText>
215+
</Password>
216+
<LogonCount>10</LogonCount>
217+
<Enabled>true</Enabled>
218+
<Username>IEUser</Username>
219+
</AutoLogon>
220+
</component>
221+
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
222+
<InputLocale>en-US</InputLocale>
223+
<SystemLocale>en-US</SystemLocale>
224+
<UILanguage>en-US</UILanguage>
225+
<UILanguageFallback>en-US</UILanguageFallback>
226+
<UserLocale>en-US</UserLocale>
184227
</component>
185228
</settings>
186229
<settings pass="specialize">
@@ -197,4 +240,5 @@
197240
<SkipAutoActivation>true</SkipAutoActivation>
198241
</component>
199242
</settings>
243+
<cpi:offlineImage cpi:source="wim:d:/iso/sources/install.wim#Windows 10 Enterprise Evaluation" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
200244
</unattend>

0 commit comments

Comments
 (0)