-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_install_win.bat
112 lines (83 loc) · 3.63 KB
/
post_install_win.bat
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
107
108
109
110
111
112
@echo off
:CHECK_INTERNET
echo ===== Checking internet connection =====
ping pypi.org -n 1 > nul
if errorlevel 1 (
echo You are not connected to the internet.
echo Please connect to the internet and press any key to continue...
pause > nul
goto CHECK_INTERNET
) else (
echo Internet connection detected.
echo Your computer is connected to the internet.
)
echo ===== Install PIP dependencies =====
REM Install pip dependencies in main env: abba-python
set CONDA_ENV_PATH=%PREFIX%
REM Activate main Conda environment
call %CONDA_ENV_PATH%\Scripts\activate
pip install abba-python==0.9.11.dev0
REM Install pip dependencies in extra env: DeepSlice
set CONDA_DEEPSLIVEENV_PATH=%PREFIX%\env\deep
REM Activate extra Conda environment
call %CONDA_ENV_PATH%\Scripts\activate %PREFIX%\envs\deepslice
pip install DeepSlice==1.1.5
pip install urllib3==1.26.6
echo ===== Unpack extra files (DeepSlice models, logos...) =====
REM untar extra files into the install folder (deepslice model, deepslice cli script)
tar -xzvf "%PREFIX%\abba-pack-win.tar.gz" -C "%PREFIX%"
rm "%PREFIX%\abba-pack-win.tar.gz"
echo ===== Create ABBA shortcut =====
set shortcutPath='%userprofile%\Desktop\ABBA-0.9.11.dev0.lnk'
set shortcutTarget='%PREFIX%\win\run-abba.bat'
set shortcutIcon='%PREFIX%\img\logo256x256.ico'
REM '%PREFIX%\img\logo256x256.ico'
@echo off
REM set /p "id=Shortcut path: "
echo %shortcutPath%
@echo off
REM set /p "id=Shortcut target: "
echo %shortcutTarget%
@echo off
REM set /p "id=Installing shortcut: "
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe "$s=(New-Object -COM WScript.Shell).CreateShortcut("%shortcutPath%");$s.IconLocation="%shortcutIcon%";$s.TargetPath="%shortcutTarget%";$s.Save()"
REM add shortcut to C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
set shortcutProgramsPath='%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ABBA.lnk'
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe "$s=(New-Object -COM WScript.Shell).CreateShortcut("%shortcutProgramsPath%");$s.IconLocation="%shortcutIcon%";$s.TargetPath="%shortcutTarget%";$s.Save()"
echo ABBA shortcuts installed
@echo off
REM set /p "id=Shortcut installed "
echo ===== Checking if Visual C++ redistributable is installed (elastix requirements) =====
REM Check if the VC++ Redistributable is installed and get the version number
for /f "tokens=2" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" /v Version ^| findstr /i "^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$"') do set installed_version=%%i
if defined installed_version (
echo Found installed version %installed_version%
REM Compare installed version with the required version
if "%installed_version%" geq "%REQUIRED_VERSION%" (
echo Visual C++ Redistributable version is up to date. Skipping installation.
goto :EOF
) else (
echo Installed version is older than required. Proceeding with installation.
)
) else (
echo Visual C++ Redistributable is not installed. Proceeding with installation.
)
REM Download the VC++ Redistributable installer if not already present
if not exist "%VC_REDIST_EXE%" (
echo Downloading VC++ Redistributable installer...
powershell -Command "Invoke-WebRequest -Uri %VC_REDIST_URL% -OutFile %VC_REDIST_EXE%"
)
REM Execute the installer
if exist "%VC_REDIST_EXE%" (
echo Installing VC++ Redistributable...
"%VC_REDIST_EXE%" /install /quiet /norestart
if %ERRORLEVEL% equ 0 (
echo Installation successful.
) else (
echo Installation failed with error code %ERRORLEVEL%.
)
) else (
echo Failed to download the installer.
)
:end
endlocal