-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
107 lines (91 loc) · 4.35 KB
/
build.ps1
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
105
106
[cmdletbinding()]
param(
[switch]$Force,
[switch]$SkipAtlas,
[switch]$SkipVboxTools,
[ValidateSet("Win2012R2Core", "Win2012R2", "Win10", "Win2016StdCore","Win2016Std")]
$OSName
)
switch ($OSName)
{
'Win2012R2Core' {
$osData = @{
os_name = 'win2012r2core'
guest_os_type = 'Windows2012_64'
full_os_name = 'Windows2012R2Core'
iso_checksum = '849734f37346385dac2c101e4aacba4626bb141c'
iso_url = 'http://care.dlservice.microsoft.com/dl/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO'
}
}
'Win2012R2' {
$osData = @{
os_name = 'win2012r2'
guest_os_type = 'Windows2012_64'
full_os_name = 'Windows2012R2'
iso_checksum = '849734f37346385dac2c101e4aacba4626bb141c'
iso_url = 'http://care.dlservice.microsoft.com/dl/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO'
}
}
'Win2016StdCore' {
$osData = @{
os_name = 'win2016stdcore'
guest_os_type = 'Windows2012_64'
full_os_name = 'Windows2016StdCore'
iso_checksum = '3bb1c60417e9aeb3f4ce0eb02189c0c84a1c6691'
iso_url = 'http://care.dlservice.microsoft.com/dl/download/1/6/F/16FA20E6-4662-482A-920B-1A45CF5AAE3C/14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO'
}
}
'Win2016Std' {
$osData = @{
os_name = 'win2016std'
guest_os_type = 'Windows2012_64'
full_os_name = 'Windows2016'
iso_checksum = '3bb1c60417e9aeb3f4ce0eb02189c0c84a1c6691'
iso_url = 'http://care.dlservice.microsoft.com/dl/download/1/6/F/16FA20E6-4662-482A-920B-1A45CF5AAE3C/14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO'
}
}
'Win10' {
$osData = @{
os_name = 'win10'
guest_os_type = 'Windows10_64'
full_os_name = 'Windows10'
iso_checksum = '56ab095075be28a90bc0b510835280975c6bb2ce'
iso_url = 'http://care.dlservice.microsoft.com/dl/download/C/3/9/C399EEA8-135D-4207-92C9-6AAB3259F6EF/10240.16384.150709-1700.TH1_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO'
}
}
}
if($SkipVboxTools)
{
$osData.VboxCmd = "false"
}
else
{
$osData.VboxCmd = "true"
}
if ($Force)
{
$osData.ForceCmd = '-force'
}
else
{
$osData.ForceCmd = ''
}
Write-Output $osData | ConvertTo-Json
# Base Image and VirtualBox if enabled
Start-Process -FilePath 'packer.exe' -ArgumentList "build $($osData.ForceCmd) -var `"install_vbox_tools=$($osData.VboxCmd)`" -var `"os_name=$($osData.os_name)`" -var `"iso_checksum=$($osData.iso_checksum)`" -var `"iso_url=$($osData.iso_url)`" -var `"guest_os_type=$($osData.guest_os_type)`" .\01-windows-base.json" -Wait -NoNewWindow
# Installs Windows Updates and WMF5
Start-Process -FilePath 'packer.exe' -ArgumentList "build $($osData.ForceCmd) -var `"os_name=$($osData.os_name)`" -var `"source_path=.\output-$($osData.os_name)-base\$($osData.os_name)-base.ovf`" .\02-win_updates-wmf5.json" -Wait -NoNewWindow
# Install Octopus Deploy
Start-Process -FilePath 'packer.exe' -ArgumentList "build $($osData.ForceCmd) -var `"os_name=$($osData.os_name)`" -var `"source_path=.\output-$($osData.os_name)-updates_wmf5\$($osData.os_name)-updates_wmf5.ovf`" .\03-install_octopus.json" -Wait -NoNewWindow
# Cleanup
Start-Process -FilePath 'packer.exe' -ArgumentList "build $($osData.ForceCmd) -var `"os_name=$($osData.os_name)`" -var `"source_path=.\output-$($osData.os_name)-octopus\$($osData.os_name)-octopus.ovf`" .\04-cleanup.json" -Wait -NoNewWindow
if ($SkipAtlas)
{
# Vagrant Image Only
Start-Process -FilePath 'packer.exe' -ArgumentList "build $($osData.ForceCmd) -var `"os_name=$($osData.os_name)`" -var `"source_path=.\output-$($osData.os_name)-cleanup\$($osData.os_name)-cleanup.ovf`" .\05-local.json" -Wait -NoNewWindow
}
else
{
# Vagrant + Atlas
Start-Process -FilePath 'packer.exe' -ArgumentList "build $($osData.ForceCmd) -var `"os_name=$($osData.os_name)`" -var `"source_path=.\output-$($osData.os_name)-cleanup\$($osData.os_name)-cleanup.ovf`" -var `"full_os_name=$($osData.full_os_name)`" .\05-atlas.json" -Wait -NoNewWindow
}