Skip to content

Commit c09ca0a

Browse files
committed
R2024a release!
1 parent dfef0bf commit c09ca0a

20 files changed

+5145
-2314
lines changed

packer/v1/build-matlab-ami.pkr.hcl

+15-5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ variable "BUILD_SCRIPTS" {
3535
"Install-StartupScripts.ps1",
3636
"Install-NVIDIADrivers.ps1",
3737
"Install-Dependencies.ps1",
38+
"Install-MATLABProxy.ps1",
3839
"Install-MATLAB.ps1",
3940
"Remove-IE.ps1"
4041
]
@@ -50,9 +51,10 @@ variable "STARTUP_SCRIPTS" {
5051
"20_Set-AdminPassword.ps1",
5152
"30_Initialize-CloudWatchLogging.ps1",
5253
"40_Set-DDUX.ps1",
53-
"50_Set-MATLABLicense.ps1",
54-
"60_Invoke-MATLABStartupAccelerator.ps1",
55-
"70_Invoke-MSHStartupAccelerator.ps1",
54+
"50_Setup-MATLABProxy.ps1",
55+
"60_Set-MATLABLicense.ps1",
56+
"70_Invoke-MATLABStartupAccelerator.ps1",
57+
"80_Invoke-MSHStartupAccelerator.ps1",
5658
"99_Invoke-OptionalUserCommand.ps1"
5759
]
5860
description = "The list of startup scripts Packer will copy to the remote machine image builder, which can be used during the CloudFormation Stack creation."
@@ -61,7 +63,9 @@ variable "STARTUP_SCRIPTS" {
6163
variable "RUNTIME_SCRIPTS" {
6264
type = list(string)
6365
default = [
64-
"Install-NVIDIAGridDriver.ps1"
66+
"Install-NVIDIAGridDriver.ps1",
67+
"Start-MATLABProxy.ps1",
68+
"generate-certificate.py"
6569
]
6670
description = "The list of runtime scripts Packer will copy to the remote machine image builder, which can be used after the CloudFormation Stack creation."
6771
}
@@ -161,6 +165,11 @@ variable "AWS_INSTANCE_PROFILE" {
161165
description = "The AWS instance profile role used during Packer builds."
162166
}
163167

168+
variable "MATLAB_PROXY_VERSION" {
169+
type = string
170+
default = "0.10.0"
171+
description = "The matlab-proxy version to use."
172+
}
164173

165174
# Set up local variables used by provisioners.
166175
locals {
@@ -249,7 +258,8 @@ build {
249258
"NVIDIA_DRIVER_INSTALLER_URL=${var.NVIDIA_DRIVER_INSTALLER_URL}",
250259
"DCV_INSTALLER_URL=${var.DCV_INSTALLER_URL}",
251260
"PYTHON_INSTALLER_URL=${var.PYTHON_INSTALLER_URL}",
252-
"MATLAB_SOURCE_URL=${var.MATLAB_SOURCE_URL}"
261+
"MATLAB_SOURCE_URL=${var.MATLAB_SOURCE_URL}",
262+
"MATLAB_PROXY_VERSION=${var.MATLAB_PROXY_VERSION}"
253263
]
254264
scripts = "${local.build_scripts}"
255265
}
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<#
2+
.SYNOPSIS
3+
Installs the matlab-proxy Python package.
4+
5+
.DESCRIPTION
6+
Installs the matlab-proxy Python package.
7+
8+
.PARAMETER Version
9+
matlab-proxy version number. e.g. 0.10.0
10+
11+
.EXAMPLE
12+
Install-MATLABProxy -Version "0.10.0"
13+
14+
.LINK
15+
https://github.com/mathworks/matlab-proxy
16+
17+
.NOTES
18+
Copyright 2024 The MathWorks Inc.
19+
The function sets $ErrorActionPreference to 'Stop' to ensure that any errors encountered during the installation process will cause the script to stop and throw an error.
20+
#>
21+
22+
function Install-MATLABProxy {
23+
24+
param(
25+
[Parameter(Mandatory = $true)]
26+
[string] $Version
27+
)
28+
29+
Write-Output 'Starting Install-MATLABProxy...'
30+
& $Env:ProgramFiles\Python310\python.exe -m pip install matlab-proxy==$Version
31+
32+
Write-Output 'Moving the SSL certificate generator and launcher script to the right directory...'
33+
$RuntimeSource = 'C:\Windows\Temp\runtime'
34+
35+
$DestinationFolder = "$Env:ProgramFiles\MathWorks\matlab-proxy"
36+
37+
New-Item $DestinationFolder -Type Directory
38+
Copy-Item "$RuntimeSource\Start-MatlabProxy.ps1" -Destination "$DestinationFolder\Start-MatlabProxy.ps1"
39+
Copy-Item "$RuntimeSource\generate-certificate.py" -Destination "$DestinationFolder\generate-certificate.py"
40+
41+
Write-Output 'Done with Install-MATLABProxy.'
42+
}
43+
44+
try {
45+
$ErrorActionPreference = 'Stop'
46+
Install-MATLABProxy -Version $Env:MATLAB_PROXY_VERSION
47+
}
48+
catch {
49+
$ScriptPath = $MyInvocation.MyCommand.Path
50+
Write-Output "ERROR - An error occurred while running script: $ScriptPath. Error: $_"
51+
throw
52+
}

packer/v1/build/Remove-TemporaryFiles.ps1

+1-14
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@
1313
The function sets $ErrorActionPreference to 'Stop' to ensure that any errors encountered during the installation process will cause the script to stop and throw an error.
1414
#>
1515

16-
function Uninstall-Python {
17-
Write-Output 'Removing the Python installation used for executing build tools'
18-
19-
Write-Output 'Starting Uninstall-Python...'
20-
21-
wmic product where "Name like 'Python%'" call uninstall /nointeractive
22-
23-
Remove-Item 'C:\Program Files\Python310' -Force -Recurse
24-
25-
Write-Output 'Done with Uninstall-Python.'
26-
}
27-
2816
function Remove-TemporaryBuildFiles {
2917
Write-Output 'Starting Remove-TemporaryBuildFiles...'
3018

@@ -57,12 +45,11 @@ function Clear-TemporaryLogContents {
5745

5846
try {
5947
$ErrorActionPreference = 'Stop'
60-
Uninstall-Python
6148
Remove-TemporaryBuildFiles
6249
Clear-TemporaryLogContents
6350
}
6451
catch {
6552
$ScriptPath = $MyInvocation.MyCommand.Path
6653
Write-Output "ERROR - An error occurred while running script 'Remove-TemporaryFiles': $ScriptPath. Error: $_"
6754
throw
68-
}
55+
}

0 commit comments

Comments
 (0)