Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
; Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
; Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
;
; This file is part of ProInfoData Windows Installer
;
; ProInfoData Windows Installer is free software you can redistribute it
; and/or modify it under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
; USA.
;Used variables
; R0 -> General use
; R1 -> General use
; R2 -> Temp variable
; R3 -> Variable used to set the lock state of the "next" button in INEP page
!define PRODUCT_NAME "DataSID"
!define PRODUCT_VERSION "1.0.0"
!define PRODUCT_PUBLISHER "C3SL - UFPR"
!define PRODUCT_WEB_SITE "http://datasid.c3sl.ufpr.br/"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\\
Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_UNINST_NAME "Desinstalar ${PRODUCT_NAME}"
!define PRODUCT_TASK "$PROGRAMFILES\${PRODUCT_NAME}\bin\agent\datasidAgent.exe"
!define MUI_FINISHPAGE_NOAUTOCLOSE
SetCompressor bzip2
RequestExecutionLevel admin
XPStyle on
BrandingText "DataSID - C3SL"
;!addplugindir "~/.wine/drive_c/Program Files/NSIS/Unicode/Plugins"
;Installer headers
!include "nsDialogs.nsh"
!include "MUI.nsh"
!include LogicLib.nsh
;Installer images
!define MUI_ICON "..\images\proinfodata.ico"
!define MUI_UNICON "..\images\proinfodata.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "..\images\wizard.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "..\images\headerLeft.bmp"
;MUI Settings
!define MUI_ABORTWARNING
;Installer pages
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "../COPYING"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
;Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
;Language files
!insertmacro MUI_LANGUAGE "PortugueseBR"
;Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
;MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "..\build\${PRODUCT_NAME}.exe"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
Var ProxyHost
Var ProxyPort
Var ProxyUser
Var ProxyPass
;Installer init function
Function .onInit
;Get Proxy info
ClearErrors
FileOpen $0 "$EXEDIR\proxy" r
${If} ${Errors}
StrCpy $ProxyHost ""
StrCpy $ProxyPort ""
StrCpy $ProxyUser ""
StrCpy $ProxyPass ""
${Else}
FileRead $0 $ProxyHost
FileRead $0 $ProxyPort
FileRead $0 $ProxyUser
FileRead $0 $ProxyPass
FileClose $0
${EndIf}
;Prevent the user from run multiple instances of this installer
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Instalador \
DataSID") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "Uma instância do instalador já \
está em execução."
Abort
;Kill datasidAgent.exe process
StrCpy $0 "datasidAgent.exe"
DetailPrint "Killing all processes called '$0'"
KillProc::KillProcesses
FunctionEnd
;Main installer section
Section "SeçãoPrincipal" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
ClearErrors
ReadRegStr $R2 HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyHost"
${If} ${Errors}
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyHost" $ProxyHost
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyPort" $ProxyPort
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyUser" $ProxyUser
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyPass" $ProxyPass
${EndIf}
;Add DatasidAgent task in Windows task scheduler
nsExec::Exec "schtasks /Create /SC HOURLY /MO 1 /TN DatasidAgent \
/TR $\"\$\"${PRODUCT_TASK}$\"\$\" /RU System /F"
Pop $R2
File "..\COPYING"
CreateDirectory "$INSTDIR\conf"
CreateDirectory "$INSTDIR\data"
CreateDirectory "$INSTDIR\log"
CreateDirectory "$INSTDIR\update"
CreateDirectory "$INSTDIR\..\data"
SetOutPath "$INSTDIR\bin"
File "..\build\bin\client.exe"
SetOutPath "$INSTDIR\bin\agent"
File "..\..\windows-collect\src\dist\API-MS-Win-Core-LocalRegistry-L1-1-0.dll"
File "..\..\windows-collect\src\dist\API-MS-Win-Core-ProcessThreads-L1-1-0.dll"
File "..\..\windows-collect\src\dist\API-MS-Win-Security-Base-L1-1-0.dll"
File "..\..\windows-collect\src\dist\bz2.pyd"
;File "..\..\windows-collect\src\dist\KernelBase.dll"
File "..\..\windows-collect\src\dist\library.zip"
;File "..\..\windows-collect\src\dist\powrprof.dll"
File "..\..\windows-collect\src\dist\datasidAgent.exe"
File "..\..\windows-collect\src\dist\pyexpat.pyd"
File "..\..\windows-collect\src\dist\python27.dll"
File "..\..\windows-collect\src\dist\pythoncom27.dll"
File "..\..\windows-collect\src\dist\pywintypes27.dll"
File "..\..\windows-collect\src\dist\select.pyd"
File "..\..\windows-collect\src\dist\unicodedata.pyd"
File "..\..\windows-collect\src\dist\w9xpopen.exe"
File "..\..\windows-collect\src\dist\win32api.pyd"
File "..\..\windows-collect\src\dist\win32ui.pyd"
File "..\..\windows-collect\src\dist\_ctypes.pyd"
File "..\..\windows-collect\src\dist\_hashlib.pyd"
File "..\..\windows-collect\src\dist\_socket.pyd"
File "..\..\windows-collect\src\dist\_ssl.pyd"
File "..\..\windows-collect\src\dist\_win32sysloader.pyd"
CopyFiles "$EXEDIR\telecentroInfo" "$INSTDIR\conf"
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "Version" ${PRODUCT_VERSION}
;Execute DataSID Agent
nsExec::Exec "schtasks /Run /TN DatasidAgent"
SectionEnd
;Uninstaller creation
Section -Post
WriteUninstaller "$INSTDIR\${PRODUCT_UNINST_NAME}.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"UninstallString" "$INSTDIR\${PRODUCT_UNINST_NAME}.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
;Uninstaller init function
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Tem certeza que quer \
remover completamente $(^Name) e todos os seus componentes?" IDYES +2
Abort
FunctionEnd
;Shows a messagebox if the uninstall process is succeeded
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) foi removido com sucesso \
do seu computador."
FunctionEnd
;Remove datasid files
Section Uninstall
Delete "$INSTDIR\${PRODUCT_UNINST_NAME}.exe"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\bin\client.exe"
Delete "$INSTDIR\bin\agent\API-MS-Win-Core-LocalRegistry-L1-1-0.dll"
Delete "$INSTDIR\bin\agent\API-MS-Win-Core-ProcessThreads-L1-1-0.dll"
Delete "$INSTDIR\bin\agent\API-MS-Win-Security-Base-L1-1-0.dll"
Delete "$INSTDIR\bin\agent\bz2.pyd"
Delete "$INSTDIR\bin\agent\KERNELBASE.dll"
Delete "$INSTDIR\bin\agent\library.zip"
Delete "$INSTDIR\bin\agent\POWRPROF.dll"
Delete "$INSTDIR\bin\agent\datasidAgent.exe"
Delete "$INSTDIR\bin\agent\pyexpat.pyd"
Delete "$INSTDIR\bin\agent\python27.dll"
Delete "$INSTDIR\bin\agent\pythoncom27.dll"
Delete "$INSTDIR\bin\agent\pywintypes27.dll"
Delete "$INSTDIR\bin\agent\select.pyd"
Delete "$INSTDIR\bin\agent\unicodedata.pyd"
Delete "$INSTDIR\bin\agent\w9xpopen.exe"
Delete "$INSTDIR\bin\agent\win32api.pyd"
Delete "$INSTDIR\bin\agent\win32ui.pyd"
Delete "$INSTDIR\bin\agent\_ctypes.pyd"
Delete "$INSTDIR\bin\agent\_hashlib.pyd"
Delete "$INSTDIR\bin\agent\_socket.pyd"
Delete "$INSTDIR\bin\agent\_ssl.pyd"
Delete "$INSTDIR\bin\agent\_win32sysloader.pyd"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR\conf"
RMDir "$INSTDIR\data"
RMDir "$INSTDIR\log"
RMDir "$INSTDIR\update"
RMDir "$INSTDIR\..\data"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegValue HKLM "SOTWARE\${PRODUCT_NAME}" "Version"
DeleteRegValue HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyHost"
DeleteRegValue HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyPort"
DeleteRegValue HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyUser"
DeleteRegValue HKLM "SOFTWARE\${PRODUCT_NAME}" "ProxyPass"
DeleteRegKey HKLM "SOFTWARE\${PRODUCT_NAME}"
;Delete scheduled task
nsExec::Exec "schtasks /Delete /TN DatasidAgent /F"
Pop $R2
SetAutoClose true
SectionEnd