~balkan/adeona/trunk

« back to all changes in this revision

Viewing changes to release/win/adeonainstaller.nsi

  • Committer: Vjekoslav Brajkovic
  • Date: 2009-02-17 02:24:59 UTC
  • Revision ID: vjeko@v.dyn.cs.washington.edu-20090217022459-0scqerw4j8oydzqs
Initial commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; Script generated by the HM NIS Edit Script Wizard.
 
2
 
 
3
; HM NIS Edit Wizard helper defines
 
4
!define PRODUCT_NAME "Adeona"
 
5
!define PRODUCT_VERSION "v0.2.1"
 
6
!define PRODUCT_PUBLISHER "University of Washington"
 
7
!define PRODUCT_WEB_SITE "http://adeona.cs.washington.edu"
 
8
 
 
9
SetCompressor zlib
 
10
 
 
11
; MUI 1.67 compatible ------
 
12
!include "MUI.nsh"
 
13
!include nsDialogs.nsh
 
14
;!include LogicLib.nsh
 
15
 
 
16
; MUI Settings
 
17
!define MUI_ABORTWARNING
 
18
!define MUI_ICON "adeona_globeonly_trans.ico"
 
19
!define MUI_UNICON "adeona_globeonly_trans.ico"
 
20
!define MUI_WELCOMEFINISHPAGE_BITMAP "adeona_inst_globe.bmp"
 
21
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
 
22
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "adeona_inst_globe.bmp"
 
23
!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
 
24
!define MUI_HEADERIMAGE
 
25
!define MUI_HEADERIMAGE_BITMAP "adeona_inst_globe_small.bmp"
 
26
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
 
27
!define MUI_HEADERIMAGE_RIGHT
 
28
;!define MUI_FINISHPAGE_TITLE "Installation successful."
 
29
;!define MUI_FINISHPAGE_TEXT_LARGE
 
30
;!define MUI_FINISHPAGE_TEXT "IMPORTANT: Please don't forget to make a backup copy of your location-finding credentials,\r\n\r\n\
 
31
;                            \t adeona-retrievecredentials.ost\r\n\r\n\
 
32
;                            A copy has been created on your Desktop. You can simply e-mail it to yourself, put it in a USB Memory Stick or, \
 
33
;                            even write down the contents on a piece of paper since the contents have been protected by the password you gave \
 
34
;                            during the installation process.\r\n\r\n\
 
35
;                            NOTE: Adeona has pseudorandomly scheduled updates and there may not be any location information stored in OpenDHT \
 
36
;                            yet. Please wait about 30 minutes before trying to do a retrieval.\r\n\r\n\
 
37
;                            For questions, comments and suggestions, please send an e-mail to adeona@cs.washington.edu\r\n\r\n\
 
38
;                            Thank you for using Adeona!"
 
39
                            
 
40
; Welcome page
 
41
!insertmacro MUI_PAGE_WELCOME
 
42
; License page
 
43
!define MUI_LICENSEPAGE_CHECKBOX
 
44
!insertmacro MUI_PAGE_LICENSE "..\..\License.txt"
 
45
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE myComponentLeave
 
46
!insertmacro MUI_PAGE_COMPONENTS
 
47
; Directory page
 
48
!insertmacro MUI_PAGE_DIRECTORY
 
49
; Instfiles page
 
50
!insertmacro MUI_PAGE_INSTFILES
 
51
; Password page
 
52
Page custom passwordPage passwordPageEnd
 
53
; Custom finish page
 
54
Page custom FinishPage
 
55
 
 
56
; Uninstaller pages
 
57
!insertmacro MUI_UNPAGE_INSTFILES
 
58
 
 
59
; Language files
 
60
!insertmacro MUI_LANGUAGE "English"
 
61
 
 
62
 
 
63
 
 
64
; MUI end ------
 
65
 
 
66
 
 
67
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
 
68
OutFile "AdeonaSetup.exe"
 
69
InstallDir "$PROGRAMFILES\Adeona"
 
70
ShowInstDetails show
 
71
ShowUnInstDetails show
 
72
RequestExecutionLevel admin
 
73
 
 
74
Var passwordbox
 
75
Var password
 
76
Var Dialog
 
77
Var Label
 
78
Var passwordboxver
 
79
Var passwordver
 
80
Var clientflag
 
81
 
 
82
 
 
83
Section "-common installation stuff"
 
84
 
 
85
  CreateDirectory "$INSTDIR\resources"
 
86
  CreateDirectory "$INSTDIR\logs"
 
87
  SetOutPath "$INSTDIR\resources"
 
88
  SetOverwrite ifnewer
 
89
;  File "packagefiles\resources\options.adeona"
 
90
  File "..\..\resources\landmarks.adeona"
 
91
  File "..\..\resources\gateways.adeona"
 
92
  File "..\..\resources\options.adeona"
 
93
  SetOutPath "$INSTDIR"
 
94
  SetOverwrite ifnewer
 
95
  File "packagefiles\cygcrypto-0.9.8.dll"
 
96
  File "packagefiles\cygrunsrv.exe"
 
97
  File "packagefiles\cygwin1.dll"
 
98
 
 
99
; Create options file
 
100
;  FileOpen $0 "$INSTDIR\resources\options.adeona" w
 
101
;;  FileWrite $0 "LOG_FILENAME = $INSTDIR\logs\adeona.log$\n"
 
102
;  FileWrite $0 "CTXT_QUEUE_SIZE = 1$\n"
 
103
;  FileWrite $0 "SERVER_NAME = opendht.nyuld.net$\n"
 
104
;  FileWrite $0 "SERVER_PORT = 5852$\n"
 
105
;  FileWrite $0 "SCHED_LAMBDA = 0.001$\n"
 
106
;  FileWrite $0 "NUM_DHTKEYS_TOTRY = 2$\n"
 
107
;  FileWrite $0 "USE_TRACEROUTES = 1$\n"
 
108
; ; FileWrite $0 "LANDMARKS_FILENAME = $INSTDIR\resources\landmarks.adeona$\n"
 
109
;  FileWrite $0 "MAX_SLEEPTIME = 300$\n"
 
110
; ;FileWrite $0 "GATEWAYS_FILENAME = $INSTDIR\resources\gateways.adeona$\n"
 
111
;  FileWrite $0 "USE_WEBCAMIMG = 0$\n"   ; set USE_WEBCAMING to be zero, since this fails in Windows always, yes?
 
112
;  FileWrite $0 "GWUPDATE_URL = adeona.cs.washington.edu/gateways.adeona$\n"
 
113
;  FileWrite $0 "USE_GWUPDATE = 1$\n"
 
114
; ; FileWrite $0 "WEBCAMPROG_PATH = $INSTDIR\resources\isightcapture.exe$\n"
 
115
;  FileClose $0
 
116
 
 
117
; Creat Start Menu entry
 
118
  SetOverwrite ifnewer
 
119
  CreateDirectory "$SMPROGRAMS\Adeona"
 
120
  CreateShortCut "$SMPROGRAMS\Adeona\Uninstall Adeona.lnk" "$INSTDIR\Uninstall.exe"
 
121
SectionEnd
 
122
 
 
123
Section "Adeona Client" SEC01
 
124
  StrCpy $clientflag "true"
 
125
  
 
126
  SetOutPath "$INSTDIR"
 
127
  SetOverwrite ifnewer
 
128
  File "..\..\adeona-client.exe"
 
129
  File "..\..\adeona-init.exe"
 
130
  File "packagefiles\InitAdeona.bat"
 
131
  File "packagefiles\StartAdeona.bat"
 
132
  File "packagefiles\StopAdeona.bat"
 
133
 
 
134
 
 
135
SectionEnd
 
136
 
 
137
 
 
138
 
 
139
Section "Adeona Recovery Tools" SEC02
 
140
  CreateDirectory "$INSTDIR\resources"
 
141
  CreateDirectory "$INSTDIR\logs"
 
142
  SetOutPath "$INSTDIR\resources"
 
143
  SetOverwrite ifnewer
 
144
;  File "packagefiles\resources\options.adeona"
 
145
  File "..\..\resources\gateways.adeona"
 
146
 
 
147
  SetOutPath "$INSTDIR"
 
148
  File "packagefiles\adeona-retrieve.bat"
 
149
  File "packagefiles\AdeonaRecovery.exe"
 
150
  File "..\..\adeona-retrieve.exe"
 
151
 
 
152
  SetOverwrite ifnewer
 
153
  CreateDirectory "$SMPROGRAMS\Adeona"
 
154
  CreateShortCut "$SMPROGRAMS\Adeona\Run Adeona Recovery.lnk" "$INSTDIR\AdeonaRecovery.exe"
 
155
SectionEnd
 
156
 
 
157
LangString DESC_Section1 ${LANG_ENGLISH} "The Adeona Client periodically sends private updates \
 
158
           regarding the current location of your laptop to a remote storage facility on the Internet."
 
159
LangString DESC_Section2 ${LANG_ENGLISH} "The Adeona Recovery tools help one retrieve updates sent \
 
160
            by a laptop. $\n$\nThis is all that is required to perform retrieval of updates sent from a machine."
 
161
 
 
162
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
163
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_Section1)
 
164
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_Section2)
 
165
!insertmacro MUI_FUNCTION_DESCRIPTION_END
 
166
 
 
167
Section -Post
 
168
  WriteUninstaller "$INSTDIR\Uninstall.exe"
 
169
SectionEnd
 
170
 
 
171
 
 
172
Function myComponentLeave
 
173
   SectionGetFlags ${SEC01} $0
 
174
   IntOp $1 $0 & ${SF_SELECTED}
 
175
   SectionGetFlags ${SEC02} $2
 
176
   IntOp $3 $2 & ${SF_SELECTED}
 
177
   IntOp $4 $1 | $3
 
178
   ${If} $4 == 0
 
179
         MessageBox MB_OK "Please select at least one component." IDOK true3
 
180
         true3:
 
181
              Abort ; forces to stay on this page
 
182
         Abort
 
183
   ${EndIf}
 
184
FunctionEnd
 
185
 
 
186
 
 
187
Function passwordPage
 
188
 
 
189
  !insertmacro MUI_HEADER_TEXT "Initializing the Adeona client" "Choose a password"
 
190
 
 
191
   SectionGetFlags ${SEC01} $0
 
192
 
 
193
   IntOp $1 $0 & ${SF_SELECTED}
 
194
   ${If} $1 == 0
 
195
         Abort
 
196
   ${EndIf}
 
197
   
 
198
   nsDialogs::Create /NOUNLOAD 1018
 
199
   Pop $Dialog
 
200
 
 
201
   ${If} $Dialog == error
 
202
      Abort
 
203
   ${EndIf}
 
204
 
 
205
   ${NSD_CreateLabel} 0 0 100% 26u "To protect your location finding credentials, please pick a password for Adeona. \
 
206
                                  It does not need to be the same as your login password."
 
207
   Pop $Label
 
208
 
 
209
   ${NSD_CreateLabel} 0 30u 40% 24u "Adeona password:"
 
210
   
 
211
   ${NSD_CreatePassword} 45% 30u 50% 12u ""
 
212
   Pop $passwordbox
 
213
 
 
214
   ${NSD_SetFocus} $passwordbox
 
215
 
 
216
   ${NSD_CreateLabel} 0 50u 40% 24u "Please re-enter your Adeona password for verification:"
 
217
 
 
218
   ${NSD_CreatePassword} 45% 53u 50% 12u ""
 
219
   Pop $passwordboxver
 
220
 
 
221
 
 
222
   nsDialogs::Show
 
223
FunctionEnd
 
224
 
 
225
Function passwordPageEnd
 
226
   ${NSD_GetText} $passwordbox $password
 
227
   ${NSD_GetText} $passwordboxver $passwordver
 
228
   ${If} $password == ""
 
229
         MessageBox MB_OK "Password is empty. To ensure privacy of your device tracking updates, please specify a password." IDOK true2
 
230
         true2:
 
231
              Abort ; forces to stay on this page
 
232
   ${EndIf}
 
233
   ${If} $password != $passwordver
 
234
         MessageBox MB_OK "Passwords do not match. Please try again." IDOK true
 
235
         true:
 
236
              Abort ; forces to stay on this page
 
237
   ${EndIf}
 
238
   
 
239
   
 
240
   
 
241
   ExecWait '"$INSTDIR\InitAdeona.bat" "$INSTDIR" "$password"'
 
242
 
 
243
   CopyFiles "$INSTDIR\adeona-retrievecredentials.ost" "$DESKTOP\"
 
244
FunctionEnd
 
245
 
 
246
 
 
247
Function FinishPage
 
248
   nsDialogs::Create /NOUNLOAD 1018
 
249
   Pop $0
 
250
 
 
251
   ${If} $0 == error
 
252
      Abort
 
253
   ${EndIf}
 
254
 
 
255
 
 
256
   SectionGetFlags ${SEC01} $0
 
257
   
 
258
   IntOp $1 $0 & ${SF_SELECTED}
 
259
   ${If} $1 != 0
 
260
        !insertmacro MUI_HEADER_TEXT "Setup complete" "Remember to backup your owner credentials."
 
261
      ${NSD_CreateLabel} 0 0 100% 100% "IMPORTANT: Please don't forget to make a backup copy of your location-finding credentials,$\r$\n$\r$\n\
 
262
                                   $\t adeona-retrievecredentials.ost$\r$\n$\r$\n\
 
263
                                    A copy has been created on your Desktop. You can simply e-mail it to yourself, put it in a USB Memory Stick or, \
 
264
                                    even write down the contents on a piece of paper since the contents have been protected by the password you gave \
 
265
                                    during the installation process.$\r$\n$\r$\n$\r$\n\
 
266
                                    NOTE: Adeona has pseudorandomly scheduled updates and there may not be any location information stored in OpenDHT \
 
267
                                    yet. Please wait about 1 hour before trying to do a retrieval.$\r$\n$\r$\n\
 
268
                                    For questions, comments and suggestions,please visit our website at http://adeona.cs.washington.edu/contact.html $\r$\n$\r$\n\
 
269
                                    Thank you for using Adeona!"
 
270
      Pop $1
 
271
   ${Else}
 
272
           !insertmacro MUI_HEADER_TEXT "Installation complete" ""
 
273
     ${NSD_CreateLabel} 0 0 100% 100% "Installation is complete. You can now use the Adeona Recovery tools."
 
274
      Pop $1
 
275
   ${EndIf}
 
276
   nsDialogs::Show
 
277
FunctionEnd
 
278
 
 
279
 
 
280
;Function .onInstSuccess
 
281
  ;  MessageBox MB_OK "Installation successful. Click OK to read important instructions regarding recovery."
 
282
   ;   Exec '"notepad.exe Conclusion.txt' ; view readme or whatever, if you want.
 
283
;FunctionEnd
 
284
 
 
285
Function un.onUninstSuccess
 
286
  HideWindow
 
287
  MessageBox MB_ICONINFORMATION|MB_OK "Adeona was successfully removed from your computer."
 
288
FunctionEnd
 
289
 
 
290
Function un.onInit
 
291
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove Adeona and all of its components?" IDYES +2
 
292
  Abort
 
293
FunctionEnd
 
294
 
 
295
Section Uninstall
 
296
  SetOutPath "$INSTDIR"  ; Something very strange with working directory for StopAdeona.bat
 
297
  ExecWait '"$INSTDIR\StopAdeona.bat"'
 
298
  SetOutPath "$PROGRAMFILES" 
 
299
  
 
300
  Delete "$INSTDIR\resources\*"
 
301
  RMDir "$INSTDIR\resources"
 
302
  Delete "$INSTDIR\logs\*"
 
303
  RMDir "$INSTDIR\logs"
 
304
  Delete "$INSTDIR\*"
 
305
   
 
306
  RMDir "$INSTDIR"
 
307
  Delete "$SMPROGRAMS\Adeona\Run Adeona Recovery.lnk"
 
308
  Delete "$SMPROGRAMS\Adeona\Uninstall Adeona.lnk"
 
309
  RMDir "$SMPROGRAMS\Adeona"
 
310
  
 
311
  SetAutoClose true
 
312
SectionEnd