source: ogAgent-Git/windows/ogagent.nsi @ 98fc98d

configure-ptt-chedecorare-oglive-methodsejecutarscript-b64fix-cfg2objfixes-winlgromero-filebeatmainmodulesnew-browserno-ptt-paramogadmcliogadmclient-statusogagent-jobsogagent-macosogcore1ogliveoglogoglog2override-moduleping1ping2ping3ping4py3-winpython3qndtestreport-progressunification2unification3versionswindows-fixes
Last change on this file since 98fc98d was 11f7a07, checked in by ramon <ramongomez@…>, 9 years ago

#718: Integrar código fuente de agente OGAgent en rama de desarrollo.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@4865 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 7.5 KB
Line 
1# We need http://nsis.sourceforge.net/NSIS_Simple_Firewall_Plugin
2# Copy inside the two x86_xxxxx folders inside nsis plugins folder
3Name "OpenGnSys Agent"
4
5# OpenGnsys Actor version
6!define OGA_VERSION 1.0.0
7
8# General Symbol Definitions
9!define REGKEY "SOFTWARE\OGAgent"
10!define VERSION ${OGA_VERSION}.0
11!define COMPANY "Virtual Cable S.L.U."
12!define URL http://www.udsenterprise.com
13
14# MultiUser Symbol Definitions
15!define MULTIUSER_EXECUTIONLEVEL Admin
16#!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
17!define MULTIUSER_INSTALLMODE_COMMANDLINE
18!define MULTIUSER_INSTALLMODE_INSTDIR OGAgent
19!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${REGKEY}"
20!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUE "Path"
21
22# MUI Symbol Definitions
23#!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
24!define MUI_ICON "src\img\oga.ico"
25!define MUI_FINISHPAGE_NOAUTOCLOSE
26!define MUI_UNICON "src\img\oga.ico"
27!define MUI_UNFINISHPAGE_NOAUTOCLOSE
28!define MUI_LANGDLL_REGISTRY_ROOT HKLM
29!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
30!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
31
32# Included files
33!include MultiUser.nsh
34!include Sections.nsh
35!include MUI2.nsh
36
37# Reserved Files
38!insertmacro MUI_RESERVEFILE_LANGDLL
39
40# Variables
41Var StartMenuGroup
42
43# Installer pages
44!insertmacro MUI_PAGE_WELCOME
45!insertmacro MUI_PAGE_LICENSE src\license.txt
46!insertmacro MUI_PAGE_DIRECTORY
47!insertmacro MUI_PAGE_INSTFILES
48!insertmacro MUI_PAGE_FINISH
49!insertmacro MUI_UNPAGE_CONFIRM
50!insertmacro MUI_UNPAGE_INSTFILES
51
52# Installer languages
53!insertmacro MUI_LANGUAGE English
54!insertmacro MUI_LANGUAGE Spanish
55!insertmacro MUI_LANGUAGE French
56!insertmacro MUI_LANGUAGE German
57
58# Installer attributes
59BrandingText "OpenGnSys"
60OutFile OGAgentSetup-${OGA_VERSION}.exe
61InstallDir OGAgent
62CRCCheck on
63XPStyle on
64ShowInstDetails hide
65VIProductVersion "${VERSION}.0.0"
66VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName "OGAgent"
67VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
68VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
69VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
70VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
71VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription "OpenGnSys Agent installer"
72VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright "(c) 2015 Virtual Cable S.L.U."
73InstallDirRegKey HKLM "${REGKEY}" Path
74ShowUninstDetails show
75
76# Installer sections
77Section -Main SEC0000
78    SetShellVarContext all
79    SetOutPath $INSTDIR
80    SetOverwrite on
81    File /r bin\*.*
82    File vcredist_x86.exe
83    WriteRegStr HKLM "${REGKEY}\Components" Main 1
84SectionEnd
85
86Section -post SEC0001
87    SetShellVarContext current
88    WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
89    SetOutPath $INSTDIR
90    WriteUninstaller $INSTDIR\OGAgentUninstaller.exe
91    SetOutPath $SMPROGRAMS\$StartMenuGroup
92    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\OGAgentUninstaller.exe
93    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
94    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
95    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
96    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
97    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\OGAgentUninstaller.exe
98    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\OGAgentUninstaller.exe
99    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" OGAgentTool $INSTDIR\OGAgentUser.exe
100    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
101    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
102    ExecWait '"$INSTDIR\vcredist_x86.exe" /passive /norestart'
103    # Add the application to the firewall exception list - All Networks - All IP Version - Enabled
104    # SimpleFC::AddApplication "OpenGnSys Agent Service" "$INSTDIR\OGAgentService.exe" 0 2 "" 1
105    # SimpleFC::AdvAddRule [name] [description] [protocol] [direction]
106    #  [status] [profile] [action] [application] [service_name] [icmp_types_and_codes]
107    #  [group] [local_ports] [remote_ports] [local_address] [remote_address]
108    #
109    SimpleFC::AdvAddRule "OpenGnSys Agent Firewall rules" "Firewall rules for OpenGnSys Agent interaction with broker." "6" "1" \
110      "1" "7" "1" "$INSTDIR\OGAgentService.exe" "" "" \
111      "" "" "" "" ""   
112    Pop $0 ; return error(1)/success(0)
113    # Install service
114    nsExec::Exec /OEM "$INSTDIR\OGAgentService.exe --startup auto install" # Add service after installation
115    # Update recovery options
116    nsExec::Exec /OEM "$INSTDIR\OGAServiceHelper.exe"
117SectionEnd
118
119# Macro for selecting uninstaller sections
120!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
121    Push $R0
122    ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
123    StrCmp $R0 1 0 next${UNSECTION_ID}
124    !insertmacro SelectSection "${UNSECTION_ID}"
125    GoTo done${UNSECTION_ID}
126next${UNSECTION_ID}:
127    !insertmacro UnselectSection "${UNSECTION_ID}"
128done${UNSECTION_ID}:
129    Pop $R0
130!macroend
131
132# Uninstaller sections
133Section /o -un.Main UNSEC0000
134    nsExec::Exec /OEM "$INSTDIR\OGAgentService.exe stop" # Stops the service prior uninstall
135    nsExec::Exec /OEM "$INSTDIR\OGAgentService.exe remove" # Removes the service prior uninstall
136    Delete /REBOOTOK "$INSTDIR\*.*"
137    DeleteRegValue HKLM "${REGKEY}\Components" Main
138    DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" OGAgentTool
139SectionEnd
140
141Section -un.post UNSEC0001
142    # Remove application from the firewall exception list
143    # SimpleFC::RemoveApplication "$INSTDIR\OGAgentService.exe"
144    SimpleFC::AdvRemoveRule "OpenGnSys Agent Firewall rules"
145    Pop $0 ; return error(1)/success(0)
146
147    SetShellVarContext current
148    StrCpy $StartMenuGroup "OpenGnSys Agent"
149    DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
150    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
151    Delete /REBOOTOK $INSTDIR\OGAgentUninstaller.exe
152    DeleteRegValue HKLM "${REGKEY}" Path
153    DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
154    DeleteRegKey /IfEmpty HKLM "${REGKEY}"
155    RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
156    SetShellVarContext all
157    RmDir /REBOOTOK $INSTDIR
158    SetRebootFlag true
159    MessageBox MB_OK|MB_USERICON "Your system needs to reboot to complete uninstallation."
160    Reboot # Reboot is needed after uninstalling, so new installs works fine
161SectionEnd
162
163# Installer functions
164Function .onInit
165    InitPluginsDir
166    StrCpy $StartMenuGroup "OpenGnSys Agent"
167   
168    !insertmacro MUI_LANGDLL_DISPLAY
169    !insertmacro MULTIUSER_INIT
170FunctionEnd
171
172# Uninstaller functions
173Function un.onInit
174    StrCpy $StartMenuGroup "OpenGnSys Agent"
175    !insertmacro MUI_UNGETLANGUAGE
176    !insertmacro MULTIUSER_UNINIT
177    !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
178FunctionEnd
179
180# Installer Language Strings
181LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
182LangString ^UninstallLink ${LANG_SPANISH} "Desinstalar $(^Name)"
183LangString ^UninstallLink ${LANG_FRENCH} "D�sinstaller $(^Name)"
184LangString ^UninstallLink ${LANG_GERMAN} "deinstallieren $(^Name)"
Note: See TracBrowser for help on using the repository browser.