feat(installer): add .lic license file initialization step during installation on Windows and Linux
This commit is contained in:
@@ -17,6 +17,10 @@ VIAddVersionKey "FileVersion" "0.3.1.0"
|
||||
VIAddVersionKey "ProductVersion" "0.3.1.0"
|
||||
|
||||
Var DATADIR
|
||||
Var LICFILE
|
||||
Var LicDialog
|
||||
Var LicFileInput
|
||||
Var LicBrowseBtn
|
||||
|
||||
# --- UI Pages ---
|
||||
!define MUI_ABORTWARNING
|
||||
@@ -40,6 +44,9 @@ Var DATADIR
|
||||
!define MUI_DIRECTORYPAGE_VARIABLE $DATADIR
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
|
||||
# Custom Page: License File Selection
|
||||
Page custom LicensePageCreate LicensePageLeave
|
||||
|
||||
# Instfiles Page
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
@@ -57,8 +64,44 @@ Var DATADIR
|
||||
Function .onInit
|
||||
SetShellVarContext all
|
||||
StrCpy $DATADIR "$APPDATA\LOGAR-Server"
|
||||
StrCpy $LICFILE ""
|
||||
FunctionEnd
|
||||
|
||||
Function LicensePageCreate
|
||||
nsDialogs::Create 1018
|
||||
Pop $LicDialog
|
||||
${If} $LicDialog == error
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
!insertmacro MUI_HEADER_TEXT "Enterprise License Activation (Optional)" "Choose a .lic license file to activate your server during installation."
|
||||
|
||||
${NSD_CreateLabel} 0 0 100% 30u "If you have received an activated .lic license file, select it below to activate the server immediately.$\r$\n$\r$\nLeave this field blank to use the default evaluation license."
|
||||
Pop $0
|
||||
|
||||
${NSD_CreateText} 0 38u 75% 12u "$LICFILE"
|
||||
Pop $LicFileInput
|
||||
|
||||
${NSD_CreateButton} 78% 37u 22% 14u "Browse..."
|
||||
Pop $LicBrowseBtn
|
||||
${NSD_OnClick} $LicBrowseBtn OnBrowseLic
|
||||
|
||||
nsDialogs::Show
|
||||
Function
|
||||
|
||||
Function OnBrowseLic
|
||||
nsDialogs::SelectFileDialog open "" "LOGAR License Files (*.lic)|*.lic|All Files (*.*)|*.*"
|
||||
Pop $0
|
||||
${If} $0 != ""
|
||||
StrCpy $LICFILE $0
|
||||
${NSD_SetText} $LicFileInput $LICFILE
|
||||
${EndIf}
|
||||
Function
|
||||
|
||||
Function LicensePageLeave
|
||||
${NSD_GetText} $LicFileInput $LICFILE
|
||||
Function
|
||||
|
||||
Section "Install"
|
||||
SetShellVarContext all
|
||||
SetOutPath "$INSTDIR"
|
||||
@@ -69,6 +112,12 @@ Section "Install"
|
||||
CreateDirectory "$DATADIR"
|
||||
ExecWait 'icacls "$DATADIR" /grant "*S-1-5-32-545:(OI)(CI)M" /T /Q'
|
||||
|
||||
# If license file was selected, import before starting service
|
||||
${If} $LICFILE != ""
|
||||
${AndIf} ${FileExists} "$LICFILE"
|
||||
ExecWait '"$INSTDIR\Server.exe" --config "$DATADIR\server_config.json" --import-lic "$LICFILE"'
|
||||
${EndIf}
|
||||
|
||||
# Install and configure service via NSSM
|
||||
ExecWait '"$INSTDIR\nssm.exe" install LOGAR_Server "$INSTDIR\Server.exe"'
|
||||
ExecWait '"$INSTDIR\nssm.exe" set LOGAR_Server AppDirectory "$INSTDIR"'
|
||||
|
||||
Reference in New Issue
Block a user