forked from jeog/TOSDataBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtosdb-setup.bat
104 lines (85 loc) · 3 KB
/
tosdb-setup.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@echo off
NET FILE 1>NUL 2>NUL &
IF %ERRORLEVEL% NEQ 0 (
echo tosdb-setup.bat must be run as administrator.
EXIT /B 1
)
set bCRTfiles=false
IF EXIST C:/Windows/System32/msvcr110.dll (
IF EXIST C:/Windows/System32/msvcp110.dll (
set bCRTfiles=true
)
)
set servCmd=""
IF /I "%2"=="admin" (
set servCmd=" --admin %3"
) else (
set servCmd=" %2"
)
IF "%1"=="x64" (
echo + Checking for VC++ Redistributable Files ...
IF %bCRTfiles%==false (
echo ++ Not Found. Installing VC++ Redistributable ...
vcredist_x64.exe
IF ERRORLEVEL 1 (
echo - Installation failed, exiting setup...
EXIT /B 1
)
)
echo + Checking for binaries...
IF NOT EXIST %cd%\\bin\\Release\\x64\\tos-databridge-serv-x64.exe (
echo - Can't find "%cd%\\bin\\Release\\x64\\tos-databridge-serv-x64.exe", exiting setup...
EXIT /B 1
)
IF NOT EXIST %cd%\\bin\\Release\\x64\\tos-databridge-engine-x64.exe (
echo - Can't find "%cd%\\bin\\Release\\x64\\tos-databridge-engine-x64.exe", exiting setup...
EXIT /B 1
)
echo + Creating TOSDataBridge Service ...
SC stop TOSDataBridge 1>NUL 2>NUL
SC delete TOSDataBridge 1>NUL 2>NUL
SC create TOSDataBridge binPath= %cd%\\bin\\Release\\x64\\tos-databridge-serv-x64.exe%servCmd%
IF ERRORLEVEL 1 (
echo - SC create failed, exiting setup...
EXIT /B 1
)
) else (
IF "%1"=="x86" (
echo + Checking for VC++ Redistributable Files ...
IF EXIST C:/Windows/SysWOW64 set bCRTfiles=false
IF EXIST C:/Windows/SysWOW64/msvcr110.dll (
IF EXIST C:/Windows/SysWOW64/msvcp110.dll (
set bCRTfiles=true
)
)
IF %bCRTfiles%==false (
echo ++ Not Found. Installing VC++ Redistributable ...
vcredist_x86.exe
IF ERRORLEVEL 1 (
echo - Installation failed, exiting setup...
EXIT /B 1
)
)
echo + Checking for binaries...
IF NOT EXIST %cd%\\bin\\Release\\Win32\\tos-databridge-serv-x86.exe (
echo - Can't find "%cd%\\bin\\Release\\Win32\\tos-databridge-serv-x86.exe", exiting setup...
EXIT /B 1
)
IF NOT EXIST %cd%\\bin\\Release\\Win32\\tos-databridge-engine-x86.exe (
echo - Can't find "%cd%\\bin\\Release\\Win32\\tos-databridge-engine-x86.exe", exiting setup...
EXIT /B 1
)
echo + Creating TOSDataBridge Service ...
SC stop TOSDataBridge 1>NUL 2>NUL
SC delete TOSDataBridge 1>NUL 2>NUL
SC create TOSDataBridge binPath= %cd%\bin\Release\Win32\tos-databridge-serv-x86.exe%servCmd%
IF ERRORLEVEL 1 (
echo - SC create failed, exiting setup...
EXIT /B 1
)
) else (
echo - Invalid Command Line Argument. Use 'x86' or 'x64' to signify which build to setup.
EXIT /B 1
)
)
EXIT /B 0