|
1 | 1 | @ECHO OFF
|
2 |
| -:: Build script by A. Fischer and F. Roth |
3 |
| -:: November 2017 |
| 2 | +REM Building LOKI |
4 | 3 |
|
5 | 4 | setlocal enabledelayedexpansion
|
6 | 5 |
|
7 |
| -if exist "C:\Python27-x64\" ( |
8 |
| - SET PY=C:\Python27-x64\python.exe |
9 |
| - SET PYI=C:\Python27-x64\Scripts\pyinstaller.exe |
10 |
| -) else ( |
11 |
| - SET PY=C:\Python27\python.exe |
12 |
| - SET PYI=C:\Python27\Scripts\pyinstaller.exe |
13 |
| - if not exist "%PY%" goto ERROR |
14 |
| - if not exist "%PYI%" goto ERROR |
15 |
| -) |
| 6 | +SET PACKAGE=%CD%\loki |
| 7 | +SET DIST=%CD%\dist |
| 8 | +SET PYI=pyinstaller |
16 | 9 |
|
17 | 10 | :: Cleaning all old versions
|
18 | 11 | RMDIR /S /Q build
|
19 | 12 |
|
20 |
| -ECHO ----------------------------------------- |
21 |
| -ECHO LOKI Build Script |
22 |
| -ECHO ----------------------------------------- |
23 |
| -ECHO Checking prerequisites and configuration ... |
24 |
| - |
25 |
| -:: Windows 2003 Support |
26 |
| -:: |
27 |
| -ECHO Checking for msvcr100.dll in order to provide Windows 2003 support ... |
28 |
| -SET WIN2003= |
29 |
| -if not exist "%SystemRoot%\System32\msvcr100.dll" ( |
30 |
| - echo File %SystemRoot%\System32\msvcr100.dll not found. |
31 |
| - echo No support for Windows 2003 server systems. |
32 |
| - echo Download and install https://www.microsoft.com/en-us/download/details.aspx?id=26999 if you need that support |
33 |
| -) else ( |
34 |
| - echo Required file msvcr100.dll found. Windows 2003 will be supported. |
35 |
| - SET WIN2003=-win2003sup |
36 |
| -) |
37 |
| - |
38 |
| -:: Private Rules |
39 |
| -:: See https://github.com/Neo23x0/Loki/#package-loki-with-a-custom-ruleset for details |
40 |
| -SET PRIVRULES=no |
41 |
| -%PY% loki-package-builder.py --ruledir "%cd%\private-signatures" --target rules |
| 13 | +:: BUILD LOKI |
| 14 | +ECHO Compiling LOKI ... |
| 15 | +%PYI% --noupx loki.spec |
42 | 16 | if !errorlevel! neq 0 GOTO ERROR
|
43 |
| -if exist "%cd%\rules" ( |
44 |
| - echo Private signatures directory found. The contents will be encrypted and added to the package. |
45 |
| - SET PRIVRULES= |
46 |
| -) |
47 |
| - |
48 |
| -:: COMPILATION |
49 |
| -:: LOKI Upgrader |
50 | 17 | ECHO Compiling LOKI UPGRADER ...
|
51 |
| -%PYI% "%cd%\loki-upgrader%WIN2003%.spec" |
52 |
| -if !errorlevel! neq 0 GOTO ERROR |
53 |
| -:: LOKI |
54 |
| -ECHO Compiling LOKI ... |
55 |
| -%PYI% "%cd%\loki-%PRIVRULES%privrules%WIN2003%.spec" |
| 18 | +%PYI% --noupx loki-upgrader.spec |
56 | 19 | if !errorlevel! neq 0 GOTO ERROR
|
57 |
| -ECHO Check the ./dist directory for the compiled executables |
58 |
| -GOTO END |
| 20 | + |
| 21 | +:: Copy Executables and other files to the package folder |
| 22 | +move .\dist\loki.exe %PACKAGE%\ |
| 23 | +move .\dist\loki-upgrader.exe %PACKAGE%\ |
| 24 | +mkdir %PACKAGE%\tools |
| 25 | +copy .\tools\pe-sieve32.exe %PACKAGE%\tools |
| 26 | +copy .\tools\pe-sieve64.exe %PACKAGE%\tools |
| 27 | + |
| 28 | +:: Delete files |
| 29 | +REM DEL /Q %PACKAGE%\signature-base |
| 30 | +DEL /Q %PACKAGE%\*.log |
| 31 | +DEL /Q %DIST%\loki_%VER%.zip |
| 32 | +IF EXIST %PACKAGE%\signature-base ( |
| 33 | + rmdir %PACKAGE%\signature-base /s /q |
| 34 | +) |
59 | 35 |
|
60 | 36 | :ERROR
|
61 |
| -echo "An error occured. The build failed." |
| 37 | +ECHO An error occured. Build interrupted. |
62 | 38 |
|
63 | 39 | :END
|
64 |
| -:: CLEANUP |
65 |
| -ECHO Cleaning up ... |
66 |
| -del /f "%cd%\rules" |
67 |
| -del /f "%cd%\rules.key" |
68 | 40 |
|
0 commit comments