-
Notifications
You must be signed in to change notification settings - Fork 9
/
installer.bat
71 lines (71 loc) · 2.02 KB
/
installer.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
@ECHO off
TITLE KarmaBot Installer for Windows
SET root=%~dp0
CD /D %root%
SET "rootdir=%cd%"
SET "installtemp=%root%KarmaBotTemp\"
IF EXIST "%installtemp%" ( RMDIR "%installtemp%" /S /Q >nul 2>&1)
timeout /t 5
node --version >nul 2>&1 || GOTO :node
git --version >nul 2>&1 || GOTO :git
:start
MKDIR "%root%KarmaBotTemp"
CD /D "%installtemp%"
ECHO Downloading KarmaBot...
ECHO.
git clone -b master --recursive --depth 1 --progress https://github.com/shikhir-arora/karma-simple.git >nul
IF %ERRORLEVEL% EQU 128 (GOTO :errorgit)
TITLE Installing Node modules..
ECHO.
npm install --build-from-source --force >nul 2>&1
MKDIR "karmaStore"
ECHO Modules installed..Cleaning up..
ECHO.
IF EXIST "%root%karma-simple\" (GOTO :removedirec) ELSE (GOTO :copydirec)
:removedirec
RMDIR "%root%karma-simple\" /S /Q >nul 2>&1
ROBOCOPY "%root%KarmaBotTemp" "%rootdir%" /E /MOVE >nul 2>&1
IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
GOTO end
:copydirec
ROBOCOPY "%root%KarmaBotTemp" "%rootdir%" /E /MOVE >nul 2>&1
IF %ERRORLEVEL% GEQ 8 (GOTO :copyerror)
GOTO end
:git
TITLE Error!
ECHO Git not found, please download here: https://git-scm.com/download/win
ECHO Press any key to exit.
PAUSE >nul 2>&1
CD /D "%root%"
GOTO :EOF
:node
TITLE Error!
ECHO Node not found, please download Node v8 (the latest) here: https://nodejs.org/en/download/current/
ECHO Press any key to exit.
PAUSE >nul 2>&1
CD /D "%root%"
GOTO :EOF
:errorgit
ECHO.
ECHO Git clone failed, retrying..
RMDIR "%installtemp%" /S /Q >nul 2>&1
GOTO :start
:copyerror
TITLE Copying Error!
ECHO.
ECHO An error in copying data has been encountered: %ERRORLEVEL%
ECHO.
ECHO Ensure you are running the installer as ADMINISTRATOR.
PAUSE >nul 2>&1
CD /D "%root%"
GOTO :EOF
:end
TITLE KarmaBot Installation complete! Edit config.json and follow the README to finish
ECHO All files should be in the root directory in a folder called karma-simple
CD /D "%root%"
RMDIR /S /Q "%installtemp%" >nul 2>&1
ECHO.
ECHO Installation complete!
ECHO.
timeout /t 5
del installer.bat