]> git.donarmstrong.com Git - qmk_firmware.git/blob - 2-setup-environment-win.bat
Merge pull request #244 from nicosuave/add_nico_planck_keymap
[qmk_firmware.git] / 2-setup-environment-win.bat
1 @SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
2 @ECHO OFF
3
4 SET STARTINGDIR=%CD%
5
6 :: Check for admin privilages
7 SETX /M test test > nul 2>&1
8 IF NOT ["%ERRORLEVEL%"]==["0"] (
9         ECHO FAILED. Rerun with administrator privileges.
10         GOTO ExitBatch
11
12
13 :: Make sure path to MinGW exists - if so, CD to it
14 SET MINGWPATH="C:\MinGW\bin"
15 IF NOT EXIST !MINGWPATH! (ECHO Path not found: %MINGWPATH% && GOTO ExitBatch)
16 CD /D %MINGWPATH%
17
18
19 ECHO ------------------------------------------
20 ECHO Installing wget and unzip
21 ECHO ------------------------------------------
22 mingw-get install msys-wget-bin msys-unzip-bin
23
24 MKDIR temp
25 CD temp
26
27 ECHO ------------------------------------------
28 ECHO Installing dfu-programmer.
29 ECHO ------------------------------------------
30 wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip
31 unzip dfu-programmer-win-0.7.2.zip
32 COPY dfu-programmer.exe ..
33
34 ECHO ------------------------------------------
35 ECHO Downloading driver
36 ECHO ------------------------------------------
37 wget http://iweb.dl.sourceforge.net/project/libusb-win32/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip
38 unzip libusb-win32-bin-1.2.6.0.zip
39 COPY libusb-win32-bin-1.2.6.0\bin\x86\libusb0_x86.dll ../libusb0.dll
40
41 ECHO ------------------------------------------
42 ECHO Installing driver. Accept prompt.
43 ECHO ------------------------------------------
44 IF EXIST "%WinDir%\System32\PnPUtil.exe" (%WinDir%\System32\PnPUtil.exe -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf && GOTO PNPUTILFOUND)
45 IF EXIST "%WinDir%\Sysnative\PnPUtil.exe" (%WinDir%\Sysnative\PnPUtil.exe -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf && GOTO PNPUTILFOUND)
46
47 ECHO FAILED. Could not find PnPUtil.exe in "%WinDir%\System32" or "%WinDir%\Sysnative".
48
49 :PNPUTILFOUND
50
51 :: Wait then delete directory
52 ping -n 5 127.0.0.1 > NUL 2>&1
53 CD ..
54 RD /s /q temp
55
56 ECHO ------------------------------------------
57 ECHO Finished!
58
59 :ExitBatch
60 CD /D %STARTINGDIR%
61 ENDLOCAL
62 PAUSE
63 EXIT /b