Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 591 lines (465 sloc) 13.211 kb
8643a9e @antonv added win rhostudio intaller
antonv authored
1 ;======================================================
2 ; Include
3
4 !include "MUI.nsh"
5 !include "LogicLib.nsh"
6 !include "EnvVarUpdate.nsh"
7
8 ;======================================================
9 ; Installer Information
10
14b661f @antonv added devkit/sas and fix bugs
antonv authored
11 Name "RhoInstaller"
12 OutFile "RhoInstaller.exe"
8643a9e @antonv added win rhostudio intaller
antonv authored
13 InstallDir C:\RhoStudio
14 BrandingText " "
15 ;======================================================
16 ; Modern Interface Configuration
17
18 !define MUI_ICON "icon.ico"
19 !define MUI_UNICON "icon.ico"
20 !define MUI_HEADERIMAGE
21 !define MUI_ABORTWARNING
22 !define MUI_COMPONENTSPAGE_SMALLDESC
23 !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
24 !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.html
25 !define MUI_FINISHPAGE
26 !define MUI_FINISHPAGE_TEXT "Thank you for installing Rhodes, RhoSync and RhoStudio. \r\n\n\n"
27
28
29 ;======================================================
30 ; Pages
31
32 !insertmacro MUI_PAGE_WELCOME
14b661f @antonv added devkit/sas and fix bugs
antonv authored
33 !define MUI_PAGE_HEADER_TEXT "RhoStudio License Agreement"
34 !define MUI_PAGE_HEADER_SUBTEXT "Please review the RhoStudio license terms before installing."
35 !insertmacro MUI_PAGE_LICENSE "RHOSTUDIO-LICENSE.txt"
8643a9e @antonv added win rhostudio intaller
antonv authored
36 !insertmacro MUI_PAGE_COMPONENTS
37 !insertmacro MUI_PAGE_DIRECTORY
38 !insertmacro MUI_PAGE_INSTFILES
14b661f @antonv added devkit/sas and fix bugs
antonv authored
39 Page custom customerConfig
8643a9e @antonv added win rhostudio intaller
antonv authored
40 !insertmacro MUI_PAGE_FINISH
41
42 ;======================================================
43 ; Languages
44
45 !insertmacro MUI_LANGUAGE "English"
46
47 ;======================================================
48 ; Reserve Files
49
14b661f @antonv added devkit/sas and fix bugs
antonv authored
50 ReserveFile "configUi.ini"
51 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
52
53 ;======================================================
54 ; Variables
55 var varApacheEmail
56 var varApachePort
57 var varDbPass
58
8643a9e @antonv added win rhostudio intaller
antonv authored
59 ;======================================================
60 ; Sections
61
62 # start default section
63 section
408e7ae @antonv fix uninstaller
antonv authored
64
65 ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\javaws.exe" "Path"
66
67 StrCmp $0 "" jreCheck
68
8643a9e @antonv added win rhostudio intaller
antonv authored
69 # set the installation directory as the destination for the following actions
70 setOutPath $INSTDIR
71
72 # create the uninstaller
73 writeUninstaller "$INSTDIR\uninstall.exe"
74
68f4d9a @antonv fix rhostudio intaller, add menu group
antonv authored
75 SetOutPath "$SMPROGRAMS\RhoStudio"
14b661f @antonv added devkit/sas and fix bugs
antonv authored
76
8643a9e @antonv added win rhostudio intaller
antonv authored
77 # create a shortcut named "new shortcut" in the start menu programs directory
78 # point the new shortcut at the program uninstaller
79 createShortCut "$SMPROGRAMS\RhoStudio\Uninstall RhoStudio.lnk" "$INSTDIR\uninstall.exe"
80 createShortCut "$SMPROGRAMS\RhoStudio\RhoStudio.lnk" "$INSTDIR\eclipse\RhoStudio.exe"
14b661f @antonv added devkit/sas and fix bugs
antonv authored
81 createShortCut "$SMPROGRAMS\RhoStudio\Samples.lnk" "$INSTDIR\sas\"
408e7ae @antonv fix uninstaller
antonv authored
82
83 Goto finishSection
84
85 jreCheck:
86 MessageBox MB_OK|MB_ICONINFORMATION|MB_DEFBUTTON1 "Java Runtime Environment could be found on your computer. Please install Java Runtime Environment before RhoStudio."
87 Quit
88
89 finishSection:
8643a9e @antonv added win rhostudio intaller
antonv authored
90 sectionEnd
91
92 # uninstaller section start
93 section "uninstall"
94
95 # first, delete the uninstaller
96 delete "$INSTDIR\uninstall.exe"
97
408e7ae @antonv fix uninstaller
antonv authored
98 # second, remove the link from the start menu
68f4d9a @antonv fix rhostudio intaller, add menu group
antonv authored
99 delete "$SMPROGRAMS\RhoStudio\Uninstall RhoStudio.lnk"
8643a9e @antonv added win rhostudio intaller
antonv authored
100 delete "$SMPROGRAMS\RhoStudio\RhoStudio.lnk"
408e7ae @antonv fix uninstaller
antonv authored
101 delete "$SMPROGRAMS\RhoStudio"
8643a9e @antonv added win rhostudio intaller
antonv authored
102
14b661f @antonv added devkit/sas and fix bugs
antonv authored
103 ExecWait 'net stop apache2.2'
104 ExecWait 'net stop redis'
105 ExecWait 'net stop rhosync-1'
106 ExecWait 'net stop rhosync-2'
107 ExecWait 'net stop rhosync-3'
108 ExecWait 'sc delete apache2.2'
109 ExecWait 'sc delete redis'
110 ExecWait 'sc delete rhosync-1'
111 ExecWait 'sc delete rhosync-2'
112 ExecWait 'sc delete rhosync-3'
113
8643a9e @antonv added win rhostudio intaller
antonv authored
114 # remove env vars
115 Push "PATH"
116 Push "R"
117 Push "HKLM"
118 Push "$INSTDIR\ruby\bin"
119 Call un.EnvVarUpdate
120 Pop $R0
121
122 Push "PATH"
123 Push "R"
124 Push "HKLM"
125 Push "$INSTDIR\make-3.81\bin"
126 Call un.EnvVarUpdate
127 Pop $R0
128
129 Push "PATH"
130 Push "R"
131 Push "HKLM"
132 Push "$INSTDIR\redis-2.2.2"
133 Call un.EnvVarUpdate
134 Pop $R0
135
14b661f @antonv added devkit/sas and fix bugs
antonv authored
136 DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" REDIS_HOME
8643a9e @antonv added win rhostudio intaller
antonv authored
137
138 # remove $INSTDIR
139 RMDir /r /REBOOTOK $INSTDIR
140
141 # uninstaller section end
142 sectionEnd
143
14b661f @antonv added devkit/sas and fix bugs
antonv authored
144 Section "Apache" apache2Section
145
146 SetOutPath $INSTDIR
147
148 File /r "apache2"
149
150 Push $INSTDIR
151 Push "\"
152 Call StrSlash
153 Pop $R0
154
155 Push SERVERROOT
156 Push $R0/apache2
157 Push all
158 Push all
159 Push $INSTDIR\apache2\conf\httpd.conf
160 Call AdvReplaceInFile
161
162 Push DOCROOT
163 Push $R0/apache2/htdocs
164 Push all
165 Push all
166 Push $INSTDIR\apache2\conf\httpd.conf
167 Call AdvReplaceInFile
168
169 Push CGIBIN
170 Push $R0/apache2/cgi-bin
171 Push all
172 Push all
173 Push $INSTDIR\apache2\conf\httpd.conf
174 Call AdvReplaceInFile
175 SectionEnd
176
8643a9e @antonv added win rhostudio intaller
antonv authored
177 Section "Ruby, Rubygems, Rhodes, and RhoSync" rubySection
178
179 SetOutPath $INSTDIR
180
181 File /r "ruby"
182 File /r "make-3.81"
14b661f @antonv added devkit/sas and fix bugs
antonv authored
183 File /r "rhosync"
8643a9e @antonv added win rhostudio intaller
antonv authored
184 File "README.html"
14b661f @antonv added devkit/sas and fix bugs
antonv authored
185 File "RHOSTUDIO-LICENSE.txt"
8643a9e @antonv added win rhostudio intaller
antonv authored
186
187 ;add to path here
188
189 Push "PATH"
190 Push "P"
191 Push "HKLM"
192 Push "$INSTDIR\ruby\bin"
193 Call EnvVarUpdate
194 Pop $R0
195
196 Push "$INSTDIR\binfileoutput.txt" # output file - unused paramter
197 Push "*." # filter
198 Push "$INSTDIR\ruby\bin" # folder to search in
199 Call FixScriptFilesInDir
200 Pop $R0
201
202 Push "$INSTDIR\binfileoutput1.txt" # output file - unused paramter
203 Push "*.bat" # filter
204 Push "$INSTDIR\ruby\bin" # folder to search in
205 Call FixScriptFilesInDir
206 Pop $R0
207
208 Push "$INSTDIR\binfileoutput2.txt" # output file - unused paramter
209 Push "*.rb" # filter
210 Push "$INSTDIR\ruby\bin" # folder to search in
211 Call FixScriptFilesInDir
212 Pop $R0
213
14b661f @antonv added devkit/sas and fix bugs
antonv authored
214
215 ExecWait '$INSTDIR\rhosync\services\rhosync-service1.exe install' $0
216 ExecWait '$INSTDIR\rhosync\services\rhosync-service2.exe install' $0
217 ExecWait '$INSTDIR\rhosync\services\rhosync-service3.exe install' $0
218
219 ExecWait 'net start rhosync-1'
220 ExecWait 'net start rhosync-2'
221 ExecWait 'net start rhosync-3'
222
8643a9e @antonv added win rhostudio intaller
antonv authored
223 delete "$INSTDIR\binfileoutput.txt"
224 delete "$INSTDIR\binfileoutput1.txt"
225 delete "$INSTDIR\binfileoutput2.txt"
226
14b661f @antonv added devkit/sas and fix bugs
antonv authored
227
8643a9e @antonv added win rhostudio intaller
antonv authored
228 SectionEnd
229
230 Section "Redis" redisSection
231
232 SetOutPath $INSTDIR
233
234 File /r "redis-2.2.2"
235
236 ;add to path here
237
238 Push "PATH"
239 Push "P"
240 Push "HKLM"
241 Push "$INSTDIR\redis-2.2.2"
242 Call EnvVarUpdate
243 Pop $R0
244
245 Push "REDIS_HOME"
246 Push "P"
247 Push "HKLM"
248 Push "$INSTDIR\redis-2.2.2"
249 Call EnvVarUpdate
250 Pop $R0
251
252 SectionEnd
253
254 Section "Git 1.7.3.1" gitSection
255
256 SetOutPath $INSTDIR
257
258 File "Git-1.7.3.1-preview20101002.exe"
259
260 ExecWait "$INSTDIR\Git-1.7.3.1-preview20101002.exe"
261
262 delete "$INSTDIR\Git-1.7.3.1-preview20101002.exe"
263
264 SectionEnd
265
266 #Section "Java SE Runtime Environment 6 Update 26" javaSection
267
268 # SetOutPath $INSTDIR
269
270 # File "jre-6u26-windows-i586.exe"
271
272 # ExecWait "$INSTDIR\jre-6u26-windows-i586.exe"
273
274 # delete "$INSTDIR\jre-6u26-windows-i586.exe"
275
276 #SectionEnd
277
278 Section "GNU Make" gnumakeSection
279
280 SetOutPath $INSTDIR
281
282 File /r "make-3.81"
283
284 Push "PATH"
285 Push "P"
286 Push "HKLM"
287 Push "$INSTDIR\make-3.81\bin"
288 Call EnvVarUpdate
289 Pop $R0
290
291 SectionEnd
292
293 Section "RhoStudio" studioSection
294
295 SetOutPath $INSTDIR
296
297 File /r "eclipse"
298
299 SectionEnd
14b661f @antonv added devkit/sas and fix bugs
antonv authored
300
301 Section "Samples" samplesSection
302
303 SetOutPath $INSTDIR
304
305 File /r "sas"
306
307 SectionEnd
308
309 Section "DevKit" devkitSection
310
311 SetOutPath $INSTDIR
312
313 File /r "devkit"
314
315 Push "PATH"
316 Push "P"
317 Push "HKLM"
318 Push "$INSTDIR\devkit\mingw\bin"
319 Call EnvVarUpdate
320 Pop $R0
321
322 Push "PATH"
323 Push "P"
324 Push "HKLM"
325 Push "$INSTDIR\devkit\bin"
326 Call EnvVarUpdate
327 Pop $R0
328
329 SectionEnd
8643a9e @antonv added win rhostudio intaller
antonv authored
330 ;======================================================
331 ;Descriptions
332
333 ;Language strings
334 LangString DESC_InstallRhostudio ${LANG_ENGLISH} "This installs Eclipse with RhoStudio."
14b661f @antonv added devkit/sas and fix bugs
antonv authored
335 LangString DESC_InstallApache ${LANG_ENGLISH} "This installs the Apache 2.2 webserver"
8643a9e @antonv added win rhostudio intaller
antonv authored
336 LangString DESC_InstallRuby ${LANG_ENGLISH} "This installs ruby 1.8.7, rubygems 1.3.7, Rhodes and RhoSync gems."
337 LangString DESC_InstallRedis ${LANG_ENGLISH} "This installs redis 2.2.2 (required to run RhoSync)."
338 LangString DESC_InstallGit ${LANG_ENGLISH} "This installs Git (which includes the Git Bash)."
339 LangString DESC_InstallGnuMake ${LANG_ENGLISH} "This installs GNU Make (sometimes required to update gems)."
14b661f @antonv added devkit/sas and fix bugs
antonv authored
340 LangString DESC_InstallSamples ${LANG_ENGLISH} "This installs samples for rhodes."
341 LangString DESC_InstallDevKit ${LANG_ENGLISH} "This installs samples for rhodes."
8643a9e @antonv added win rhostudio intaller
antonv authored
342 # LangString DESC_InstallJava ${LANG_ENGLISH} "This installs Java SE Runtime Environment."
343
344
345 ;Assign language strings to sections
346 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
347 !insertmacro MUI_DESCRIPTION_TEXT ${studioSection} $(DESC_InstallRhostudio)
14b661f @antonv added devkit/sas and fix bugs
antonv authored
348 !insertmacro MUI_DESCRIPTION_TEXT ${apache2Section} $(DESC_InstallApache)
8643a9e @antonv added win rhostudio intaller
antonv authored
349 !insertmacro MUI_DESCRIPTION_TEXT ${rubySection} $(DESC_InstallRuby)
350 !insertmacro MUI_DESCRIPTION_TEXT ${redisSection} $(DESC_InstallRedis)
351 !insertmacro MUI_DESCRIPTION_TEXT ${gitSection} $(DESC_InstallGit)
352 !insertmacro MUI_DESCRIPTION_TEXT ${gnumakeSection} $(DESC_InstallGnuMake)
14b661f @antonv added devkit/sas and fix bugs
antonv authored
353 !insertmacro MUI_DESCRIPTION_TEXT ${devkitSection} $(DESC_InstallDevKit)
354 !insertmacro MUI_DESCRIPTION_TEXT ${samplesSection} $(DESC_InstallSamples)
8643a9e @antonv added win rhostudio intaller
antonv authored
355 # !insertmacro MUI_DESCRIPTION_TEXT ${javaSection} $(DESC_InstallJava)
356 !insertmacro MUI_FUNCTION_DESCRIPTION_END
357
358 ;======================================================
359 ;Functions
14b661f @antonv added devkit/sas and fix bugs
antonv authored
360
361 Function .onInit
362 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "configUi.ini"
363 FunctionEnd
364
365 LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Configuration page"
366 LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This page will update application files based on your system configuration."
367
368 Function customerConfig
369 !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
370 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "configUi.ini"
371 !insertmacro MUI_INSTALLOPTIONS_READ $varApacheEmail "configUi.ini" "Field 3" "State"
372 !insertmacro MUI_INSTALLOPTIONS_READ $varApachePort "configUi.ini" "Field 4" "State"
373
374 Push SERVERADMIN
375 Push $varApacheEmail
376 Push all
377 Push all
378 Push $INSTDIR\apache2\conf\httpd.conf
379 Call AdvReplaceInFile
380
381 Push SERVERPORT
382 Push $varApachePort
383 Push all
384 Push all
385 Push $INSTDIR\apache2\conf\httpd.conf
386 Call AdvReplaceInFile
387
388 ExecWait '"$INSTDIR\apache2\bin\httpd.exe" -k install'
389 ExecWait 'net start Apache2.2'
390
391 FunctionEnd
8643a9e @antonv added win rhostudio intaller
antonv authored
392
393 Function FixScriptFilesInDir
394 Exch $R0 #path
395 Exch
396 Exch $R1 #filter
397 Exch
398 Exch 2
399 Exch $R2 #output file
400 Exch 2
401 Push $R3
402 Push $R4
403 Push $R5
404 Push $R6
405 ClearErrors
406 FindFirst $R3 $R4 "$R0\$R1"
407 FileOpen $R5 $R2 w
408
409 Push $INSTDIR
410 Push "\"
411 Call StrSlash
412 Pop $R6
413
414 Loop:
415 IfErrors Done
416 StrCmp $R4 "." gotoNextFile
417 StrCmp $R4 ".." gotoNextFile
418
419 ;replace package folder with INSTDIR
420 Push C:/dev/rhodesinstaller
421 Push $R6
422 Push all
423 Push all
424 Push "$R0\$R4"
425 Call AdvReplaceInFile
426 FileWrite $R5 "$R0\$R4$\r$\n"
427 FindNext $R3 $R4
428 Goto Loop
429
430 gotoNextFile:
431 FindNext $R3 $R4
432 Goto Loop
433
434 Done:
435 FileClose $R5
436 FindClose $R3
437 Pop $R6
438 Pop $R5
439 Pop $R4
440 Pop $R3
441 Pop $R2
442 Pop $R1
443 Pop $R0
444 FunctionEnd
445
446
447
448 Function AdvReplaceInFile
449 Exch $0 ;file to replace in
450 Exch
451 Exch $1 ;number to replace after
452 Exch
453 Exch 2
454 Exch $2 ;replace and onwards
455 Exch 2
456 Exch 3
457 Exch $3 ;replace with
458 Exch 3
459 Exch 4
460 Exch $4 ;to replace
461 Exch 4
462 Push $5 ;minus count
463 Push $6 ;universal
464 Push $7 ;end string
465 Push $8 ;left string
466 Push $9 ;right string
467 Push $R0 ;file1
468 Push $R1 ;file2
469 Push $R2 ;read
470 Push $R3 ;universal
471 Push $R4 ;count (onwards)
472 Push $R5 ;count (after)
473 Push $R6 ;temp file name
474
475 GetTempFileName $R6
476 FileOpen $R1 $0 r ;file to search in
477 FileOpen $R0 $R6 w ;temp file
478 StrLen $R3 $4
479 StrCpy $R4 -1
480 StrCpy $R5 -1
481
482 loop_read:
483 ClearErrors
484 FileRead $R1 $R2 ;read line
485 IfErrors exit
486
487 StrCpy $5 0
488 StrCpy $7 $R2
489
490 loop_filter:
491 IntOp $5 $5 - 1
492 StrCpy $6 $7 $R3 $5 ;search
493 StrCmp $6 "" file_write2
494 StrCmp $6 $4 0 loop_filter
495
496 StrCpy $8 $7 $5 ;left part
497 IntOp $6 $5 + $R3
498 IntCmp $6 0 is0 not0
499 is0:
500 StrCpy $9 ""
501 Goto done
502 not0:
503 StrCpy $9 $7 "" $6 ;right part
504 done:
505 StrCpy $7 $8$3$9 ;re-join
506
507 IntOp $R4 $R4 + 1
508 StrCmp $2 all file_write1
509 StrCmp $R4 $2 0 file_write2
510 IntOp $R4 $R4 - 1
511
512 IntOp $R5 $R5 + 1
513 StrCmp $1 all file_write1
514 StrCmp $R5 $1 0 file_write1
515 IntOp $R5 $R5 - 1
516 Goto file_write2
517
518 file_write1:
519 FileWrite $R0 $7 ;write modified line
520 Goto loop_read
521
522 file_write2:
523 FileWrite $R0 $R2 ;write unmodified line
524 Goto loop_read
525
526 exit:
527 FileClose $R0
528 FileClose $R1
529
530 SetDetailsPrint none
531 Delete $0
532 Rename $R6 $0
533 Delete $R6
534 SetDetailsPrint both
535
536 Pop $R6
537 Pop $R5
538 Pop $R4
539 Pop $R3
540 Pop $R2
541 Pop $R1
542 Pop $R0
543 Pop $9
544 Pop $8
545 Pop $7
546 Pop $6
547 Pop $5
548 Pop $0
549 Pop $1
550 Pop $2
551 Pop $3
552 Pop $4
553 FunctionEnd
554
555
556 ; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
557 ; Push "\"
558 ; Call StrSlash
559 ; Pop $R0
560 ; ;Now $R0 contains 'c:/this/and/that/filename.htm'
561 Function StrSlash
562 Exch $R3 ; $R3 = needle ("\" or "/")
563 Exch
564 Exch $R1 ; $R1 = String to replacement in (haystack)
565 Push $R2 ; Replaced haystack
566 Push $R4 ; $R4 = not $R3 ("/" or "\")
567 Push $R6
568 Push $R7 ; Scratch reg
569 StrCpy $R2 ""
570 StrLen $R6 $R1
571 StrCpy $R4 "\"
572 StrCmp $R3 "/" loop
573 StrCpy $R4 "/"
574 loop:
575 StrCpy $R7 $R1 1
576 StrCpy $R1 $R1 $R6 1
577 StrCmp $R7 $R3 found
578 StrCpy $R2 "$R2$R7"
579 StrCmp $R1 "" done loop
580 found:
581 StrCpy $R2 "$R2$R4"
582 StrCmp $R1 "" done loop
583 done:
584 StrCpy $R3 $R2
585 Pop $R7
586 Pop $R6
587 Pop $R4
588 Pop $R2
589 Pop $R1
590 Exch $R3
14b661f @antonv added devkit/sas and fix bugs
antonv authored
591 FunctionEnd
Something went wrong with that request. Please try again.