-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_from_matlab.m
74 lines (63 loc) · 2.45 KB
/
install_from_matlab.m
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
% Install all relevant files and change settings using MATLAB code
% Created: 2018-11-08 by J. Sy
% Last Updated: 2018-11-08 by J. Sy
% SETTINGS
% Add ContactAutocurator package to path
packageFullPath = mfilename('fullpath');
[packagePath,~,~] = fileparts(packageFullPath);
addpath(genpath(packagePath))
% OS-specific installation
fprintf('Do you wish to attempt automatic installation of Python 3.8?\n')
fprintf('[Y] Yes, install automatically\n')
fprintf('[N] No, I wish to install manually or already have Python installed.')
installChk = input('>');
if strcmpi(installChk, 'Y')
installPy = true;
else
installPy = false;
end
fprintf('Do you wish to attempt automatic installation of Google Cloud SDK?\n')
fprintf('[Y] Yes, install automatically\n')
fprintf('[N] No, I wish to install manually or already have CloudSDK installed.')
installChk = input('>');
if strcmpi(installChk, 'Y')
installSDK = true;
else
installSDK = false;
end
if ispc
if installPy == true
% Install Python
pythonSource = 'https://www.python.org/ftp/python/3.8.1/python-3.8.1-amd64.exe';
web(pythonSource)
end
if installSDK == true
% Install Cloud SDK
system(['powershell -inputformat none -Command '...
'(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe",'...
' "$env:Temp\GoogleCloudSDKInstaller.exe")'])
system(['powershell -inputformat none -Command '...
'& $env:Temp\GoogleCloudSDKInstaller.exe'])
end
elseif isunix
if installPy == true
% Install Python
pythonSource = 'https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz';
web(pythonSource);
end
if installSDK == true
% Install Cloud SDK
system(['echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] '...
'https://packages.cloud.google.com/apt cloud-sdk main" | '...
'sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list'])
system('sudo apt-get install apt-transport-https ca-certificates gnupg')
system(['curl https://packages.cloud.google.com/apt/doc/apt-key.gpg '...
'| sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -'])
system('sudo apt-get update && sudo apt-get install google-cloud-sdk')
end
else
error('Unsupported Operating System')
end
% Open config file
edit cloud_config.m
edit autocurator_config.m