re drivers not installing #4313

This commit is contained in:
rusefillc 2022-08-23 20:50:55 -04:00
parent d0777b99d7
commit 1e32a183c9
4 changed files with 68 additions and 2 deletions

View File

@ -0,0 +1,61 @@
::::::::::::::::::::::::::::::::::::::::::::
:: Elevate.cmd - Version 4
:: Automatically check & get admin rights
:: see "https://stackoverflow.com/a/12264592/1016343" for description
::::::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================
:init
setlocal DisableDelayedExpansion
set cmdInvoke=1
set winSysFolder=System32
set "batchPath=%~dpnx0"
rem this works also from cmd shell, other than %~0
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
if '%cmdInvoke%'=='1' goto InvokeCmd
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
goto ExecElevation
:InvokeCmd
ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"
:ExecElevation
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
ECHO %batchName% Arguments: P1=%1 P2=%2 P3=%3 P4=%4 P5=%5 P6=%6 P7=%7 P8=%8 P9=%9
STM32Bootloader.bat

View File

@ -2,12 +2,15 @@ rem Depends on ST Link and ST VCP being installed manually
rm -rf silent_st_drivers/ST-LINK_USB_V2_1_Driver
rm -rf silent_st_drivers/"Virtual comport driver"
rem Just safer not to have the folder at all
rm -rf silent_st_drivers/DFU_Driver
cp -r "C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK_USB_V2_1_Driver" silent_st_drivers
rem https://github.com/rusefi/rusefi_external_utils/blob/master/stsw-stm32102_1_4_0.zip
cp -r "C:\Program Files (x86)\STMicroelectronics\Software\Virtual comport driver" silent_st_drivers
cp -r "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\Drivers\DFU_Driver" silent_st_drivers
cp install_elevated_STM32Bootloader.bat silent_st_drivers\DFU_Driver
rem compress 'silent_st_drivers' folder
"C:\Program Files\7-Zip\7z.exe" a silent_st_drivers2.exe -mmt -mx5 -sfx silent_st_drivers

View File

@ -62,7 +62,8 @@ echo Done installing ST-Link silently
pwd
cd DFU_Driver
STM32Bootloader.bat
echo "Now installing stm32bootloader driver"
install_elevated_STM32Bootloader.bat
cd ..
exit

View File

@ -62,7 +62,8 @@ echo Done installing ST-Link silently
pwd
cd DFU_Driver
STM32Bootloader.bat
echo "Now installing stm32bootloader driver"
install_elevated_STM32Bootloader.bat
cd ..
exit