-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathinstall.bat
More file actions
272 lines (233 loc) · 9.98 KB
/
install.bat
File metadata and controls
272 lines (233 loc) · 9.98 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
@echo off
setlocal enabledelayedexpansion
echo ================================================================
echo FunGen Enhanced Universal Installer
echo v1.4.4 - ACTIVATION FIXES
echo ================================================================
echo This installer will download and install everything needed:
echo - Miniconda (Python 3.11 + conda package manager)
echo - Git
echo - FFmpeg/FFprobe
echo - FunGen AI and all dependencies
echo.
echo RECOMMENDED: Run this installer as a NORMAL USER
echo Most installations work fine without administrator privileges
echo.
echo CRITICAL FIXES IN v1.4.4:
echo - Fixed "Run conda init before conda activate" error
echo - Fixed PowerShell URL variable expansion issue
echo - Use direct conda -n flag to avoid activation errors
echo - Improved fallback for FFmpeg installation
echo.
echo [0.1/8] Checking system architecture...
if /i "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
echo WARNING: ARM64 Windows detected
echo Some packages may not compile on ARM64.
echo.
echo RECOMMENDED: Install x64 Python instead
echo - Download Python 3.11 x64 from python.org
echo - x64 Python runs via emulation and has better compatibility
echo.
echo ALTERNATIVE: Use Windows Subsystem for Linux
echo - Run: wsl --install
echo.
set /p response="Continue anyway? [y/N]: "
if /i "!response!" neq "y" (
echo Installation cancelled.
pause
exit /b 1
)
)
pause
REM Prevent pip from using user-site packages (avoids "Requirement already satisfied" false positives)
set PYTHONNOUSERSITE=1
REM Set variables
set "TEMP_DIR=%TEMP%\FunGen_Install"
set "INSTALL_DIR=%~dp0"
set "MINICONDA_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe"
set "MINICONDA_INSTALLER=%TEMP_DIR%\Miniconda3-latest.exe"
REM Miniconda silent install /D= cannot handle spaces or non-ASCII chars in path.
REM Use the 8.3 short path of USERPROFILE — guaranteed space-free and user-writable,
REM avoiding the old C:\miniconda3 fallback which is not writable without admin.
for %%I in ("%USERPROFILE%") do set "MINICONDA_PATH=%%~sI\miniconda3"
set "CONDA_EXE=!MINICONDA_PATH!\Scripts\conda.exe"
set "ENV_NAME=FunGen"
REM Note: ARM64 Windows should use x86_64 version via emulation
REM Miniconda does not provide native ARM64 builds for Windows
REM Create temp directory
if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%"
echo [1/8] Checking Miniconda installation...
if exist "%CONDA_EXE%" (
echo [OK] Miniconda already installed at: %MINICONDA_PATH%
goto :init_conda
) else (
echo [X] Miniconda not found, will install automatically
)
echo.
echo [2/8] Downloading Miniconda...
echo Downloading from: %MINICONDA_URL%
echo Please wait, this may take several minutes...
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%MINICONDA_URL%' -OutFile '%MINICONDA_INSTALLER%' -UseBasicParsing"
if !errorlevel! neq 0 (
echo [ERROR] Failed to download Miniconda
pause
exit /b 1
)
echo [OK] Miniconda downloaded successfully
echo.
echo [3/8] Installing Miniconda...
echo Installing to: %MINICONDA_PATH%
echo This will take a few minutes...
start /wait "" "%MINICONDA_INSTALLER%" /InstallationType=JustMe /RegisterPython=0 /S /D=%MINICONDA_PATH%
if !errorlevel! neq 0 (
echo [ERROR] Failed to install Miniconda
pause
exit /b 1
)
echo [OK] Miniconda installed successfully
:init_conda
echo.
echo [3.5/8] Initializing conda...
echo Setting up conda for command line use...
REM Initialize conda for cmd - CRITICAL FIX
echo Initializing conda for command line use...
call "%MINICONDA_PATH%\Scripts\conda.exe" init cmd.exe
if !errorlevel! neq 0 (
echo [WARNING] Conda init failed, trying alternative method...
REM Alternative: Add conda to PATH for this session
set "PATH=%MINICONDA_PATH%\Scripts;%MINICONDA_PATH%;%PATH%"
REM Try to initialize conda again after PATH fix
"%MINICONDA_PATH%\Scripts\conda.exe" init cmd.exe >nul 2>&1
if !errorlevel! neq 0 (
echo [WARNING] Alternative conda init also failed, but continuing...
echo Will use PATH-based conda access
) else (
echo [OK] Conda initialized successfully via alternative method
)
) else (
echo [OK] Conda initialized successfully
)
REM Restart the command prompt environment to pick up conda init changes
echo Refreshing environment variables...
call "%MINICONDA_PATH%\Scripts\activate.bat"
REM Accept Terms of Service for conda channels (handles the TOS error)
echo Accepting conda Terms of Service...
"%CONDA_EXE%" config --set channel_priority disabled >nul 2>&1
"%CONDA_EXE%" config --add channels conda-forge >nul 2>&1
REM Try to accept TOS, but don't fail if it doesn't work
"%CONDA_EXE%" tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main >nul 2>&1
"%CONDA_EXE%" tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r >nul 2>&1
"%CONDA_EXE%" tos accept --override-channels --channel https://repo.anaconda.com/pkgs/msys2 >nul 2>&1
echo [OK] Conda configuration updated
echo.
echo [4/8] Creating FunGen conda environment...
echo Creating environment '%ENV_NAME%' with Python 3.11...
REM Create environment with explicit channel to avoid TOS issues
"%CONDA_EXE%" create -n %ENV_NAME% python=3.11 -c conda-forge -y
if !errorlevel! neq 0 (
echo [WARNING] Failed to create conda environment with conda-forge
echo Trying with default channels...
"%CONDA_EXE%" create -n %ENV_NAME% python=3.11 -y --override-channels --channel defaults
if !errorlevel! neq 0 (
echo [ERROR] Failed to create conda environment
echo This may be due to conda Terms of Service issues
echo Try running these commands manually:
echo conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
echo conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
pause
exit /b 1
)
)
echo [OK] Conda environment '%ENV_NAME%' created successfully
echo.
echo [5/8] Installing Git and FFmpeg via conda...
REM Install git and ffmpeg into the fungen environment
echo Installing Git...
"%CONDA_EXE%" install -n %ENV_NAME% git -c conda-forge -y >nul 2>&1
if !errorlevel! equ 0 (
echo [OK] Git installed
) else (
echo [WARNING] Git install failed - universal installer will handle it
)
echo Installing FFmpeg...
"%CONDA_EXE%" install -n %ENV_NAME% ffmpeg -c conda-forge -y >nul 2>&1
if !errorlevel! equ 0 (
echo [OK] FFmpeg installed
) else (
echo [WARNING] FFmpeg install failed - universal installer will handle it
)
echo.
echo [6/8] Running FunGen universal installer...
echo Prerequisites installed, now calling universal installer...
REM Initialize conda environment variables properly
call "%MINICONDA_PATH%\Scripts\activate.bat" %ENV_NAME%
if !errorlevel! neq 0 (
echo [WARNING] Environment activation failed, trying alternative method...
REM Alternative activation method
set "PATH=%MINICONDA_PATH%\envs\%ENV_NAME%\Scripts;%MINICONDA_PATH%\envs\%ENV_NAME%;%PATH%"
set "CONDA_DEFAULT_ENV=%ENV_NAME%"
)
REM Remove trailing backslash from INSTALL_DIR to avoid quote escaping issues
REM (a quoted path ending in \" escapes the closing quote on Windows cmdline,
REM so e.g. "A:\" is parsed as A:" by argparse).
REM For drive roots we must keep a path component, so append "." -> A:\.
set "INSTALL_DIR_CLEAN=%INSTALL_DIR%"
if "%INSTALL_DIR:~-1%"=="\" (
if "%INSTALL_DIR:~-2,1%"==":" (
REM Drive root like A:\ - append "." so quoting is safe
set "INSTALL_DIR_CLEAN=%INSTALL_DIR%."
) else (
REM Regular path like C:\foo\ - strip trailing backslash
set "INSTALL_DIR_CLEAN=%INSTALL_DIR:~0,-1%"
)
)
REM Fix git safe.directory issue for network shares
REM Scoped to FunGen directory only for security
echo Configuring git for FunGen directory access...
git config --global --add safe.directory "%INSTALL_DIR_CLEAN%" >nul 2>&1
REM Check if install.py exists in current directory
if exist "%INSTALL_DIR%install.py" (
echo Running local install.py...
python "%INSTALL_DIR%install.py" --dir "%INSTALL_DIR_CLEAN%" --force
) else (
echo install.py not found locally, downloading from GitHub...
REM Use a more reliable download method with proper variable expansion
set "INSTALLER_URL=https://raw.githubusercontent.com/ack00gar/FunGen-AI-Powered-Funscript-Generator/main/install.py"
set "INSTALLER_FILE=%TEMP_DIR%\install.py"
echo Downloading from: !INSTALLER_URL!
REM Try PowerShell first - use delayed expansion variables for PowerShell
powershell -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '!INSTALLER_URL!' -OutFile '!INSTALLER_FILE!' -UseBasicParsing"
if !errorlevel! neq 0 (
echo [WARNING] PowerShell download failed, trying curl...
curl -L -o "!INSTALLER_FILE!" "!INSTALLER_URL!"
if !errorlevel! neq 0 (
echo [ERROR] Failed to download universal installer
echo Please download install.py manually from GitHub
pause
exit /b 1
)
)
echo [OK] Universal installer downloaded successfully
echo Running downloaded universal installer...
python "!INSTALLER_FILE!" --dir "!INSTALL_DIR_CLEAN!" --force
)
if !errorlevel! neq 0 (
echo [ERROR] Universal installer failed
echo Check the error messages above for details
pause
exit /b 1
)
echo [OK] FunGen installation completed by universal installer
echo.
echo ================================================================
echo Installation Complete!
echo ================================================================
echo.
echo [OK] Prerequisites installed ^(Miniconda, Git, FFmpeg^)
echo [OK] FunGen universal installer completed successfully
echo.
echo Check above for launcher instructions.
echo.
pause
REM Cleanup
if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%"