-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_10.json
executable file
·104 lines (104 loc) · 5.35 KB
/
windows_10.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{
"variables": {
"username": "{{env `WINRM_USERNAME`}}",
"password": "{{env `WINRM_PASSWORD`}}",
"skip_window_updates": "{{env `SKIP_WINDOWS_UPDATES`}}"
},
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"communicator": "winrm",
"winrm_username": "{{user `username`}}",
"winrm_password": "{{user `password`}}",
"shutdown_command": "shutdown /s /t 30 /f /d p:4:1 /c \"Packer is shutting down Windows\"",
"guest_os_type": "Windows10_64",
"disk_size": 40960,
"vm_name": "windows10-{{build_type}}-{{timestamp}}",
"output_directory": "packer-output",
"format": "ova",
"guest_additions_mode": "attach",
"virtualbox_version_file": "",
"floppy_files": [
"./answerfiles/windows10/Autounattend.xml",
"./scripts/fixnetwork.ps1",
"./scripts/oracle-cert.cer",
"./scripts/silent.config"
],
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"],
["modifyvm", "{{.Name}}", "--vram", "64"],
["modifyvm", "{{.Name}}", "--hpet", "on"],
["setextradata", "{{.Name}}", "CustomVideoMode1", "1600x1200x32"]
]
}
],
"provisioners": [
{
"type": "powershell",
"inline": [
"[System.Net.ServicePointManager]::SecurityProtocol = \"Ssl3, Tls,Tls11,Tls12\"",
"(New-Object Net.WebClient).DownloadFile('{{user `url_firefox`}}', \"$Env:USERPROFILE\\Downloads\\FirefoxSetup.exe\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_7zip`}}', \"$Env:USERPROFILE\\Downloads\\7ZipSetup.exe\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_git`}}', \"$Env:USERPROFILE\\Downloads\\GitSetup.exe\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_vscode`}}', \"$Env:USERPROFILE\\Downloads\\VSCodeSetup.exe\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_python`}}', \"$Env:USERPROFILE\\Downloads\\PythonSetup.msi\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_intellij`}}', \"$Env:USERPROFILE\\Downloads\\IdeaSetup.exe\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_maven`}}', \"$Env:USERPROFILE\\Downloads\\apache-maven.zip\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_jdk`}}', \"$Env:USERPROFILE\\Downloads\\AdoptOpenJDK.msi\")",
"(New-Object Net.WebClient).DownloadFile('{{user `url_sysinternals`}}', \"$Env:USERPROFILE\\Downloads\\SysinternalsSuite.zip\")"
]
},
{
"type": "windows-shell",
"inline": [
"start /B /WAIT \"Install Firefox\" \"%USERPROFILE%\\Downloads\\FirefoxSetup.exe\" -ms",
"start /B /WAIT \"Install 7-Zip\" \"%USERPROFILE%\\Downloads\\7ZipSetup.exe\" /S",
"start /B /WAIT \"Install Git\" \"%USERPROFILE%\\Downloads\\GitSetup.exe\" /VERYSILENT /NORESTART",
"start /B /WAIT \"Install VS Code\" \"%USERPROFILE%\\Downloads\\VSCodeSetup.exe\" /VERYSILENT /NORESTART /MERGETASKS='!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath'",
"start /B /WAIT \"Install Python\" msiexec.exe /i \"%USERPROFILE%\\Downloads\\PythonSetup.msi\" /qn /norestart",
"start /B /WAIT \"Install IntelliJ\" \"%USERPROFILE%\\Downloads\\IdeaSetup.exe\" /S /CONFIG=A:\\silent.config /LOG=\"%TEMP%\\IdeaSetup.log\"",
"start /B /WAIT \"Install JDK\" msiexec /i \"%USERPROFILE%\\Downloads\\AdoptOpenJDK.msi\" ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome INSTALLDIR=\"%PROGRAMFILES%\\AdoptOpenJDK\\\" /qn /norestart",
"\"%PROGRAMFILES%\\7-Zip\\7z.exe\" x \"%USERPROFILE%\\Downloads\\apache-maven.zip\" -o\"%PROGRAMFILES%\" -y",
"move \"%PROGRAMFILES%\\apache-maven*\" \"%PROGRAMFILES%\\apache-maven\"",
"setx /M PATH \"%PATH%;%PROGRAMFILES%\\7-Zip;%SYSTEMDRIVE%\\Python27;%PROGRAMFILES%\\apache-maven\\bin;%PROGRAMFILES%\\AdoptOpenJDK\\bin\""
]
},
{
"type": "powershell",
"elevated_user": "{{user `username`}}",
"elevated_password": "{{user `password`}}",
"environment_vars": "SKIP_WINDOWS_UPDATES={{user `skip_window_updates`}}",
"script": "scripts/Install-WindowsUpdates.ps1"
},
{
"type": "windows-restart",
"restart_command": "powershell -Command \"& {(Get-WmiObject Win32_OperatingSystem).LastBootUpTime > \"$Env:TEMP\\lastboot.txt\"; Restart-Computer -Force}\"",
"restart_check_command": "powershell -Command \"& {if ((Get-Content \"$Env:TEMP\\lastboot.txt\") -eq (Get-WmiObject Win32_OperatingSystem).LastBootUpTime) {Write-Output 'Not restarted yet, sleep for 720 s.'; Start-Sleep 720} else {Write-Output 'Reboot complete'}}\"",
"restart_timeout": "15m"
},
{
"type": "windows-shell",
"pause_before": "1m",
"scripts": [
"scripts/installSysinternals.bat",
"scripts/configureInternetExplorer.bat",
"scripts/configureFirefox.bat"
]
},
{
"type": "windows-shell",
"inline": [
"reg add \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\" /v NoAutoUpdate /t REG_DWORD /d 1 /f"
]
},
{
"type": "windows-shell",
"script": "scripts/cleanup.bat"
}
]
}