forked from to4kin/RKStation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTART.BAT
78 lines (64 loc) · 2.3 KB
/
START.BAT
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
@ECHO OFF
CALL PARAMS.BAT
IF EXIST %LOGDIR%\NUL GOTO LOGEXIST
MKDIR %LOGDIR%
:LOGEXIST
ECHO ==========================Ag Group RK6 START Utility============================>> %MAINLOG%
TIMENOW >> %MAINLOG%
ECHO Checking %UNZIPDIR%... >> %MAINLOG%
IF EXIST %UNZIPDIR%\NUL GOTO UZDEXIST
ECHO Creating %UNZIPDIR%... >> %MAINLOG%
MKDIR %UNZIPDIR%
:UZDEXIST
ECHO %UNZIPDIR% EXIST... >> %MAINLOG%
ECHO Checking %BUNDLEDIR%... >> %MAINLOG%
IF EXIST %BUNDLEDIR%\NUL GOTO BNDLEXST
ECHO Creating %BUNDLEDIR%... >> %MAINLOG%
MKDIR %BUNDLEDIR%
:BNDLEXST
ECHO Update DHCP lease >> %MAINLOG%
DHCP
IF %ERRORLEVEL% == 0 GOTO DHCPOK
ECHO START DHCP: ERROR >> %MAINLOG%
GOTO END
:DHCPOK
ECHO START DHCP: OK >> %MAINLOG%
ECHO Getting %MD5% from %SERVER%... >> %MAINLOG%
HTGET %SERVER%/%MD5% > %UNZIPDIR%\%MD5%
IF %ERRORLEVEL% == 21 GOTO MD5GETOK
ECHO Cannot get %MD5% from %SERVER%... >> %MAINLOG%
GOTO END
:MD5GETOK
ECHO Getting successfully %MD5% from %SERVER%... >> %MAINLOG%
ECHO Compare %BUNDLEDIR%\%BUNDLE%.zip MD5... >> %MAINLOG%
TYPE %UNZIPDIR%\%MD5% | FAM /M1=%BUNDLE%.zip \F0 | TR a-f A-F | PIPESET NEWMD5
MD5 %BUNDLEDIR%\%BUNDLE%.zip | FAM \F3 | TR a-f A-F | PIPESET OLDMD5
IF "%NEWMD5%" == "%OLDMD5%" GOTO BDMD5OK
ECHO Getting %BUNDLE%.zip from %SERVER%... >> %MAINLOG%
HTGET %SERVER%/%BUNDLE%.zip > %BUNDLEDIR%\%BUNDLE%.zip
IF %ERRORLEVEL% == 21 GOTO BDGETOK
ECHO Cannot get %BUNDLE%.zip... >> %MAINLOG%
GOTO END
:BDGETOK
ECHO Getting successfully %BUNDLE%.zip from %SERVER%... >> %MAINLOG%
ECHO Compare %BUNDLEDIR%\%BUNDLE%.zip MD5... >> %MAINLOG%
TYPE %UNZIPDIR%\%MD5% | FAM /M1=%BUNDLE%.zip \F0 | TR a-f A-F | PIPESET NEWMD5
MD5 %BUNDLEDIR%\%BUNDLE%.zip | FAM \F3 | TR a-f A-F | PIPESET OLDMD5
IF "%NEWMD5%" == "%OLDMD5%" GOTO BDMD5OK
ECHO MD5 Verification faild: %NEWMD5% ne %OLDMD5% >> %MAINLOG%
GOTO END
:BDMD5OK
ECHO MD5 Verification successfully: %NEWMD5% eq %OLDMD5% >> %MAINLOG%
ECHO Unzip %BUNDLEDIR%\%BUNDLE%.zip to %UNZIPDIR%
UNZIP32 -jo %BUNDLEDIR%\%BUNDLE%.zip -d %UNZIPDIR%
IF %ERRORLEVEL% == 0 GOTO UNZIPOK
ECHO Cannot unzip %BUNDLEDIR%\%BUNDLE%.zip to %UNZIPDIR%... >> %MAINLOG%
GOTO END
:UNZIPOK
ECHO Unzip successfully %BUNDLEDIR%\%BUNDLE%.zip to %UNZIPDIR%
ECHO Start %GO%... >> %MAINLOG%
CALL %GO%
:END
TIMENOW >> %MAINLOG%
ECHO ===============================START COMPLETED==================================>> %MAINLOG%
ECHO.