-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-matlab.sh
More file actions
59 lines (49 loc) · 2.08 KB
/
install-matlab.sh
File metadata and controls
59 lines (49 loc) · 2.08 KB
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
#!/usr/bin/env bash
#
# Copyright 2023-2024 The MathWorks, Inc.
# Exit on any failure, treat unset substitution variables as errors
set -euo pipefail
# Configure MATLAB_ROOT directory
sudo mkdir -p "${MATLAB_ROOT}"
sudo chmod -R 755 "${MATLAB_ROOT}"
# Install and setup mpm.
# https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/MPM.md
cd /tmp
sudo apt-get -qq install \
unzip \
wget \
ca-certificates
sudo wget --no-verbose https://www.mathworks.com/mpm/glnxa64/mpm
sudo chmod +x mpm
# If a source URL is provided, then use it to install MATLAB and toolboxes.
release_arguments=""
source_arguments=""
if [[ -n "${MATLAB_SOURCE_LOCATION}" ]]; then
# Setup source for MATLAB installation
sudo chmod +x /var/tmp/config/matlab/setup-matlab-source.sh
/var/tmp/config/matlab/setup-matlab-source.sh mount "${MATLAB_SOURCE_LOCATION}" "MATLABFILESHAREUSERNAME" "MATLABFILESHAREPASSWORD" "${AZURE_KEY_VAULT}"
# Setup appropriate source flag to use with mpm
source_arguments="--source /mnt/${MATLAB_SOURCE_LOCATION}/dvd/archives"
else
release_arguments="--release ${RELEASE}"
fi
# Run mpm to install MATLAB and toolboxes in the PRODUCTS variable
# into the target location. The mpm installation is deleted afterwards.
# The PRODUCTS variable should be a space separated list of products, with no surrounding quotes.
# Use quotes around the destination argument if it contains spaces.
sudo ./mpm install \
${release_arguments} \
${source_arguments} \
--destination="${MATLAB_ROOT}" \
--products ${PRODUCTS} \
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && exit 1)
sudo rm -f mpm /tmp/mathworks_root.log
# If a source location for installation was provided, delete related files and folders after install.
if [[ -n "${MATLAB_SOURCE_LOCATION}" ]]; then
/var/tmp/config/matlab/setup-matlab-source.sh unmount "${MATLAB_SOURCE_LOCATION}"
fi
# Enable DDUX collection by default for the VM
cd "${MATLAB_ROOT}/bin/glnxa64"
sudo ./ddux_settings -s -c
# Config MHLM Client setting
sudo cp /var/tmp/config/matlab/mhlmvars.sh /etc/profile.d/