-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.bat
129 lines (107 loc) · 4.24 KB
/
install.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@echo off
SETLOCAL EnableDelayedExpansion
title FlowFuse Installer
REM #### Setup the environment ####################################
set MIN=20
set VERSION=Unknown
set NPMMIN=8
set NPMVERSION=Unknown
REM #### Print header #############################################
echo **************************************************************
echo * *
echo * FlowFuse Installer *
echo * *
echo **************************************************************
REM #### Check NodeJS #############################################
echo * *
echo * Checking NodeJS... *
where node >nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
call :PRINT "> Not Found!"
goto :node_problem
) else (
FOR /F "tokens=1delims=v." %%i in ('node --version') do (
set VERSION=%%i
)
call :PRINT "> Found version !VERSION!"
if !VERSION! GEQ %MIN% (
REM Success version OK, continue installation
) else (
goto :node_problem
)
)
REM #### Check NPM ################################################
echo * *
echo * Checking NPM... *
where npm >nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
call :PRINT "> Not Found!"
goto :npm_problem
) else (
FOR /F "tokens=1delims=." %%i IN ('npm --version') DO (
set NPMVERSION=%%i
)
call :PRINT "> Found version !NPMVERSION!"
if !NPMVERSION! GEQ %NPMMIN% (
REM Success version OK, continue installation
) else (
goto :npm_problem
)
)
REM #### Begin Installation #######################################
echo * *
echo * Installing FlowFuse... *
title FlowFuse Installer - Installing
REM Clean up before install
cd app
if exist node_modules rd /q /s node_modules
if exist package-lock.json del /q package-lock.json
REM #### Install FlowFuse #########################################
call npm install --production --no-fund --no-audit --silent
cd ..
copy /Y app\node_modules\@flowfuse\flowfuse\etc\flowforge.yml etc > nul
copy /Y app\node_modules\@flowfuse\file-server\etc\flowforge-storage.yml etc > nul
call :PRINT "> FlowFuse Install Complete"
REM #### Install Node-RED Stack ###################################
echo * *
echo * Installing latest Node-RED as a stack... *
call bin\ff-install-stack.bat latest
call :PRINT "> Node-RED Stack Install Complete"
REM #### All done, print final part ###############################
echo * *
echo * FlowFuse can be started with bin\flowfuse.bat *
echo * *
echo **************************************************************
title FlowFuse Installer - Complete
goto :the_end
REM #### NodeJS Problem ###########################################
:node_problem
title FlowFuse Installer - NodeJS Problem
call :PRINT "> NodeJS version !MIN! or newer is required"
echo * Please install latest LTS release from *
echo * https://nodejs.org/en/download/ *
echo * And ensure to install build tools when asked *
echo * *
echo **************************************************************
echo.
pause
exit /B 1
REM #### NPM Problem ##############################################
:npm_problem
title FlowFuse Installer - NPM Problem
call :PRINT "> NPM version !NPMMIN! or newer is required"
echo * Please check your NPM installation *
echo * *
echo **************************************************************
echo.
pause
exit /B 2
REM #### Print Subroutine #########################################
:PRINT
set "LINE=%~1 "
echo * !LINE:~0,58! *
exit /b
REM #### The End ##################################################
:the_end
echo.
pause