130 lines
4.6 KiB
Plaintext
130 lines
4.6 KiB
Plaintext
[Setup]
|
|
AppName=LOGAR Server
|
|
AppVersion=0.3.1
|
|
AppPublisher=LOGAR Security Systems
|
|
AppPublisherURL=https://logar.eibl.tech
|
|
AppSupportURL=https://logar.eibl.tech
|
|
AppUpdatesURL=https://logar.eibl.tech
|
|
DefaultDirName={autopf}\LOGAR-Server
|
|
OutputDir=..\dist
|
|
OutputBaseFilename=LOGAR-Server-Setup
|
|
PrivilegesRequired=admin
|
|
Compression=lzma
|
|
SolidCompression=yes
|
|
WizardStyle=modern
|
|
VersionInfoCompany=LOGAR Security Systems
|
|
VersionInfoDescription=LOGAR Cloud Hub & TCP Ingestion Server Setup
|
|
VersionInfoVersion=0.3.1.0
|
|
VersionInfoProductName=LOGAR Server
|
|
VersionInfoProductVersion=0.3.1
|
|
|
|
[Files]
|
|
Source: "..\dist\Server.exe"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "..\compilation\nssm.exe"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "..\dist\runtime\*"; DestDir: "{app}\runtime"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
|
|
[Dirs]
|
|
Name: "{code:GetDataDir}"; Permissions: users-modify
|
|
|
|
[Run]
|
|
Filename: "{app}\nssm.exe"; Parameters: "install LOGAR_Server ""{app}\Server.exe"""; Flags: runhidden
|
|
Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppDirectory ""{app}"""; Flags: runhidden
|
|
Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppStdout ""{code:GetDataDir}\server.log"""; Flags: runhidden
|
|
Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppStderr ""{code:GetDataDir}\server_err.log"""; Flags: runhidden
|
|
Filename: "{app}\nssm.exe"; Parameters: "set LOGAR_Server AppParameters ""--config """"{code:GetDataDir}\server_config.json"""""""; Flags: runhidden
|
|
Filename: "{app}\nssm.exe"; Parameters: "start LOGAR_Server"; Flags: runhidden
|
|
|
|
[UninstallRun]
|
|
Filename: "{app}\nssm.exe"; Parameters: "stop LOGAR_Server"; Flags: runhidden
|
|
Filename: "{app}\nssm.exe"; Parameters: "remove LOGAR_Server confirm"; Flags: runhidden
|
|
|
|
[UninstallDelete]
|
|
Type: filesandordirs; Name: "{app}\certs"
|
|
Type: files; Name: "{app}\server_config.json"
|
|
Type: files; Name: "{app}\logar_state.db"
|
|
Type: files; Name: "{app}\logar_state.db-*"
|
|
Type: files; Name: "{app}\*.log"
|
|
Type: filesandordirs; Name: "{app}\runtime"
|
|
Type: filesandordirs; Name: "{app}"
|
|
Type: filesandordirs; Name: "{commonappdata}\LOGAR-Server"
|
|
|
|
[Code]
|
|
var
|
|
DataDirPage: TInputDirWizardPage;
|
|
LicFilePage: TInputFileWizardPage;
|
|
|
|
procedure InitializeWizard;
|
|
begin
|
|
DataDirPage := CreateInputDirPage(
|
|
wpSelectDir,
|
|
'Data and Configuration Location',
|
|
'Where should LOGAR Server store its database, certificates, and configuration?',
|
|
'Select the folder where LOGAR Server should store the database (logar_state.db), configuration (server_config.json), and mTLS certificates.'#13#10#13#10 +
|
|
'By default, this is stored in Common AppData (C:\ProgramData\LOGAR-Server), which is accessible to background Windows services.',
|
|
False,
|
|
''
|
|
);
|
|
DataDirPage.Add('Data Directory:');
|
|
DataDirPage.Values[0] := ExpandConstant('{commonappdata}\LOGAR-Server');
|
|
|
|
LicFilePage := CreateInputFilePage(
|
|
DataDirPage.ID,
|
|
'Enterprise License Activation (Optional)',
|
|
'Do you have an activated .lic license file to import during installation?',
|
|
'Select your signed .lic file to activate the server immediately.'#13#10#13#10 +
|
|
'You can also leave this blank to initialize with a default evaluation license and activate later via the web dashboard.'
|
|
);
|
|
LicFilePage.Add('License File (.lic):', 'License Files (*.lic)|*.lic|All Files (*.*)|*.*', '.lic');
|
|
end;
|
|
|
|
function GetDataDir(Param: String): String;
|
|
begin
|
|
Result := DataDirPage.Values[0];
|
|
if Result = '' then
|
|
Result := ExpandConstant('{commonappdata}\LOGAR-Server');
|
|
end;
|
|
|
|
function GetLicFile(Param: String): String;
|
|
begin
|
|
Result := LicFilePage.Values[0];
|
|
end;
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
var
|
|
LicPath: String;
|
|
ResultCode: Integer;
|
|
begin
|
|
if CurStep = ssPostInstall then
|
|
begin
|
|
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Server', 'DataDir', GetDataDir(''));
|
|
|
|
LicPath := GetLicFile('');
|
|
if (LicPath <> '') and FileExists(LicPath) then
|
|
begin
|
|
Exec(
|
|
ExpandConstant('{app}\Server.exe'),
|
|
'--config "' + GetDataDir('') + '\server_config.json" --import-lic "' + LicPath + '"',
|
|
ExpandConstant('{app}'),
|
|
SW_HIDE,
|
|
ewWaitUntilTerminated,
|
|
ResultCode
|
|
);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
|
var
|
|
CustomDataDir: String;
|
|
begin
|
|
if CurUninstallStep = usPostUninstall then
|
|
begin
|
|
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Server', 'DataDir', CustomDataDir) then
|
|
begin
|
|
if (CustomDataDir <> '') and DirExists(CustomDataDir) then
|
|
DelTree(CustomDataDir, True, True, True);
|
|
RegDeleteKeyIncludingSubkeys(HKEY_LOCAL_MACHINE, 'Software\LOGAR\LOGAR-Server');
|
|
end;
|
|
end;
|
|
end;
|