-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
82 lines (74 loc) · 2.58 KB
/
Copy pathsetup.bat
File metadata and controls
82 lines (74 loc) · 2.58 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
@echo off
setlocal EnableDelayedExpansion
set "SCRIPT_DIR=%~dp0"
set "TOOLCHAIN_DIR=%SCRIPT_DIR%.toolchain"
set "RUSTUP_HOME=%TOOLCHAIN_DIR%\rustup"
set "CARGO_HOME=%TOOLCHAIN_DIR%\cargo"
set "OPENCONNECT_DIR=%TOOLCHAIN_DIR%\openconnect"
set "RUSTUP_INIT=%TOOLCHAIN_DIR%\rustup-init.exe"
set "CARGO_BIN=%TOOLCHAIN_DIR%\cargo\bin\cargo.exe"
set "TAURI_BIN=%TOOLCHAIN_DIR%\cargo\bin\cargo-tauri.exe"
echo.
echo ============================================================
echo OpenConnect GUI - Portable Toolchain Setup
echo ============================================================
echo.
echo [1/4] Creating .toolchain directories...
if not exist "%TOOLCHAIN_DIR%" mkdir "%TOOLCHAIN_DIR%"
if not exist "%RUSTUP_HOME%" mkdir "%RUSTUP_HOME%"
if not exist "%CARGO_HOME%" mkdir "%CARGO_HOME%"
if not exist "%OPENCONNECT_DIR%" mkdir "%OPENCONNECT_DIR%"
echo Done.
echo.
echo [2/4] Downloading rustup-init.exe...
if exist "%RUSTUP_INIT%" (
echo rustup-init.exe already present, skipping download.
) else (
powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest -Uri 'https://win.rustup.rs/x86_64' -OutFile '%RUSTUP_INIT%' -UseBasicParsing"
if !ERRORLEVEL! neq 0 (
echo ERROR: Failed to download rustup-init.exe.
exit /b 1
)
echo Download complete.
)
echo.
echo [3/4] Installing Rust stable toolchain...
if exist "%CARGO_BIN%" (
echo Rust toolchain already installed, skipping.
) else (
"%RUSTUP_INIT%" --default-toolchain stable-x86_64-pc-windows-msvc --default-host x86_64-pc-windows-msvc --no-modify-path -y
if !ERRORLEVEL! neq 0 (
echo ERROR: rustup-init.exe failed.
exit /b 1
)
echo Rust toolchain installed successfully.
)
echo.
echo [4/4] Installing tauri-cli (latest v2)...
if not exist "%CARGO_BIN%" (
echo ERROR: cargo.exe not found. Rust installation may have failed.
exit /b 1
)
if exist "%TAURI_BIN%" (
echo tauri-cli already installed, skipping.
) else (
"%CARGO_BIN%" install tauri-cli
if !ERRORLEVEL! neq 0 (
echo ERROR: cargo install tauri-cli failed.
exit /b 1
)
echo tauri-cli installed successfully.
)
echo.
echo ============================================================
echo MANUAL STEP REQUIRED
echo ============================================================
echo.
echo Place openconnect.exe at:
echo %OPENCONNECT_DIR%\openconnect.exe
echo.
echo Then build with:
echo .toolchain\cargo\bin\cargo.exe tauri build
echo ============================================================
endlocal
exit /b 0