-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathconfigure.bat
More file actions
210 lines (184 loc) · 6.27 KB
/
configure.bat
File metadata and controls
210 lines (184 loc) · 6.27 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
@echo off
setlocal enabledelayedexpansion
:: Check if we're running in SysWOW64
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" (
if defined PROCESSOR_ARCHITEW6432 (
:: We're running in 32-bit mode on a 64-bit system
:: Re-launch using 64-bit cmd.exe
%SystemRoot%\Sysnative\cmd.exe /c "%~dpnx0" %*
exit /b
)
)
:: At this point, we're running in 64-bit mode
:: Check if the script is being run directly or through another cmd instance
if /i "%~dp0"=="%SystemRoot%\SysWOW64\" (
:: We're running from SysWOW64, re-launch using System32 cmd.exe
%SystemRoot%\System32\cmd.exe /c "%~dpnx0" %*
exit /b
)
:: run as admin
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
echo =========================================================================
echo.
echo ABUS Configure [Version 3.0]
echo contact: abus.aikorea@gmail.com
echo.
echo =========================================================================
echo.
:: If we've reached here, we're running in the correct environment
:: Your actual batch file commands start here
echo Running in 64-bit mode from System32
echo Current directory: %CD%
echo Command line: %*
:: check LongPathsEnabled
echo Enabling long paths support...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
if %ERRORLEVEL% == 0 (
echo Long paths have been enabled successfully.
) else (
echo Failed to enable long paths.
pause
exit /b 1
)
cd /D "%~dp0"
SET "CHOCPATH=%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe"
:: Install choco
echo Checking Chocolatey installation...
where choco >nul 2>&1
if %errorlevel% neq 0 (
echo Installing Chocolatey...
%CHOCPATH% -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
if %errorlevel% neq 0 (
echo ERROR: Failed to install Chocolatey.
pause
exit /b 1
)
:: Add Chocolatey to PATH for current session
if exist "%ALLUSERSPROFILE%\chocolatey\bin" (
set "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
)
:: Verify choco is now available
where choco >nul 2>&1
if %errorlevel% neq 0 (
echo WARNING: Chocolatey installed but choco command not found in PATH.
echo You may need to restart the command prompt.
)
) else (
echo Chocolatey is already installed.
)
:: Install uv
@REM %CHOCPATH% -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
:: check NVIDIA GPU
set IS_NVIDIA_GPU=0
set "registry_path=HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000"
set "search_key=DriverDesc"
for /f "tokens=2*" %%a in ('reg query "%registry_path%" /v "%search_key%" 2^>nul ^| findstr /i /c:"%search_key%"') do (
set "value=%%b"
)
if not "!value!"=="" (
echo DriverDesc is "!value!"
set "substring=nvidia"
echo "!value!" | findstr /I /C:"!substring!" >nul 2>&1
if !errorlevel! equ 0 (
echo NVIDIA
set IS_NVIDIA_GPU=1
) else (
set "substring=tesla"
echo "!value!" | findstr /I /C:"!substring!" >nul 2>&1
if !errorlevel! equ 0 (
echo TESLA
set IS_NVIDIA_GPU=1
)
)
)
:: install CUDA
if !IS_NVIDIA_GPU! equ 1 (
echo.
echo =========================================================================
echo NVIDIA GPU detected - Installing CUDA
echo =========================================================================
echo.
echo CUDA 12.3.2 requires NVIDIA driver version 525.60.13 or higher.
echo If installation fails, please update your NVIDIA driver first.
echo.
@REM choco install -y cuda --version=11.8.0.52206
choco install -y cuda --version=12.3.2.546
if %errorlevel% neq 0 (
echo.
echo WARNING: CUDA installation failed.
echo Possible reasons:
echo 1. NVIDIA driver version is too old
echo 2. Another CUDA version is already installed
echo 3. Insufficient disk space
echo.
echo Continuing with other installations...
echo.
) else (
echo CUDA installed successfully.
)
) else (
echo NVIDIA or TESLA GPU is not found
echo Skipping CUDA installation.
echo.
)
echo.
echo =========================================================================
echo Installing required packages...
echo =========================================================================
echo.
echo Installing git.install...
choco install -y git.install
if %errorlevel% neq 0 (
echo WARNING: git.install installation failed.
)
echo.
echo Installing ffmpeg...
choco install -y ffmpeg
if %errorlevel% neq 0 (
echo WARNING: ffmpeg installation failed.
)
echo.
echo Installing Visual Studio 2022 Build Tools...
echo This may take a very long time (30+ minutes)...
choco install -y visualstudio2022buildtools --verbose
if %errorlevel% neq 0 (
echo WARNING: visualstudio2022buildtools installation failed.
)
echo.
echo Installing Visual Studio 2022 C++ workload...
choco install -y visualstudio2022-workload-vctools --verbose
if %errorlevel% neq 0 (
echo WARNING: visualstudio2022-workload-vctools installation failed.
)
echo.
echo =========================================================================
echo ABUS configure.bat finished.
echo =========================================================================
echo.
echo Note: LongPathsEnabled requires a system reboot to take effect.
echo.
:: Ask user about reboot
set /p REBOOT_NOW="Do you want to reboot now? (Y/N): "
if /i "!REBOOT_NOW!"=="Y" (
echo.
echo System will be rebooted in 30 seconds...
echo Press Ctrl+C to cancel.
echo.
for /l %%i in (30,-1,1) do (
cls
echo.
echo =========================================================================
echo ABUS Configure finished.
echo =========================================================================
echo.
echo System will be rebooted in %%i seconds.
echo Press Ctrl+C to cancel.
timeout /t 1 /nobreak >nul 2>&1
)
shutdown /r /t 0
) else (
echo.
echo Please reboot your system manually when ready.
echo LongPathsEnabled and CUDA changes require a reboot to take effect.
pause
)