-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
202 lines (188 loc) · 6.29 KB
/
install.bat
File metadata and controls
202 lines (188 loc) · 6.29 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
@echo off
REM Installation script for Meshcore Firmware Editor and Flasher (Windows)
echo ==========================================
echo Meshcore Firmware Editor and Flasher - Installation
echo ==========================================
echo.
REM Check Python
echo Checking Python installation...
python --version >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=2" %%i in ('python --version 2^>^&1') do set PYTHON_VERSION=%%i
echo [OK] Python found: %PYTHON_VERSION%
set PYTHON_CMD=python
) else (
py --version >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=2" %%i in ('py --version 2^>^&1') do set PYTHON_VERSION=%%i
echo [OK] Python found: %PYTHON_VERSION%
set PYTHON_CMD=py
) else (
python3 --version >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=2" %%i in ('python3 --version 2^>^&1') do set PYTHON_VERSION=%%i
echo [OK] Python found: %PYTHON_VERSION%
set PYTHON_CMD=python3
) else (
echo [ERROR] Python not found!
echo Please install Python 3.6 or higher from https://www.python.org/downloads/
echo Make sure to check "Add Python to PATH" during installation.
pause
exit /b 1
)
)
)
REM Check pip
echo.
echo Checking pip installation...
%PYTHON_CMD% -m pip --version >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] pip found
set PIP_CMD=%PYTHON_CMD% -m pip
) else (
echo [WARNING] pip not found, attempting to install...
%PYTHON_CMD% -m ensurepip --upgrade
if %errorlevel% neq 0 (
echo [ERROR] Failed to install pip. Please install pip manually.
pause
exit /b 1
)
set PIP_CMD=%PYTHON_CMD% -m pip
)
REM Check Tkinter
echo.
echo Checking Tkinter...
%PYTHON_CMD% -c "import tkinter" >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] Tkinter is available
) else (
echo [WARNING] Tkinter not found
echo Tkinter should be included with Python. Try reinstalling Python.
)
REM Install the package
echo.
echo Installing Meshcore Firmware Editor and Flasher...
%PIP_CMD% install -e . --user
if %errorlevel% equ 0 (
echo.
echo ==========================================
echo Installation completed successfully!
echo ==========================================
echo.
echo You can now run the application with:
echo meshcore-firmware-editor
echo.
echo Or directly with:
echo %PYTHON_CMD% meshcore_flasher.py
echo.
) else (
echo [ERROR] Installation failed!
pause
exit /b 1
)
REM Install optional dependencies
echo.
echo Installing optional dependencies...
echo.
REM Install PlatformIO
echo Installing PlatformIO...
pio --version >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=1,2" %%i in ('pio --version 2^>^&1') do (
echo [OK] PlatformIO already installed: %%i %%j
goto :pio_done
)
:pio_done
) else (
echo Installing PlatformIO via pip...
%PIP_CMD% install platformio --user
if %errorlevel% equ 0 (
echo [OK] PlatformIO installed successfully
echo Note: You may need to restart your terminal for 'pio' command to be available
) else (
echo [WARNING] Failed to install PlatformIO. You can install it manually:
echo %PIP_CMD% install platformio
)
)
REM Install Git
echo.
echo Installing Git...
git --version >nul 2>&1
if %errorlevel% equ 0 (
for /f "tokens=1,2,3" %%i in ('git --version 2^>^&1') do (
echo [OK] Git already installed: %%i %%j %%k
goto :git_done
)
:git_done
) else (
echo Installing Git...
REM Try winget first (Windows 10+)
where winget >nul 2>&1
if %errorlevel% equ 0 (
echo Using winget to install Git...
winget install --id Git.Git -e --accept-package-agreements --accept-source-agreements
if %errorlevel% equ 0 (
echo [OK] Git installed via winget
echo Note: You may need to restart your terminal for 'git' command to be available
) else (
echo [WARNING] winget installation failed, trying chocolatey...
REM Try chocolatey
where choco >nul 2>&1
if %errorlevel% equ 0 (
choco install git -y
if %errorlevel% equ 0 (
echo [OK] Git installed via chocolatey
) else (
echo [WARNING] chocolatey installation failed
goto :git_manual
)
) else (
goto :git_manual
)
)
) else (
REM Try chocolatey
where choco >nul 2>&1
if %errorlevel% equ 0 (
choco install git -y
if %errorlevel% equ 0 (
echo [OK] Git installed via chocolatey
) else (
goto :git_manual
)
) else (
:git_manual
echo [WARNING] Could not auto-install Git
echo Please install Git manually from: https://git-scm.com/download/win
echo Or install a package manager (winget or chocolatey) and run this script again
)
)
)
REM Create desktop shortcut
echo.
echo Creating desktop shortcut...
set "SCRIPT_DIR=%~dp0"
set "DESKTOP_PATH=%USERPROFILE%\Desktop"
REM Create shortcut using PowerShell (escape quotes properly)
powershell -NoProfile -Command "$WshShell = New-Object -ComObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('%DESKTOP_PATH%\MeshCore Firmware Editor.lnk'); $Shortcut.TargetPath = '%SCRIPT_DIR%run.bat'; $Shortcut.WorkingDirectory = '%SCRIPT_DIR:~0,-1%'; $Shortcut.Description = 'MeshCore Firmware Editor and Flasher'; $Shortcut.IconLocation = 'shell32.dll,137'; $Shortcut.Save()" 2>nul
if %errorlevel% equ 0 (
echo [OK] Desktop shortcut created: %DESKTOP_PATH%\MeshCore Firmware Editor.lnk
) else (
echo [WARNING] Could not create desktop shortcut automatically
echo You can create it manually by right-clicking run.bat and selecting "Create shortcut"
echo Then move the shortcut to your Desktop
)
echo.
echo ==========================================
echo Installation completed!
echo ==========================================
echo.
echo You can now run the application with:
echo meshcore-firmware-editor
echo.
echo Or directly with:
echo %PYTHON_CMD% meshcore_flasher.py
echo.
echo Or double-click the desktop shortcut!
echo.
pause