comparison gaim-installer.nsi @ 7558:908343b14e70

[gaim-migrate @ 8172] Update for latest NSIS installer. Unattended installations are now possible. Users no longer need to click agree to get past GPL license committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 18 Nov 2003 22:17:56 +0000
parents eb0acf8c8f1e
children 6300424eafbf
comparison
equal deleted inserted replaced
7557:859ebaacc37b 7558:908343b14e70
2 ; Herman Bloggs <hermanator12002@yahoo.com> 2 ; Herman Bloggs <hermanator12002@yahoo.com>
3 3
4 ; NOTE: this .NSI script is designed for NSIS v2.0b4+ 4 ; NOTE: this .NSI script is designed for NSIS v2.0b4+
5 5
6 ;-------------------------------- 6 ;--------------------------------
7 ;Global Variables
8 Var name
9 Var GTK_FOLDER
10 Var GTK_THEME_SEL
11 Var LANG_IS_SET
12 Var ISSILENT
13
14 ;--------------------------------
7 ;Configuration 15 ;Configuration
8 16
9 ;General 17 ;The name var is set in .onInit
18 Name $name
19
10 !ifdef WITH_GTK 20 !ifdef WITH_GTK
11 OutFile "gaim-${GAIM_VERSION}.exe" 21 OutFile "gaim-${GAIM_VERSION}.exe"
12 !else 22 !else
13 !ifdef DEBUG 23 !ifdef DEBUG
14 OutFile "gaim-${GAIM_VERSION}-debug.exe" 24 OutFile "gaim-${GAIM_VERSION}-debug.exe"
15 !else 25 !else
16 OutFile "gaim-${GAIM_VERSION}-no-gtk.exe" 26 OutFile "gaim-${GAIM_VERSION}-no-gtk.exe"
17 !endif 27 !endif
18 !endif 28 !endif
29
19 SetCompressor bzip2 30 SetCompressor bzip2
20
21 DirShow show 31 DirShow show
22 ShowInstDetails show 32 ShowInstDetails show
23 ShowUninstDetails show 33 ShowUninstDetails show
24 SetDateSave on 34 SetDateSave on
25 35
26 ; $INSTDIR is set in .onInit function.. 36 ; $name and $INSTDIR are set in .onInit function..
27 37
28 !include "MUI.nsh" 38 !include "MUI.nsh"
29 !include Sections.nsh 39 !include "Sections.nsh"
30 40
31 ;-------------------------------- 41 ;--------------------------------
32 ;Defines 42 ;Defines
33 43
34 !define MUI_PRODUCT "Gaim" 44 !define GAIM_NSIS_INCLUDE_PATH ".\src\win32\nsis"
35 !define MUI_VERSION ${GAIM_VERSION} 45 !define GAIM_INSTALLER_DEPS "..\win32-dev\gaim-inst-deps"
36 46
37 !define MUI_ICON .\pixmaps\gaim-install.ico 47 !define GAIM_REG_KEY "SOFTWARE\gaim"
38 !define MUI_UNICON .\pixmaps\gaim-install.ico 48 !define GAIM_UNINSTALL_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
39 !define MUI_SPECIALBITMAP .\src\win32\nsis\gaim-intro.bmp 49 !define HKLM_APP_PATHS_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe"
40 !define MUI_HEADERBITMAP .\src\win32\nsis\gaim-header.bmp 50 !define GAIM_STARTUP_RUN_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
41 51 !define GAIM_UNINST_EXE "gaim-uninst.exe"
42 !define GAIM_NSIS_INCLUDE_PATH ".\src\win32\nsis" 52 !define GAIM_REG_LANG "Installer Language"
43 !define GAIM_INSTALLER_DEPS "..\win32-dev\gaim-inst-deps" 53
44 54 !define GTK_VERSION "2.2.4"
45 !define GAIM_REG_KEY "SOFTWARE\gaim" 55 !define GTK_REG_KEY "SOFTWARE\GTK\2.0"
46 !define GAIM_UNINSTALL_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" 56 !define PERL_REG_KEY "SOFTWARE\Perl"
47 !define HKLM_APP_PATHS_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe" 57 !define PERL_DLL "perl58.dll"
48 !define GAIM_STARTUP_RUN_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" 58 !define GTK_DEFAULT_INSTALL_PATH "$PROGRAMFILES\Common Files\GTK\2.0"
49 !define GAIM_UNINST_EXE "gaim-uninst.exe" 59 !define GTK_RUNTIME_INSTALLER "..\gtk_installer\gtk-runtime*.exe"
50 60 !define GTK_THEME_DIR "..\gtk_installer\gtk_themes"
51 !define GTK_VERSION "2.2.2" 61 !define GTK_DEFAULT_THEME_GTKRC_DIR "share\themes\Default\gtk-2.0"
52 !define GTK_REG_KEY "SOFTWARE\GTK\2.0" 62 !define GTK_DEFAULT_THEME_ENGINE_DIR "lib\gtk-2.0\2.2.0\engines"
53 !define PERL_REG_KEY "SOFTWARE\Perl" 63
54 !define PERL_DLL "perl58.dll" 64 ;--------------------------------
55 !define GTK_DEFAULT_INSTALL_PATH "$PROGRAMFILES\Common Files\GTK\2.0" 65 ;Modern UI Configuration
56 !define GTK_RUNTIME_INSTALLER "..\gtk_installer\gtk-runtime*.exe" 66
57 !define GTK_THEME_DIR "..\gtk_installer\gtk_themes" 67 !define MUI_ICON ".\pixmaps\gaim-install.ico"
58 !define GTK_DEFAULT_THEME_GTKRC_DIR "share\themes\Default\gtk-2.0" 68 !define MUI_UNICON ".\pixmaps\gaim-install.ico"
59 !define GTK_DEFAULT_THEME_ENGINE_DIR "lib\gtk-2.0\2.2.0\engines" 69 !define MUI_WELCOMEFINISHPAGE_BITMAP ".\src\win32\nsis\gaim-intro.bmp"
70 !define MUI_HEADERIMAGE
71 !define MUI_HEADERIMAGE_BITMAP ".\src\win32\nsis\gaim-header.bmp"
72
73 ; Alter License section
74 !define MUI_LICENSEPAGE_BUTTON $(GAIM_LICENSE_BUTTON)
75 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(GAIM_LICENSE_BOTTOM_TEXT)
76
77 !define MUI_COMPONENTSPAGE_SMALLDESC
78 !define MUI_ABORTWARNING
79
80 ;Finish Page config
81 !define MUI_FINISHPAGE_RUN "$INSTDIR\gaim.exe"
82 !define MUI_FINISHPAGE_RUN_NOTCHECKED
83 !define MUI_FINISHPAGE_LINK $(GAIM_FINISH_VISIT_WEB_SITE)
84 !define MUI_FINISHPAGE_LINK_LOCATION "http://gaim.sourceforge.net/win32"
60 85
61 ;-------------------------------- 86 ;--------------------------------
62 ;Pages 87 ;Pages
63 88
64 !insertmacro MUI_PAGE_WELCOME 89 !insertmacro MUI_PAGE_WELCOME
65 !insertmacro MUI_PAGE_LICENSE 90 !insertmacro MUI_PAGE_LICENSE "./COPYING"
66 !insertmacro MUI_PAGE_COMPONENTS 91 !insertmacro MUI_PAGE_COMPONENTS
67 Page custom ShowGtkInstallDirChooser GtkInstallDirVerify 92
93 !ifdef WITH_GTK
94 ; GTK+ install dir page
95 !define MUI_PAGE_CUSTOMFUNCTION_PRE preGtkDirPage
96 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE postGtkDirPage
97 !define MUI_DIRECTORYPAGE_VARIABLE $GTK_FOLDER
68 !insertmacro MUI_PAGE_DIRECTORY 98 !insertmacro MUI_PAGE_DIRECTORY
99 !endif
100
101 ; Gaim install dir page
102 !insertmacro MUI_PAGE_DIRECTORY
103
69 !insertmacro MUI_PAGE_INSTFILES 104 !insertmacro MUI_PAGE_INSTFILES
70 !insertmacro MUI_PAGE_FINISH 105 !insertmacro MUI_PAGE_FINISH
71 106
107 !insertmacro MUI_UNPAGE_WELCOME
72 !insertmacro MUI_UNPAGE_CONFIRM 108 !insertmacro MUI_UNPAGE_CONFIRM
73 !insertmacro MUI_UNPAGE_INSTFILES 109 !insertmacro MUI_UNPAGE_INSTFILES
74 110 !insertmacro MUI_UNPAGE_FINISH
75 ;--------------------------------
76 ;Modern UI Configuration
77
78 !define MUI_COMPONENTSPAGE_SMALLDESC
79 !define MUI_ABORTWARNING
80
81 ;Remember the installer language
82 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
83 !define MUI_LANGDLL_REGISTRY_KEY ${GAIM_REG_KEY}
84 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
85 !define MUI_LANGDLL_ALWAYSSHOW
86 111
87 ;-------------------------------- 112 ;--------------------------------
88 ;Languages 113 ;Languages
89 114
115 ;; English goes first because its the default. The rest are
116 ;; in alphabetical order (at least the strings actually displayed
117 ;; will be).
118
90 !insertmacro MUI_LANGUAGE "English" 119 !insertmacro MUI_LANGUAGE "English"
91 120
92 !insertmacro MUI_LANGUAGE "Bulgarian" 121 !insertmacro MUI_LANGUAGE "Bulgarian"
93 !insertmacro MUI_LANGUAGE "SimpChinese" 122 !insertmacro MUI_LANGUAGE "SimpChinese"
94 !insertmacro MUI_LANGUAGE "TradChinese" 123 !insertmacro MUI_LANGUAGE "TradChinese"
122 !include "${GAIM_NSIS_INCLUDE_PATH}\translations\trad-chinese.nsh" 151 !include "${GAIM_NSIS_INCLUDE_PATH}\translations\trad-chinese.nsh"
123 !include "${GAIM_NSIS_INCLUDE_PATH}\translations\korean.nsh" 152 !include "${GAIM_NSIS_INCLUDE_PATH}\translations\korean.nsh"
124 !include "${GAIM_NSIS_INCLUDE_PATH}\translations\romanian.nsh" 153 !include "${GAIM_NSIS_INCLUDE_PATH}\translations\romanian.nsh"
125 154
126 ;-------------------------------- 155 ;--------------------------------
127 ;Data
128
129 LicenseData /LANG=${LANG_ENGLISH} "./COPYING"
130 LicenseData /LANG=${LANG_GERMAN} "./COPYING"
131 LicenseData /LANG=${LANG_DUTCH} "./COPYING"
132 LicenseData /LANG=${LANG_FRENCH} "./COPYING"
133 LicenseData /LANG=${LANG_SIMPCHINESE} "./COPYING"
134 LicenseData /LANG=${LANG_SERBIAN} "./COPYING"
135 LicenseData /LANG=${LANG_PORTUGUESEBR} "./COPYING"
136 LicenseData /LANG=${LANG_HUNGARIAN} "./COPYING"
137 LicenseData /LANG=${LANG_ITALIAN} "./COPYING"
138 LicenseData /LANG=${LANG_BULGARIAN} "./COPYING"
139 LicenseData /LANG=${LANG_SWEDISH} "./COPYING"
140 LicenseData /LANG=${LANG_TRADCHINESE} "./COPYING"
141 LicenseData /LANG=${LANG_KOREAN} "./COPYING"
142 LicenseData /LANG=${LANG_ROMANIAN} "./COPYING"
143 LicenseData /LANG=${LANG_PORTUGUESE} "./COPYING"
144
145 ;--------------------------------
146 ;Reserve Files 156 ;Reserve Files
147 ; Only need this if using bzip2 compression 157 ; Only need this if using bzip2 compression
148 158
149 ReserveFile "${GAIM_NSIS_INCLUDE_PATH}\gtkInstall.ini"
150 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS 159 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
151 !insertmacro MUI_RESERVEFILE_LANGDLL 160 !insertmacro MUI_RESERVEFILE_LANGDLL
152 ReserveFile "${NSISDIR}\Plugins\AccessControl.dll" 161 ReserveFile "${NSISDIR}\Plugins\AccessControl.dll"
153 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll" 162 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
154 163
155 164
165 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
166 ;; Start Install Sections ;;
167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
156 168
157 ;-------------------------------- 169 ;--------------------------------
158 ;Uninstall any old version of Gaim 170 ;Uninstall any old version of Gaim
159 171
160 Section -SecUninstallOldGaim 172 Section -SecUninstallOldGaim
205 uninstall_problem: 217 uninstall_problem:
206 ; In this case just wipe out previous Gaim install dir.. 218 ; In this case just wipe out previous Gaim install dir..
207 ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry 219 ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry
208 ; and versions 0.60 and lower did not correctly set the uninstall reg string 220 ; and versions 0.60 and lower did not correctly set the uninstall reg string
209 ; (the string was set in quotes) 221 ; (the string was set in quotes)
222 IfSilent do_wipeout
210 MessageBox MB_YESNO $(GAIM_PROMPT_WIPEOUT) IDYES do_wipeout IDNO cancel_install 223 MessageBox MB_YESNO $(GAIM_PROMPT_WIPEOUT) IDYES do_wipeout IDNO cancel_install
211 cancel_install: 224 cancel_install:
212 Quit 225 Quit
213 226
214 do_wipeout: 227 do_wipeout:
246 259
247 Call DoWeNeedGtk 260 Call DoWeNeedGtk
248 Pop $R0 261 Pop $R0
249 Pop $R6 262 Pop $R6
250 263
251 ; Pass on the language we are using to GTK+ installer via registry..
252 WriteRegStr HKCU "${GTK_REG_KEY}" "Installer Language" "$LANGUAGE"
253
254 StrCmp $R0 "0" have_gtk 264 StrCmp $R0 "0" have_gtk
255 StrCmp $R0 "1" upgrade_gtk 265 StrCmp $R0 "1" upgrade_gtk
256 StrCmp $R0 "2" no_gtk no_gtk 266 StrCmp $R0 "2" no_gtk no_gtk
257 267
258 no_gtk: 268 no_gtk:
259 StrCmp $R1 "NONE" gtk_no_install_rights 269 StrCmp $R1 "NONE" gtk_no_install_rights
260 !insertmacro MUI_INSTALLOPTIONS_READ $R2 "gtkInstall.ini" "Field 4" "State"
261 ClearErrors 270 ClearErrors
262 ExecWait '"$TEMP\gtk-runtime.exe" /S /D=$R2' 271 ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT /D=$GTK_FOLDER'
263 Goto gtk_install_cont 272 Goto gtk_install_cont
264 273
265 upgrade_gtk: 274 upgrade_gtk:
275 StrCpy $GTK_FOLDER $R6
276 IfSilent skip_mb
266 MessageBox MB_YESNO $(GTK_UPGRADE_PROMPT) IDNO done 277 MessageBox MB_YESNO $(GTK_UPGRADE_PROMPT) IDNO done
278 skip_mb:
267 ClearErrors 279 ClearErrors
268 ExecWait '"$TEMP\gtk-runtime.exe" /S' 280 ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT'
269 Goto gtk_install_cont 281 Goto gtk_install_cont
270 282
271 gtk_install_cont: 283 gtk_install_cont:
272 IfErrors gtk_install_error 284 IfErrors gtk_install_error
273 StrCpy $R5 "1" ; marker that says we installed... 285 StrCpy $R5 "1" ; marker that says we installed...
274 Goto done 286 Goto done
275 287
276 gtk_install_error: 288 gtk_install_error:
277 Delete "$TEMP\gtk-runtime.exe" 289 Delete "$TEMP\gtk-runtime.exe"
290 IfSilent skip_mb1
278 MessageBox MB_OK $(GTK_INSTALL_ERROR) IDOK 291 MessageBox MB_OK $(GTK_INSTALL_ERROR) IDOK
292 skip_mb1:
279 Quit 293 Quit
280 294
281 have_gtk: 295 have_gtk:
282 StrCpy $R2 $R6 ; Copy GTK+ path 296 StrCpy $GTK_FOLDER $R6
283 StrCmp $R1 "NONE" done ; If we have no rights.. can't re-install.. 297 StrCmp $R1 "NONE" done ; If we have no rights.. can't re-install..
284 ; Even if we have a sufficient version of GTK+, we give user choice to re-install. 298 ; Even if we have a sufficient version of GTK+, we give user choice to re-install.
285 ClearErrors 299 ClearErrors
286 ExecWait '"$TEMP\gtk-runtime.exe" /S' 300 ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT'
287 IfErrors gtk_install_error 301 IfErrors gtk_install_error
288 Goto done 302 Goto done
289 303
290 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 304 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
291 ; end got_install rights 305 ; end got_install rights
292 306
293 gtk_no_install_rights: 307 gtk_no_install_rights:
308 ; Install GTK+ to Gaim install dir
309 StrCpy $GTK_FOLDER $INSTDIR
294 ClearErrors 310 ClearErrors
295 ExecWait '"$TEMP\gtk-runtime.exe" /S /D=$INSTDIR' 311 ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT /D=$GTK_FOLDER'
296 IfErrors gtk_install_error 312 IfErrors gtk_install_error
297 SetOverwrite on 313 SetOverwrite on
298 ClearErrors 314 ClearErrors
299 CopyFiles /FILESONLY "$INSTDIR\bin\*.dll" $INSTDIR 315 CopyFiles /FILESONLY "$GTK_FOLDER\bin\*.dll" $GTK_FOLDER
300 SetOverwrite off 316 SetOverwrite off
301 IfErrors gtk_install_error 317 IfErrors gtk_install_error
302 Delete "$INSTDIR\bin\*.dll" 318 Delete "$GTK_FOLDER\bin\*.dll"
303 Goto done 319 Goto done
304 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 320 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
305 ; end gtk_no_install_rights 321 ; end gtk_no_install_rights
306 322
307 done: 323 done:
394 ; If we don't have install rights.. we're done 410 ; If we don't have install rights.. we're done
395 StrCmp $R0 "NONE" done 411 StrCmp $R0 "NONE" done
396 CreateShortCut "$SMPROGRAMS\Gaim\Uninstall.lnk" "$INSTDIR\${GAIM_UNINST_EXE}" 412 CreateShortCut "$SMPROGRAMS\Gaim\Uninstall.lnk" "$INSTDIR\${GAIM_UNINST_EXE}"
397 SetOverwrite off 413 SetOverwrite off
398 414
415 ; Write out installer language
416 WriteRegStr HKCU "${GAIM_REG_KEY}" "${GAIM_REG_LANG}" "$LANGUAGE"
417
399 ; write out uninstaller 418 ; write out uninstaller
400 SetOverwrite on 419 SetOverwrite on
401 WriteUninstaller "$INSTDIR\${GAIM_UNINST_EXE}" 420 WriteUninstaller "$INSTDIR\${GAIM_UNINST_EXE}"
402 SetOverwrite off 421 SetOverwrite off
403 422
406 425
407 ;-------------------------------- 426 ;--------------------------------
408 ;GTK+ Themes 427 ;GTK+ Themes
409 428
410 SubSection /e $(GTK_THEMES_SECTION_TITLE) SecGtkThemes 429 SubSection /e $(GTK_THEMES_SECTION_TITLE) SecGtkThemes
411 Section $(GTK_NOTHEME_SECTION_TITLE) SecGtkNone 430 Section /o $(GTK_NOTHEME_SECTION_TITLE) SecGtkNone
412 Call CanWeInstallATheme 431 Call CanWeInstallATheme
413 Pop $R1 432 Pop $R0
414 StrCmp $R1 "" done 433 StrCmp $R0 "" done
415
416 SetOverwrite on 434 SetOverwrite on
417 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old 435 Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
418 CopyFiles $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.plain $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc 436 CopyFiles $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.plain $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc
419 SetOverwrite off 437 SetOverwrite off
420
421 done: 438 done:
422 SectionEnd 439 SectionEnd
423 440
424 Section $(GTK_WIMP_SECTION_TITLE) SecGtkWimp 441 Section $(GTK_WIMP_SECTION_TITLE) SecGtkWimp
425 Call CanWeInstallATheme 442 Call CanWeInstallATheme
426 Pop $R1 443 Pop $R0
427 StrCmp $R1 "" done 444 StrCmp $R0 "" done
428
429 SetOverwrite on 445 SetOverwrite on
430 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old 446 Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
431 SetOutPath $R1\${GTK_DEFAULT_THEME_ENGINE_DIR} 447 SetOutPath $R0\${GTK_DEFAULT_THEME_ENGINE_DIR}
432 File ${GTK_THEME_DIR}\engines\libwimp.dll 448 File ${GTK_THEME_DIR}\engines\libwimp.dll
433 SetOutPath $R1\${GTK_DEFAULT_THEME_GTKRC_DIR} 449 SetOutPath $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}
434 File ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp 450 File ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp
435 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp 451 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp
436 SetOverwrite off 452 SetOverwrite off
437
438 done: 453 done:
439 SectionEnd 454 SectionEnd
440 455
441 Section $(GTK_BLUECURVE_SECTION_TITLE) SecGtkBluecurve 456 Section /o $(GTK_BLUECURVE_SECTION_TITLE) SecGtkBluecurve
442 Call CanWeInstallATheme 457 Call CanWeInstallATheme
443 Pop $R1 458 Pop $R0
444 StrCmp $R1 "" done 459 StrCmp $R0 "" done
445
446 SetOverwrite on 460 SetOverwrite on
447 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old 461 Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
448 SetOutPath $R1\${GTK_DEFAULT_THEME_ENGINE_DIR} 462 SetOutPath $R0\${GTK_DEFAULT_THEME_ENGINE_DIR}
449 File ${GTK_THEME_DIR}\engines\libbluecurve.dll 463 File ${GTK_THEME_DIR}\engines\libbluecurve.dll
450 SetOutPath $R1\${GTK_DEFAULT_THEME_GTKRC_DIR} 464 SetOutPath $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}
451 File ${GTK_THEME_DIR}\themes\gtkrc.bluecurve 465 File ${GTK_THEME_DIR}\themes\gtkrc.bluecurve
452 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.bluecurve 466 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.bluecurve
453 SetOverwrite off 467 SetOverwrite off
454
455 done: 468 done:
456 SectionEnd 469 SectionEnd
457 470
458 Section $(GTK_LIGHTHOUSEBLUE_SECTION_TITLE) SecGtkLighthouseblue 471 Section /o $(GTK_LIGHTHOUSEBLUE_SECTION_TITLE) SecGtkLighthouseblue
459 Call CanWeInstallATheme 472 Call CanWeInstallATheme
460 Pop $R1 473 Pop $R0
461 StrCmp $R1 "" done 474 StrCmp $R0 "" done
462
463 SetOverwrite on 475 SetOverwrite on
464 Rename $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R1\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old 476 Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old
465 SetOutPath $R1\${GTK_DEFAULT_THEME_ENGINE_DIR} 477 SetOutPath $R0\${GTK_DEFAULT_THEME_ENGINE_DIR}
466 File ${GTK_THEME_DIR}\engines\liblighthouseblue.dll 478 File ${GTK_THEME_DIR}\engines\liblighthouseblue.dll
467 SetOutPath $R1\${GTK_DEFAULT_THEME_GTKRC_DIR} 479 SetOutPath $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}
468 File ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue 480 File ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue
469 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue 481 File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue
470 SetOverwrite off 482 SetOverwrite off
471
472 done: 483 done:
473 SectionEnd 484 SectionEnd
474 SubSectionEnd 485 SubSectionEnd
475 486
476 ;-------------------------------- 487 ;--------------------------------
504 cont_uninstall: 515 cont_uninstall:
505 ; The WinPrefs plugin may have left this behind.. 516 ; The WinPrefs plugin may have left this behind..
506 DeleteRegValue HKCU "${GAIM_STARTUP_RUN_KEY}" "Gaim" 517 DeleteRegValue HKCU "${GAIM_STARTUP_RUN_KEY}" "Gaim"
507 DeleteRegValue HKLM "${GAIM_STARTUP_RUN_KEY}" "Gaim" 518 DeleteRegValue HKLM "${GAIM_STARTUP_RUN_KEY}" "Gaim"
508 ; Remove Language preference info 519 ; Remove Language preference info
509 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY} 520 DeleteRegKey HKCU ${GAIM_REG_KEY} ;${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
510 521
511 RMDir /r "$INSTDIR\locale" 522 RMDir /r "$INSTDIR\locale"
512 RMDir /r "$INSTDIR\pixmaps" 523 RMDir /r "$INSTDIR\pixmaps"
513 RMDir /r "$INSTDIR\perlmod" 524 RMDir /r "$INSTDIR\perlmod"
514 Delete "$INSTDIR\plugins\autorecon.dll" 525 Delete "$INSTDIR\plugins\autorecon.dll"
564 Delete "$DESKTOP\Gaim.lnk" 575 Delete "$DESKTOP\Gaim.lnk"
565 576
566 Goto done 577 Goto done
567 578
568 cant_uninstall: 579 cant_uninstall:
580 IfSilent skip_mb
569 MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_1) IDOK 581 MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_1) IDOK
582 skip_mb:
570 Quit 583 Quit
571 584
572 no_rights: 585 no_rights:
586 IfSilent skip_mb1
573 MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_2) IDOK 587 MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_2) IDOK
588 skip_mb1:
574 Quit 589 Quit
575 590
576 done: 591 done:
577 ;Display the Finish header
578 !insertmacro MUI_UNFINISHHEADER
579 SectionEnd ; end of uninstall section 592 SectionEnd ; end of uninstall section
580 593
581 ;-------------------------------- 594 ;--------------------------------
582 ;Descriptions 595 ;Descriptions
583 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN 596 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
584 !insertmacro MUI_DESCRIPTION_TEXT ${SecGaim} \ 597 !insertmacro MUI_DESCRIPTION_TEXT ${SecGaim} \
585 $(GAIM_SECTION_DESCRIPTION) 598 $(GAIM_SECTION_DESCRIPTION)
586 !ifdef WITH_GTK 599 !ifdef WITH_GTK
587 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtk} \ 600 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtk} \
588 $(GTK_SECTION_DESCRIPTION) 601 $(GTK_SECTION_DESCRIPTION)
595 $(GTK_WIMP_THEME_DESC) 608 $(GTK_WIMP_THEME_DESC)
596 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkBluecurve} \ 609 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkBluecurve} \
597 $(GTK_BLUECURVE_THEME_DESC) 610 $(GTK_BLUECURVE_THEME_DESC)
598 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkLighthouseblue} \ 611 !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkLighthouseblue} \
599 $(GTK_LIGHTHOUSEBLUE_THEME_DESC) 612 $(GTK_LIGHTHOUSEBLUE_THEME_DESC)
600 !insertmacro MUI_FUNCTIONS_DESCRIPTION_END 613 !insertmacro MUI_FUNCTION_DESCRIPTION_END
601 614
602 ;-------------------------------- 615 ;--------------------------------
603 ;Functions 616 ;Functions
604 617
605 ; 618 ;
614 ; 627 ;
615 Function CanWeInstallATheme 628 Function CanWeInstallATheme
616 Push $1 629 Push $1
617 Push $0 630 Push $0
618 631
619 ; Did we install GTK+ to the Gaim dir? 632 ; Set default.. no rights
620 IfFileExists "$INSTDIR\lib" 0 check_keys 633 StrCpy $1 ""
621 StrCpy $1 $INSTDIR 634
622 Goto done
623
624 check_keys:
625 ; First see if we can install a theme..
626 Call CheckUserInstallRights 635 Call CheckUserInstallRights
627 Pop $0 636 Pop $0
628 637
629 StrCmp $0 "HKCU" hkcu 638 ; If no rights check if gtk was installed to gaim dir..
630 StrCmp $0 "HKLM" hklm no_rights 639 StrCmp $0 "NONE" 0 themes_cont
640 StrCmp $GTK_FOLDER $INSTDIR 0 no_rights
641 StrCpy $1 $INSTDIR
642 Goto done
643 themes_cont:
644
645 StrCmp $0 "HKCU" hkcu hklm
631 646
632 hkcu: 647 hkcu:
633 ReadRegStr $1 HKCU ${GTK_REG_KEY} "Path" 648 ReadRegStr $1 HKCU ${GTK_REG_KEY} "Path"
634 StrCmp $1 "" no_rights done 649 StrCmp $1 "" no_rights done
635 650
636 hklm: 651 hklm:
637 ReadRegStr $1 HKLM ${GTK_REG_KEY} "Path" 652 ReadRegStr $1 HKLM ${GTK_REG_KEY} "Path"
638 StrCmp $1 "" no_rights done 653 Goto done
639 654
640 no_rights: 655 no_rights:
641 MessageBox MB_OK $(GTK_NO_THEME_INSTALL_RIGHTS) IDOK done 656 IfSilent skip_mb
657 MessageBox MB_OK $(GTK_NO_THEME_INSTALL_RIGHTS) IDOK
658 skip_mb:
642 StrCpy $1 "" 659 StrCpy $1 ""
643 660
644 done: 661 done:
645 Pop $0 662 Pop $0
646 Exch $1 663 Exch $1
683 UserInfo::GetName 700 UserInfo::GetName
684 IfErrors Win9x 701 IfErrors Win9x
685 Pop $0 702 Pop $0
686 UserInfo::GetAccountType 703 UserInfo::GetAccountType
687 Pop $1 704 Pop $1
705
688 StrCmp $1 "Admin" 0 +3 706 StrCmp $1 "Admin" 0 +3
689 StrCpy $1 "HKLM" 707 StrCpy $1 "HKLM"
690 Goto done 708 Goto done
691 StrCmp $1 "Power" 0 +3 709 StrCmp $1 "Power" 0 +3
692 StrCpy $1 "HKLM" 710 StrCpy $1 "HKLM"
937 955
938 done: 956 done:
939 FunctionEnd 957 FunctionEnd
940 958
941 Function .onInit 959 Function .onInit
960 StrCpy $name "Gaim ${GAIM_VERSION}"
961 StrCpy $GTK_THEME_SEL ${SecGtkWimp}
962 StrCpy $ISSILENT "/NOUI"
963
964 ; GTK installer has two silent states.. one with Message boxes, one without
965 ; If gaim installer was run silently, we want to supress gtk installer msg boxes.
966 IfSilent 0 set_gtk_normal
967 StrCpy $ISSILENT "/S"
968 set_gtk_normal:
969
970 Call ParseParameters
971
942 ; If this installer dosn't have GTK, check whether we need it. 972 ; If this installer dosn't have GTK, check whether we need it.
943 !ifndef WITH_GTK 973 !ifndef WITH_GTK
944 Call DoWeNeedGtk 974 Call DoWeNeedGtk
945 Pop $0 975 Pop $0
946 Pop $1 976 Pop $GTK_FOLDER
947 977
948 StrCmp $0 "0" have_gtk need_gtk 978 StrCmp $0 "0" have_gtk need_gtk
949 need_gtk: 979 need_gtk:
980 IfSilent skip_mb
950 MessageBox MB_OK $(GTK_INSTALLER_NEEDED) IDOK 981 MessageBox MB_OK $(GTK_INSTALLER_NEEDED) IDOK
982 skip_mb:
951 Quit 983 Quit
952 have_gtk: 984 have_gtk:
953 !else
954 ;Extract InstallOptions INI Files
955 !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "${GAIM_NSIS_INCLUDE_PATH}\gtkInstall.ini" "gtkInstall.ini"
956 !endif 985 !endif
986
987 ; If install path was set on the command, use it.
988 StrCmp $INSTDIR "" 0 instdir_done
957 989
958 Call CheckUserInstallRights 990 Call CheckUserInstallRights
959 Pop $0 991 Pop $0
960 992
961 StrCmp $0 "HKLM" 0 user_dir 993 StrCmp $0 "HKLM" 0 user_dir
969 Pop $2 1001 Pop $2
970 StrCpy $INSTDIR "$2\Gaim" 1002 StrCpy $INSTDIR "$2\Gaim"
971 1003
972 instdir_done: 1004 instdir_done:
973 1005
974 ; Set up Theme sections.. 1006 IntCmp $LANG_IS_SET 1 skip_lang
975 StrCpy $1 ${SecGtkNone} ; Sets global to remember which theme is set. 1007 ; Display Language selection dialog
976 !insertmacro SelectSection ${SecGtkNone} 1008 !insertmacro MUI_LANGDLL_DISPLAY
977 !insertmacro UnselectSection ${SecGtkWimp} 1009 skip_lang:
978 !insertmacro UnselectSection ${SecGtkBluecurve}
979 !insertmacro UnselectSection ${SecGtkLighthouseblue}
980
981 ; Display Language selection dialog
982 !insertmacro MUI_LANGDLL_DISPLAY
983
984 FunctionEnd 1010 FunctionEnd
985 1011
986 Function un.onInit 1012 Function un.onInit
987 1013
988 ; Get stored language prefrence 1014 ; Get stored language prefrence
989 !insertmacro MUI_UNGETLANGUAGE 1015 ReadRegStr $LANGUAGE HKCU ${GAIM_REG_KEY} "${GAIM_REG_LANG}"
990 1016
991 FunctionEnd 1017 FunctionEnd
992 1018
993 Function .onSelChange 1019 Function .onSelChange
994 Push $0 1020 Push $0
1008 SectionSetFlags ${SecGtkWimp} 0 1034 SectionSetFlags ${SecGtkWimp} 0
1009 SectionSetFlags ${SecGtkBluecurve} 0 1035 SectionSetFlags ${SecGtkBluecurve} 0
1010 SectionSetFlags ${SecGtkLighthouseblue} 0 1036 SectionSetFlags ${SecGtkLighthouseblue} 0
1011 skip: 1037 skip:
1012 1038
1013 !insertmacro UnselectSection $1 1039 !insertmacro UnselectSection $GTK_THEME_SEL
1014 1040
1015 ; Remember old selection 1041 ; Remember old selection
1016 StrCpy $2 $1 1042 StrCpy $2 $GTK_THEME_SEL
1017 1043
1018 ; Now go through and see who is checked.. 1044 ; Now go through and see who is checked..
1019 SectionGetFlags ${SecGtkNone} $0 1045 SectionGetFlags ${SecGtkNone} $0
1020 IntOp $0 $0 & ${SF_SELECTED} 1046 IntOp $0 $0 & ${SF_SELECTED}
1021 IntCmp $0 ${SF_SELECTED} 0 +2 +2 1047 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1022 StrCpy $1 ${SecGtkNone} 1048 StrCpy $GTK_THEME_SEL ${SecGtkNone}
1023 SectionGetFlags ${SecGtkWimp} $0 1049 SectionGetFlags ${SecGtkWimp} $0
1024 IntOp $0 $0 & ${SF_SELECTED} 1050 IntOp $0 $0 & ${SF_SELECTED}
1025 IntCmp $0 ${SF_SELECTED} 0 +2 +2 1051 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1026 StrCpy $1 ${SecGtkWimp} 1052 StrCpy $GTK_THEME_SEL ${SecGtkWimp}
1027 SectionGetFlags ${SecGtkBluecurve} $0 1053 SectionGetFlags ${SecGtkBluecurve} $0
1028 IntOp $0 $0 & ${SF_SELECTED} 1054 IntOp $0 $0 & ${SF_SELECTED}
1029 IntCmp $0 ${SF_SELECTED} 0 +2 +2 1055 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1030 StrCpy $1 ${SecGtkBluecurve} 1056 StrCpy $GTK_THEME_SEL ${SecGtkBluecurve}
1031 SectionGetFlags ${SecGtkLighthouseblue} $0 1057 SectionGetFlags ${SecGtkLighthouseblue} $0
1032 IntOp $0 $0 & ${SF_SELECTED} 1058 IntOp $0 $0 & ${SF_SELECTED}
1033 IntCmp $0 ${SF_SELECTED} 0 +2 +2 1059 IntCmp $0 ${SF_SELECTED} 0 +2 +2
1034 StrCpy $1 ${SecGtkLighthouseblue} 1060 StrCpy $GTK_THEME_SEL ${SecGtkLighthouseblue}
1035 1061
1036 StrCmp $2 $1 0 +2 ; selection hasn't changed 1062 StrCmp $2 $GTK_THEME_SEL 0 +2 ; selection hasn't changed
1037 !insertmacro SelectSection $1 1063 !insertmacro SelectSection $GTK_THEME_SEL
1038 1064
1039 Pop $2 1065 Pop $2
1040 Pop $0 1066 Pop $0
1041 FunctionEnd 1067 FunctionEnd
1042 1068
1043 Function ShowGtkInstallDirChooser 1069 ; Page enter and exit functions..
1070
1071 Function preGtkDirPage
1044 Call DoWeNeedGtk 1072 Call DoWeNeedGtk
1045 Pop $0 1073 Pop $0
1046 Pop $1 1074 Pop $1
1047 1075
1048 StrCmp $0 "0" have_gtk 1076 StrCmp $0 "0" have_gtk
1069 StrCpy $2 "$2\GTK\2.0" 1097 StrCpy $2 "$2\GTK\2.0"
1070 Goto got_path 1098 Goto got_path
1071 hklm1: 1099 hklm1:
1072 StrCpy $2 "${GTK_DEFAULT_INSTALL_PATH}" 1100 StrCpy $2 "${GTK_DEFAULT_INSTALL_PATH}"
1073 1101
1074 got_path: 1102 got_path:
1075 !insertmacro MUI_INSTALLOPTIONS_WRITE "gtkInstall.ini" "Field 4" "State" $2 1103 StrCpy $name "GTK+ ${GTK_VERSION}"
1076 1104 StrCpy $GTK_FOLDER $2
1077 !insertmacro MUI_INSTALLOPTIONS_WRITE "gtkInstall.ini" "Field 1" "Text" $(GTK_PAGE_INSTALL_MSG1) 1105 FunctionEnd
1078 !insertmacro MUI_INSTALLOPTIONS_WRITE "gtkInstall.ini" "Field 2" "Text" $(GTK_PAGE_INSTALL_MSG2) 1106
1079 !insertmacro MUI_HEADER_TEXT "$(GTK_PAGE_TITLE)" "$(GTK_PAGE_SUBTITLE)" 1107 Function postGtkDirPage
1080 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "gtkInstall.ini" 1108 StrCpy $name "Gaim ${GAIM_VERSION}"
1081 FunctionEnd 1109 Push $GTK_FOLDER
1082
1083 Function GtkInstallDirVerify
1084 !insertmacro MUI_INSTALLOPTIONS_READ $0 "gtkInstall.ini" "Field 4" "State"
1085 Push $0
1086 Call VerifyDir 1110 Call VerifyDir
1087 Pop $0 1111 Pop $0
1088 StrCmp $0 "0" 0 done 1112 StrCmp $0 "0" 0 done
1113 IfSilent skip_mb
1089 MessageBox MB_OK $(GTK_BAD_INSTALL_PATH) IDOK 1114 MessageBox MB_OK $(GTK_BAD_INSTALL_PATH) IDOK
1115 skip_mb:
1090 Abort 1116 Abort
1091 done: 1117 done:
1092 FunctionEnd 1118 FunctionEnd
1093 1119
1120 ; GetParameters
1121 ; input, none
1122 ; output, top of stack (replaces, with e.g. whatever)
1123 ; modifies no other variables.
1124
1125 Function GetParameters
1126
1127 Push $R0
1128 Push $R1
1129 Push $R2
1130 Push $R3
1131
1132 StrCpy $R2 1
1133 StrLen $R3 $CMDLINE
1134
1135 ;Check for quote or space
1136 StrCpy $R0 $CMDLINE $R2
1137 StrCmp $R0 '"' 0 +3
1138 StrCpy $R1 '"'
1139 Goto loop
1140 StrCpy $R1 " "
1141
1142 loop:
1143 IntOp $R2 $R2 + 1
1144 StrCpy $R0 $CMDLINE 1 $R2
1145 StrCmp $R0 $R1 get
1146 StrCmp $R2 $R3 get
1147 Goto loop
1148
1149 get:
1150 IntOp $R2 $R2 + 1
1151 StrCpy $R0 $CMDLINE 1 $R2
1152 StrCmp $R0 " " get
1153 StrCpy $R0 $CMDLINE "" $R2
1154
1155 Pop $R3
1156 Pop $R2
1157 Pop $R1
1158 Exch $R0
1159
1160 FunctionEnd
1161
1162 ; StrStr
1163 ; input, top of stack = string to search for
1164 ; top of stack-1 = string to search in
1165 ; output, top of stack (replaces with the portion of the string remaining)
1166 ; modifies no other variables.
1167 ;
1168 ; Usage:
1169 ; Push "this is a long ass string"
1170 ; Push "ass"
1171 ; Call StrStr
1172 ; Pop $R0
1173 ; ($R0 at this point is "ass string")
1174
1175 Function StrStr
1176 Exch $R1 ; st=haystack,old$R1, $R1=needle
1177 Exch ; st=old$R1,haystack
1178 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
1179 Push $R3
1180 Push $R4
1181 Push $R5
1182 StrLen $R3 $R1
1183 StrCpy $R4 0
1184 ; $R1=needle
1185 ; $R2=haystack
1186 ; $R3=len(needle)
1187 ; $R4=cnt
1188 ; $R5=tmp
1189 loop:
1190 StrCpy $R5 $R2 $R3 $R4
1191 StrCmp $R5 $R1 done
1192 StrCmp $R5 "" done
1193 IntOp $R4 $R4 + 1
1194 Goto loop
1195 done:
1196 StrCpy $R1 $R2 "" $R4
1197 Pop $R5
1198 Pop $R4
1199 Pop $R3
1200 Pop $R2
1201 Exch $R1
1202 FunctionEnd
1203
1204 ;
1205 ; Parse the Command line
1206 ;
1207 ; Unattended install command line parameters
1208 ; /L=Language e.g.: /L=1033
1209 ;
1210 Function ParseParameters
1211 IntOp $LANG_IS_SET 0 + 0
1212 Call GetParameters
1213 Pop $R0
1214 Push $R0
1215 Push "L="
1216 Call StrStr
1217 Pop $R1
1218 StrCmp $R1 "" next
1219 StrCpy $R1 $R1 4 2 ; Strip first 2 chars of string
1220 StrCpy $LANGUAGE $R1
1221 IntOp $LANG_IS_SET 0 + 1
1222 next:
1223 FunctionEnd