-
Notifications
You must be signed in to change notification settings - Fork 17
/
win_install.bat
134 lines (120 loc) · 3.5 KB
/
win_install.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@echo off
:: Check if the script is running as administrator
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Running as administrator...
:: Restart the script with administrator privileges
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
chcp 65001 > nul
SETLOCAL ENABLEDELAYEDEXPANSION
echo Script starting...
:: Check if Chocolatey is already installed
:check_choco
echo Checking if Chocolatey is installed...
choco --version >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo Chocolatey is already installed. Skipping installation.
goto install_python
) ELSE (
echo Installing Chocolatey...
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" || (
echo Error during Chocolatey installation.
exit /b 1
)
echo Chocolatey installed successfully.
call choco --version
echo.
)
:: Check if Python is already installed
:install_python
echo Checking if Python is installed...
python -V >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo Python is already installed. Skipping installation.
goto install_openssl
) ELSE (
echo Installing Python...
choco install python --confirm --params="'/NoStore'" --allow-downgrade || (
echo Error during Python installation.
exit /b 1
)
echo Python installed successfully.
call python -V
echo.
)
:: Ask to restart the terminal
echo Please restart the terminal to continue...
pause
exit /b
:: Check if OpenSSL is already installed
:install_openssl
echo Checking if OpenSSL is installed...
openssl version -a >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo OpenSSL is already installed. Skipping installation.
goto install_ffmpeg
) ELSE (
echo Installing OpenSSL...
choco install openssl --confirm || (
echo Error during OpenSSL installation.
exit /b 1
)
echo OpenSSL installed successfully.
call openssl version -a
echo.
)
:: Check if FFmpeg is already installed
:install_ffmpeg
echo Checking if FFmpeg is installed...
ffmpeg -version >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo FFmpeg is already installed. Skipping installation.
goto create_venv
) ELSE (
echo Installing FFmpeg...
choco install ffmpeg --confirm || (
echo Error during FFmpeg installation.
exit /b 1
)
echo FFmpeg installed successfully.
call ffmpeg -version
echo.
)
:: Verify installations
:verifica_installazioni
echo Verifying installations...
call choco --version
call python -V
call openssl version -a
call ffmpeg -version
echo All programs have been successfully installed and verified.
:: Create a virtual environment .venv
:create_venv
echo Checking if the .venv virtual environment already exists...
if exist .venv (
echo The .venv virtual environment already exists. Skipping creation.
) ELSE (
echo Creating the .venv virtual environment...
python -m venv .venv || (
echo Error during virtual environment creation.
exit /b 1
)
echo Virtual environment created successfully.
)
:: Activate the virtual environment and install requirements
echo Installing requirements...
call .venv\Scripts\activate.bat
pip install -r requirements.txt || (
echo Error during requirements installation.
exit /b 1
)
:: Run run.py
echo Running run.py...
call .venv\Scripts\python .\run.py || (
echo Error during run.py execution.
exit /b 1
)
echo End of script.
ENDLOCAL