-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.bat
65 lines (55 loc) · 1.09 KB
/
build.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
@echo off
:config
call .\scripts\utils\config.bat
set BUILD_NAME=%1
shift
if "%BUILD_NAME%" equ "" (
echo Please give me a name for the thing you want to build.
goto end
)
if "%1" equ "" (
echo Don't know what packs to use.
call:showPacks
goto end
)
goto buildstructure
:buildstructure
for /f %%a in (%STRUCTURE_FILE%) do (
echo %TMP_DIR%\%%~a
mkdir "%TMP_DIR%\%%~a"
)
goto build
:build
for %%a in (%*) do (
if [%%a] equ [%BUILD_NAME%] (
echo.
) else (
call:unpack %%a
)
)
goto pack
:pack
if exist "%BUILD_DIR%\%BUILD_NAME%.zip" ( del %BUILD_DIR%\%BUILD_NAME%.zip )
7za a -tzip "%BUILD_DIR%\%BUILD_NAME%.zip" "%TMP_DIR%\*" ".\data\portable.cmd" -mx9 -mm=LZMA -mmt2
if %ERRORLEVEL% neq 0 goto error
goto end
:error
echo ERROR
goto end
:: FUNCTIONS
:showPacks
:: Print packs to screen.
echo Packs:
for /R "%DATA_DIR%\packs" %%a in (*.txt) do (
echo %%~na
)
goto:eof
:unpack
:: Copy pack to usr\local\vendor
:: %~1 - name of pack
7za x "%DIST_DIR%\%~1.zip" -o"%TMP_DIR%\usr\local\"
if %ERRORLEVEL% neq 0 goto error
goto:eof
:: END OF FUNCTIONS
:end
call .\scripts\utils\end.bat