Advertisement
eN-t

DMLizard v4.0

Jul 19th, 2013
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. title Initializing... please wait...
  3. setlocal EnableDelayedExpansion
  4. mode con:cols=105 lines=35
  5. color 07
  6. cls
  7.  
  8.  
  9. :init_paths
  10. REM Initialize paths
  11. cls
  12.  
  13. set PATH_ROOT=%~dp0
  14. set PATH_DATA=data_test
  15. set PATH_BATS=%PATH_DATA%\bat
  16. set PATH_EXEC=%PATH_DATA%\exe
  17. set PATH_TEMP=%PATH_DATA%\tmp
  18.  
  19. set SELF_VER0=v4.0
  20. set SELF_EXEC=update.exe
  21. set SELF_ZIPS=update.zip
  22.  
  23. set BATS_OFFL=%PATH_DATA%\connect.bat
  24. set BATS_UPDA=%PATH_DATA%\update.bat
  25. set BATS_INIT=%PATH_BATS%\init.bat
  26. set BATS_VER0=%PATH_BATS%\ver.txt
  27. set BATS_ZIPS=%PATH_TEMP%\bat.zip
  28.  
  29. set EXEC_UZIP=%PATH_EXEC%\unzip.exe
  30. set EXEC_WGET=%PATH_EXEC%\wget.exe
  31. set EXEC_VER0=%PATH_EXEC%\ver.txt
  32. set EXEC_ZIPS=%PATH_TEMP%\exe.zip
  33.  
  34. set UPDA_SELF=1
  35. set UPDA_BATS=1
  36. set UPDA_EXEC=1
  37.  
  38. if exist "%PATH_TEMP%" rmdir /S /Q "%PATH_TEMP%"
  39. if not exist "%PATH_DATA%" mkdir "%PATH_DATA%"
  40. if not exist "%PATH_BATS%" mkdir "%PATH_BATS%"
  41. if not exist "%PATH_EXEC%" mkdir "%PATH_EXEC%"
  42. if not exist "%PATH_TEMP%" mkdir "%PATH_TEMP%"
  43.  
  44. if exist "%SELF_EXEC%" del /F /Q "%SELF_EXEC%" >nul
  45. if exist "%SELF_ZIPS%" del /F /Q "%SELF_ZIPS%" >nul
  46.  
  47. move /Y "unzip.exe" "%EXEC_UZIP%"
  48. move /Y "wget.exe" "%EXEC_WGET%"
  49.  
  50.  
  51. :init_inet
  52. REM This is the url of the download server
  53. set DOWN_SERV=http://dmlizard.en-t.de/
  54.  
  55. REM This value is to determine offline mode
  56. set OFFL_MODE=1
  57.  
  58. REM Initialize internet access
  59. cls
  60. %EXEC_WGET% -q -O"%BATS_OFFL%" "%DOWN_SERV%/connect.bat"
  61. call %BATS_OFFL%
  62. del /F /Q %BATS_OFFL%
  63. if "%OFFL_MODE%"=="1" goto init_start
  64.  
  65.  
  66. :init_update
  67. REM Download latest bats and executables
  68. cls
  69. echo.
  70.  
  71. %EXEC_WGET% -q -O"%BATS_UPDA%" "%DOWN_SERV%/update_test.bat"
  72. call %BATS_UPDA%
  73.  
  74. if "%SELF_VER0%"=="%SELF_VER1%" set UPDA_SELF=0
  75. if exist "%BATS_VER0%" for /F "tokens=* delims=" %%i in ('type "%BATS_VER0%"') do (
  76.     if "%%i"=="%BATS_VER1%" set UPDA_BATS=0
  77. )
  78. if exist "%EXEC_VER0%" for /F "tokens=* delims=" %%i in ('type "%EXEC_VER0%"') do (
  79.     if "%%i"=="%EXEC_VER1%" set UPDA_EXEC=0
  80. )
  81.  
  82. if "%UPDA_SELF%"=="1" (
  83.     echo  Updates for DMLizard available [%SELF_VER1%]...
  84.     echo.
  85.     echo    Downloading newest DMLizard [%SELF_SIZE%]...
  86.     %EXEC_WGET% -q -O"%SELF_ZIPS%" "%SELF_LINK%"
  87.     echo    Installing newest DMLizard...
  88.     %EXEC_UZIP% -q -o "%SELF_ZIPS%"
  89.     ping -n 2 127.0.0.1 >nul
  90.     rmdir /S /Q "%PATH_DATA%" 2>nul >nul
  91.     rmdir /S /Q "%PATH_DATA%" 2>nul >nul
  92.     start "Update" "%SELF_EXEC%"
  93.     exit
  94. )
  95. if "%UPDA_BATS%"=="1" (
  96.     echo  Updates for BAT files available [%BATS_VER1%]...
  97.     echo.
  98.     echo    Downloading newest BAT files [%BATS_SIZE%]...
  99.     %EXEC_WGET% -q -O"%BATS_ZIPS%" "%BATS_LINK%"
  100.     echo    Installing newest BAT files...
  101.     %EXEC_UZIP% -q -o "%BATS_ZIPS%" -d "%PATH_BATS%"
  102.     echo    Updating BAT files done.
  103.     echo.
  104. )
  105. if "%UPDA_EXEC%"=="1" (
  106.     echo  Updates for EXE files available [%EXEC_VER1%]...
  107.     echo.
  108.     echo    Downloading newest EXE files [%EXEC_SIZE%]...
  109.     %EXEC_WGET% -q -O"%EXEC_ZIPS%" "%EXEC_LINK%"
  110.     echo    Installing newest EXE files...
  111.     %EXEC_UZIP% -q -o "%EXEC_ZIPS%" -d "%PATH_EXEC%"
  112.     echo    Updating EXE files done.
  113.     echo.
  114. )
  115. if "%UPDA_BATS%"=="1" goto init_paths
  116. if "%UPDA_EXEC%"=="1" goto init_paths
  117.  
  118.  
  119. :init_start
  120. REM Calling init routine
  121. cls
  122. if not exist "%BATS_INIT%" goto init_fail
  123. call %BATS_INIT%
  124. exit
  125.  
  126.  
  127. :init_fail
  128. echo.
  129. echo  Missing at least one required file. Please establish an internet connection and restart DMLizard.
  130. echo  DMLizard will automatically download the required files then.
  131. echo.
  132. echo  If nothing else helps, delete everything but the DMLizard executable and try again later.
  133. echo.
  134. pause
  135. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement