#963: OGAgent Installer for Windows supports `/S /server IPAddress` parameters to assign the server IP address in silent mode and automatically starts the services just before finishing the installation.

remotes/github/oglive
Ramón M. Gómez 2020-03-11 11:47:57 +01:00
parent b18cd9b486
commit ad5af0bbe4
1 changed files with 14 additions and 8 deletions

View File

@ -95,7 +95,7 @@ Section -Main SEC0000
SectionEnd SectionEnd
Section -post SEC0001 Section -post SEC0001
WriteIniStr $INSTDIR\${CONFIGFILE} "opengnsys" "remote" "https://$SERVERIP_VALUE:8000/opengnsys/rest" WriteIniStr $INSTDIR\${CONFIGFILE} "opengnsys" "remote" "https://$SERVERIP_VALUE/opengnsys/rest"
SetShellVarContext current SetShellVarContext current
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR SetOutPath $INSTDIR
@ -130,6 +130,8 @@ Section -post SEC0001
nsExec::Exec /OEM "$INSTDIR\OGAgentService.exe --startup auto install" # Add service after installation nsExec::Exec /OEM "$INSTDIR\OGAgentService.exe --startup auto install" # Add service after installation
# Update recovery options # Update recovery options
nsExec::Exec /OEM "$INSTDIR\OGAServiceHelper.exe" nsExec::Exec /OEM "$INSTDIR\OGAServiceHelper.exe"
Exec "net start ogagent"
Exec "$INSTDIR\OGAgentUser.exe"
SectionEnd SectionEnd
# Macro for selecting uninstaller sections # Macro for selecting uninstaller sections
@ -178,6 +180,7 @@ SectionEnd
# Installer functions # Installer functions
Function .onInit Function .onInit
InitPluginsDir InitPluginsDir
Call GetParameters
StrCpy $StartMenuGroup "OpenGnsys Agent" StrCpy $StartMenuGroup "OpenGnsys Agent"
!insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_LANGDLL_DISPLAY
@ -192,13 +195,8 @@ Function un.onInit
!insertmacro SELECT_UNSECTION Main ${UNSEC0000} !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd FunctionEnd
# Server IP dialog box # Parameters dialog box
Function ParamsPage Function ParamsPage
# Get input parameter
${GetOptions} $CMDLINE "/server" $SERVERIP_VALUE
${If} $SERVERIP_VALUE == ""
StrCpy $SERVERIP_VALUE "192.168.2.10"
${EndIf}
nsDialogs::Create 1018 nsDialogs::Create 1018
Pop $0 Pop $0
${If} $0 == error ${If} $0 == error
@ -211,11 +209,19 @@ Function ParamsPage
nsDialogs::Show nsDialogs::Show
FunctionEnd FunctionEnd
# Get server IP # Get parameters from the dialog
Function ParamsPageLeave Function ParamsPageLeave
${NSD_GetText} $SERVERIP $SERVERIP_VALUE ${NSD_GetText} $SERVERIP $SERVERIP_VALUE
FunctionEnd FunctionEnd
# Assign input parameters or default values to variables
Function GetParameters
${GetOptions} $CMDLINE "/server" $SERVERIP_VALUE
${If} $SERVERIP_VALUE == ""
StrCpy $SERVERIP_VALUE "192.168.2.10"
${EndIf}
FunctionEnd
# Installer Language Strings # Installer Language Strings
LangString ServerLabel ${LANG_ENGLISH} "OpenGnsys Server IP Address" LangString ServerLabel ${LANG_ENGLISH} "OpenGnsys Server IP Address"
LangString ServerLabel ${LANG_SPANISH} "Direccion IP del Servidor OpenGnsys" LangString ServerLabel ${LANG_SPANISH} "Direccion IP del Servidor OpenGnsys"