-
Notifications
You must be signed in to change notification settings - Fork 9
/
update.bat
57 lines (45 loc) · 1.27 KB
/
update.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
pushd %~dp0
:: windows double click implies to get a pause to see the errors
set EXPLORERCALL=0
if %0 == "%~0" ( set EXPLORERCALL=1 )
:: get current version
if not exist "VERSION" call :error_prompt "VERSION file is missing" && exit /b 1
set /p ver=<"VERSION"
echo Yass current version: %ver%
:: reset changes
git reset --hard
if %errorlevel% neq 0 call :error_prompt && exit /b 1
:: back to latest
git checkout release
if %errorlevel% neq 0 call :error_prompt && exit /b 1
:: pull for update
git pull
if %errorlevel% neq 0 call :error_prompt && exit /b 1
:: update submodules also
git submodule update --init
if %errorlevel% neq 0 call :error_prompt && exit /b 1
set /p yn="Do you want to keep setup folder? [Y]es [N]o"
if /I "%yn%" NEQ "y" (
echo "Remove setup folder"
rmdir /s /q "setup/" 2> NUL
del setup.sql
del setup.conf
)
php .migration %ver%
if %errorlevel% neq 0 call :error_prompt && exit /b 1
echo.
:: get current version
if not exist "VERSION" call :error_prompt "VERSION file is missing" && exit /b 1
set /p ver=<"VERSION"
echo Yass new current version: %ver%
:: ----------------------
goto :success_end
:success_end
if %EXPLORERCALL% == 1 ( pause )
exit /b 0
:error_prompt
if "%~1" neq "" echo %~1
if %EXPLORERCALL% == 1 ( pause )
exit /b 0