-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.bat
55 lines (46 loc) · 1.19 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
@echo off
setlocal
REM Extract version from package.json using jq
for /f "tokens=*" %%i in ('jq -r ".version" package.json') do set VERSION=%%i
REM Echo installation message
echo.
echo Installing s3b-server...
echo Version: %VERSION%
echo ----------------------------------
echo.
echo > Installing dependencies...
REM Install npm packages locally and globally
npm install
call :checkAdmin
if %isAdmin%==true (
npm install -g pm2
) else (
echo Please run this script as an administrator to install global npm packages.
exit /b 1
)
REM Create /volume directory and set permissions
set VOLUME_DIR=~\volume
echo.
echo > Creating cloud directory %VOLUME_DIR%...
REM Check if directory doesn't exist
if not exist %VOLUME_DIR% (
mkdir %VOLUME_DIR%
)
echo > Changing owner of %VOLUME_DIR% %USERNAME%
REM Windows does not have chown; setting permissions is more complex and may require icacls
icacls %VOLUME_DIR% /grant %USERNAME%:F /T /C
REM Clean up install.bat if no longer needed
echo.
echo > Cleaning up project...
del /f install.bat
del /f install.sh
echo > Done.
goto :eof
:checkAdmin
net session >nul 2>&1
if %errorlevel%==0 (
set isAdmin=true
) else (
set isAdmin=false
)
goto :eof