Installer: Add scripts.

This commit is contained in:
Nodir Temirkhodjaev 2017-09-11 15:49:25 +05:00
parent ebb0401014
commit 85fd86c1cb
7 changed files with 114 additions and 52 deletions

51
deploy/FortFirewall.iss Normal file
View File

@ -0,0 +1,51 @@
#include AddBackslash(SourcePath) + "..\src\common\version.h"
#define APP_PUBLISHER "Nodir Temirkhodjaev"
#define APP_URL "https://github.com/tnodir"
#define APP_EXE_NAME "FortFirewall.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppName={#APP_NAME}
AppVersion={#APP_VERSION_STR}
AppVerName={#APP_NAME}
AppCopyright=Copyright (C) 2015 Nodir Temirkhodjaev
AppPublisher={#APP_PUBLISHER}
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_URL}
AppUpdatesURL={#APP_UPDATES_URL}
DefaultGroupName={#APP_NAME}
DefaultDirName={pf32}\{#APP_NAME}
AlwaysShowDirOnReadyPage=yes
AlwaysShowGroupOnReadyPage=yes
AllowNoIcons=yes
OutputBaseFilename=FortFirewall-{#APP_VERSION_STR}
UninstallFilesDir={app}\uninst
ArchitecturesInstallIn64BitMode=x64
Compression=lzma2/ultra
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: ".\build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
; Start menu shortcut
Name: "{group}\{#APP_NAME}"; Filename: "{app}\{#APP_EXE_NAME}"; IconFilename: "{app}\fort.ico"
; Unistaller shortcut
Name: "{group}\{cm:UninstallProgram,{#APP_NAME}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\fort.ico"
[Run]
Filename: "{app}\driver\scripts\install.bat"; Description: "Install driver"; Flags: runascurrentuser
[UninstallRun]
Filename: "{app}\driver\scripts\uninstall.bat"; Flags: runascurrentuser
[UninstallDelete]
Type: filesandordirs; Name: "{localappdata}\{#APP_NAME}"
Type: filesandordirs; Name: "{app}"

View File

@ -0,0 +1,4 @@
@echo off
set INNO_PATH=D:\Utils\Dev\InnoSetup5\ISCC.exe
%INNO_PATH% FortFirewall.iss

4
deploy/prepare.bat Normal file
View File

@ -0,0 +1,4 @@
@echo off
set QT_BIN_PATH=D:\opt\qt5\qtbase\bin
%QT_BIN_PATH%\windeployqt --release --qmldir ..\src\ui\qml --dir build build\FortFirewall.exe

View File

@ -4,7 +4,7 @@
@set PLAT=%1
@set OutDir=.\
@set OutDir=..\..\deploy\build\driver\
@set IntDir=.\build\
MSBuild fortdrv.vcxproj /p:OutDir=%OutDir%;IntDir=%IntDir%;Platform=%PLAT%

View File

@ -2,84 +2,87 @@
@set DISPNAME=Fort Firewall
@set CERTNAME=FortFirewallTestCert
@set CERTPATH=%~dp0\%CERTNAME%.cer
@set CERTPATH=%~dp0%CERTNAME%.cer
@set ARCH=32
@if defined PROGRAMFILES(X86) @set ARCH=64
@set BASENAME=fortfw
@set FILENAME=%BASENAME%%ARCH%.sys
@set SRCPATH=%~dp0\..\%FILENAME%
@set SRCPATH=%~dp0..\%FILENAME%
@set DSTPATH=%SystemRoot%\System32\drivers\%BASENAME%.sys
@rem Copy driver to system storage
if exist "%DSTPATH%" (
echo Error: Already installed. Uninstall it first
set RCODE=1
goto EXIT
@if exist "%DSTPATH%" (
@echo Error: Driver already installed. Uninstall it first
@set RCODE=1
@goto EXIT
)
copy %SRCPATH% %DSTPATH%
if ERRORLEVEL 1 (
echo Error: Cannot copy driver to system
set RCODE=%ERRORLEVEL%
goto EXIT
copy "%SRCPATH%" "%DSTPATH%"
@if ERRORLEVEL 1 (
@echo Error: Cannot copy driver to system
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
@rem Create testing certificate
if exist %CERTPATH% (
goto CERT_ADDED
@if exist "%CERTPATH%" (
@goto CERT_ADDED
)
MakeCert -r -pe -ss "%DISPNAME%" -n "CN=%CERTNAME%" %CERTPATH%
if ERRORLEVEL 1 (
echo Error: Cannot create certificate
set RCODE=%ERRORLEVEL%
goto EXIT
MakeCert -r -pe -ss "%DISPNAME%" -n "CN=%CERTNAME%" "%CERTPATH%"
@if ERRORLEVEL 1 (
@echo Error: Cannot create certificate
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
CertMgr /add %CERTPATH% /s /r localMachine root
if ERRORLEVEL 1 (
echo Error: Cannot add certificate to store
set RCODE=%ERRORLEVEL%
goto EXIT
CertMgr /add "%CERTPATH%" /s /r localMachine root
@if ERRORLEVEL 1 (
@echo Error: Cannot add certificate to store
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
Del %CERTPATH%
Del "%CERTPATH%"
:CERT_ADDED
@rem Sign the driver
SignTool sign /a /v /s "%DISPNAME%" /n %CERTNAME% "%DSTPATH%"
if ERRORLEVEL 1 (
echo Error: Cannot sign the driver
set RCODE=%ERRORLEVEL%
goto EXIT
SignTool sign /a /v /s "%DISPNAME%" /n "%CERTNAME%" "%DSTPATH%"
@if ERRORLEVEL 1 (
@echo Error: Cannot sign the driver
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
@rem Create service
sc create %BASENAME% binPath= "%DSTPATH%" type= kernel start= auto DisplayName= "%DISPNAME%"
if ERRORLEVEL 1 (
echo Error: Cannot create a service
set RCODE=%ERRORLEVEL%
goto EXIT
@if ERRORLEVEL 1 (
@echo Error: Cannot create a service
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
sc start %BASENAME%
if ERRORLEVEL 1 (
echo Error: Cannot start the service
set RCODE=%ERRORLEVEL%
goto EXIT
@if ERRORLEVEL 1 (
@echo Error: Cannot start the service
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
set RCODE=0
goto EXIT
@set RCODE=0
@goto EXIT
:EXIT
echo End execution... Error Code = %RCODE%
exit /b %RCODE%
@echo End execution... Error Code = %RCODE%
@if %RCODE% neq 0 (
@pause
)
@exit /b %RCODE%

View File

@ -9,24 +9,24 @@
@rem Remove the service
sc stop %BASENAME%
sc delete %BASENAME%
if ERRORLEVEL 1 (
echo Error: Cannot delete the service
set RCODE=%ERRORLEVEL%
goto EXIT
@if ERRORLEVEL 1 (
@echo Error: Cannot delete the service
@set RCODE=%ERRORLEVEL%
@goto EXIT
)
@rem Remove driver from system storage
Del %DSTPATH%
Del "%DSTPATH%"
@rem Remove driver from system storage
CertMgr /del /c /n "%CERTNAME%" -s -r localMachine Root
set RCODE=0
goto EXIT
@set RCODE=0
@goto EXIT
:EXIT
echo End execution... Error Code = %RCODE%
exit /b %RCODE%
@echo End execution... Error Code = %RCODE%
@exit /b %RCODE%

View File

@ -86,7 +86,7 @@ LIBS += -lfwpuclnt -lkernel32 -lpsapi -luser32 -luuid -lws2_32
RC_FILE = fort.rc
# Kernel Driver
{
installer_build {
BUILDCMD = MSBuild $$PWD/../driver/fortdrv.vcxproj /p:OutDir=./;IntDir=$$OUT_PWD/driver/
fortdrv32.target = $$PWD/../driver/fortfw32.sys