diff --git a/acrobat-plugin/install.bat b/acrobat-plugin/install.bat index b06fccc..056e67a 100644 --- a/acrobat-plugin/install.bat +++ b/acrobat-plugin/install.bat @@ -14,6 +14,38 @@ set "INSTALL_DIR=%LOCALAPPDATA%\CopydevImposingAcrobat" set "REPO_DIR=%INSTALL_DIR%\repo" set "GITEA_REPO=https://git.copydev.fr/jules/copydev-imposing-tool.git" set "GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.2/MinGit-2.47.1.2-64-bit.zip" +set "BAT_RAW_URL=https://git.copydev.fr/jules/copydev-imposing-tool/raw/branch/master/acrobat-plugin/install.bat" + +:: ============================================================ +:: AUTO-MISE A JOUR DU SCRIPT +:: ============================================================ +:: On ne se met a jour que si on n'est pas deja en train de le faire +:: (le flag __noupdate__ evite une boucle infinie) +if "%~2" neq "__noupdate__" ( + echo Verification de mise a jour du script... + set "BAT_TMP=%TEMP%\install_imposing_new.bat" + powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; try { Invoke-WebRequest -Uri '%BAT_RAW_URL%' -OutFile '%TEMP%\install_imposing_new.bat' -UseBasicParsing -TimeoutSec 5 } catch { exit 1 }" >nul 2>&1 + if !ERRORLEVEL!==0 ( + fc /b "%~f0" "!BAT_TMP!" >nul 2>&1 + if !ERRORLEVEL! neq 0 ( + echo Nouvelle version detectee, mise a jour... + copy /y "!BAT_TMP!" "%~f0" >nul 2>&1 + if !ERRORLEVEL!==0 ( + del "!BAT_TMP!" 2>nul + echo Script mis a jour. Relancement... + timeout /t 2 >nul + cmd /k "%~f0" __started__ __noupdate__ + exit /b + ) + ) else ( + echo Script a jour. + ) + del "!BAT_TMP!" 2>nul + ) else ( + echo Impossible de verifier ^(pas de connexion ?^). On continue... + ) + echo. +) :: ============================================================ :MENU