| 1 | ; Installer script for win32 Gaim |
|---|
| 2 | ; Herman Bloggs <hermanator12002@yahoo.com> |
|---|
| 3 | |
|---|
| 4 | ; NOTE: this .NSI script is intended for NSIS 2.0 (final release). |
|---|
| 5 | ; |
|---|
| 6 | |
|---|
| 7 | ;-------------------------------- |
|---|
| 8 | ;Global Variables |
|---|
| 9 | Var name |
|---|
| 10 | Var GTK_FOLDER |
|---|
| 11 | Var GTK_THEME_SEL |
|---|
| 12 | Var LANG_IS_SET |
|---|
| 13 | Var ISSILENT |
|---|
| 14 | Var STARTUP_RUN_KEY |
|---|
| 15 | |
|---|
| 16 | ;-------------------------------- |
|---|
| 17 | ;Configuration |
|---|
| 18 | |
|---|
| 19 | ;The name var is set in .onInit |
|---|
| 20 | Name $name |
|---|
| 21 | |
|---|
| 22 | !ifdef WITH_GTK |
|---|
| 23 | OutFile "gaim-${GAIM_VERSION}.exe" |
|---|
| 24 | !else |
|---|
| 25 | !ifdef DEBUG |
|---|
| 26 | OutFile "gaim-${GAIM_VERSION}-debug.exe" |
|---|
| 27 | !else |
|---|
| 28 | OutFile "gaim-${GAIM_VERSION}-no-gtk.exe" |
|---|
| 29 | !endif |
|---|
| 30 | !endif |
|---|
| 31 | |
|---|
| 32 | SetCompressor lzma |
|---|
| 33 | ShowInstDetails show |
|---|
| 34 | ShowUninstDetails show |
|---|
| 35 | SetDateSave on |
|---|
| 36 | |
|---|
| 37 | ; $name and $INSTDIR are set in .onInit function.. |
|---|
| 38 | |
|---|
| 39 | !include "MUI.nsh" |
|---|
| 40 | !include "Sections.nsh" |
|---|
| 41 | |
|---|
| 42 | ;-------------------------------- |
|---|
| 43 | ;Defines |
|---|
| 44 | |
|---|
| 45 | !define GAIM_NSIS_INCLUDE_PATH ".\src\win32\nsis" |
|---|
| 46 | !define GAIM_INSTALLER_DEPS "..\win32-dev\gaim-inst-deps" |
|---|
| 47 | |
|---|
| 48 | !define GAIM_REG_KEY "SOFTWARE\gaim" |
|---|
| 49 | !define GAIM_UNINSTALL_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" |
|---|
| 50 | !define HKLM_APP_PATHS_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\gaim.exe" |
|---|
| 51 | !define GAIM_STARTUP_RUN_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" |
|---|
| 52 | !define GAIM_UNINST_EXE "gaim-uninst.exe" |
|---|
| 53 | !define GAIM_REG_LANG "Installer Language" |
|---|
| 54 | |
|---|
| 55 | !define GTK_VERSION "2.6.8" |
|---|
| 56 | !define GTK_REG_KEY "SOFTWARE\GTK\2.0" |
|---|
| 57 | !define PERL_REG_KEY "SOFTWARE\Perl" |
|---|
| 58 | !define PERL_DLL "perl58.dll" |
|---|
| 59 | !define GTK_DEFAULT_INSTALL_PATH "$PROGRAMFILES\Common Files\GTK\2.0" |
|---|
| 60 | !define GTK_RUNTIME_INSTALLER "..\gtk_installer\gtk-runtime*.exe" |
|---|
| 61 | !define GTK_THEME_DIR "..\gtk_installer\gtk_themes" |
|---|
| 62 | !define GTK_DEFAULT_THEME_GTKRC_DIR "share\themes\Default\gtk-2.0" |
|---|
| 63 | !define GTK_DEFAULT_THEME_ENGINE_DIR "lib\gtk-2.0\2.4.0\engines" |
|---|
| 64 | |
|---|
| 65 | ;-------------------------------- |
|---|
| 66 | ;Modern UI Configuration |
|---|
| 67 | |
|---|
| 68 | !define MUI_ICON ".\pixmaps\gaim-install.ico" |
|---|
| 69 | !define MUI_UNICON ".\pixmaps\gaim-install.ico" |
|---|
| 70 | !define MUI_WELCOMEFINISHPAGE_BITMAP ".\src\win32\nsis\gaim-intro.bmp" |
|---|
| 71 | !define MUI_HEADERIMAGE |
|---|
| 72 | !define MUI_HEADERIMAGE_BITMAP ".\src\win32\nsis\gaim-header.bmp" |
|---|
| 73 | |
|---|
| 74 | ; Alter License section |
|---|
| 75 | !define MUI_LICENSEPAGE_BUTTON $(GAIM_LICENSE_BUTTON) |
|---|
| 76 | !define MUI_LICENSEPAGE_TEXT_BOTTOM $(GAIM_LICENSE_BOTTOM_TEXT) |
|---|
| 77 | |
|---|
| 78 | !define MUI_COMPONENTSPAGE_SMALLDESC |
|---|
| 79 | !define MUI_ABORTWARNING |
|---|
| 80 | |
|---|
| 81 | ;Finish Page config |
|---|
| 82 | !define MUI_FINISHPAGE_RUN "$INSTDIR\gaim.exe" |
|---|
| 83 | !define MUI_FINISHPAGE_RUN_NOTCHECKED |
|---|
| 84 | !define MUI_FINISHPAGE_LINK $(GAIM_FINISH_VISIT_WEB_SITE) |
|---|
| 85 | !define MUI_FINISHPAGE_LINK_LOCATION "http://gaim.sourceforge.net/win32" |
|---|
| 86 | |
|---|
| 87 | ;-------------------------------- |
|---|
| 88 | ;Pages |
|---|
| 89 | |
|---|
| 90 | !define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcomePage |
|---|
| 91 | !insertmacro MUI_PAGE_WELCOME |
|---|
| 92 | !insertmacro MUI_PAGE_LICENSE "./COPYING" |
|---|
| 93 | !insertmacro MUI_PAGE_COMPONENTS |
|---|
| 94 | |
|---|
| 95 | !ifdef WITH_GTK |
|---|
| 96 | ; GTK+ install dir page |
|---|
| 97 | !define MUI_PAGE_CUSTOMFUNCTION_PRE preGtkDirPage |
|---|
| 98 | !define MUI_PAGE_CUSTOMFUNCTION_LEAVE postGtkDirPage |
|---|
| 99 | !define MUI_DIRECTORYPAGE_VARIABLE $GTK_FOLDER |
|---|
| 100 | !insertmacro MUI_PAGE_DIRECTORY |
|---|
| 101 | !endif |
|---|
| 102 | |
|---|
| 103 | ; Gaim install dir page |
|---|
| 104 | !insertmacro MUI_PAGE_DIRECTORY |
|---|
| 105 | |
|---|
| 106 | !insertmacro MUI_PAGE_INSTFILES |
|---|
| 107 | !insertmacro MUI_PAGE_FINISH |
|---|
| 108 | |
|---|
| 109 | !insertmacro MUI_UNPAGE_WELCOME |
|---|
| 110 | !insertmacro MUI_UNPAGE_CONFIRM |
|---|
| 111 | !insertmacro MUI_UNPAGE_INSTFILES |
|---|
| 112 | !insertmacro MUI_UNPAGE_FINISH |
|---|
| 113 | |
|---|
| 114 | ;-------------------------------- |
|---|
| 115 | ;Languages |
|---|
| 116 | |
|---|
| 117 | ;; English goes first because its the default. The rest are |
|---|
| 118 | ;; in alphabetical order (at least the strings actually displayed |
|---|
| 119 | ;; will be). |
|---|
| 120 | |
|---|
| 121 | !insertmacro MUI_LANGUAGE "English" |
|---|
| 122 | |
|---|
| 123 | !insertmacro MUI_LANGUAGE "Albanian" |
|---|
| 124 | !insertmacro MUI_LANGUAGE "Bulgarian" |
|---|
| 125 | !insertmacro MUI_LANGUAGE "Catalan" |
|---|
| 126 | !insertmacro MUI_LANGUAGE "Czech" |
|---|
| 127 | !insertmacro MUI_LANGUAGE "Danish" |
|---|
| 128 | !insertmacro MUI_LANGUAGE "SimpChinese" |
|---|
| 129 | !insertmacro MUI_LANGUAGE "TradChinese" |
|---|
| 130 | !insertmacro MUI_LANGUAGE "German" |
|---|
| 131 | !insertmacro MUI_LANGUAGE "Spanish" |
|---|
| 132 | !insertmacro MUI_LANGUAGE "French" |
|---|
| 133 | !insertmacro MUI_LANGUAGE "Hebrew" |
|---|
| 134 | !insertmacro MUI_LANGUAGE "Italian" |
|---|
| 135 | !insertmacro MUI_LANGUAGE "Japanese" |
|---|
| 136 | !insertmacro MUI_LANGUAGE "Korean" |
|---|
| 137 | !insertmacro MUI_LANGUAGE "Hungarian" |
|---|
| 138 | !insertmacro MUI_LANGUAGE "Dutch" |
|---|
| 139 | !insertmacro MUI_LANGUAGE "Norwegian" |
|---|
| 140 | !insertmacro MUI_LANGUAGE "Polish" |
|---|
| 141 | !insertmacro MUI_LANGUAGE "PortugueseBR" |
|---|
| 142 | !insertmacro MUI_LANGUAGE "Portuguese" |
|---|
| 143 | !insertmacro MUI_LANGUAGE "Romanian" |
|---|
| 144 | !insertmacro MUI_LANGUAGE "Russian" |
|---|
| 145 | !insertmacro MUI_LANGUAGE "Serbian" |
|---|
| 146 | !insertmacro MUI_LANGUAGE "Slovak" |
|---|
| 147 | !insertmacro MUI_LANGUAGE "Slovenian" |
|---|
| 148 | !insertmacro MUI_LANGUAGE "Finnish" |
|---|
| 149 | !insertmacro MUI_LANGUAGE "Swedish" |
|---|
| 150 | |
|---|
| 151 | ;-------------------------------- |
|---|
| 152 | ;Translations |
|---|
| 153 | |
|---|
| 154 | !define GAIM_DEFAULT_LANGFILE "${GAIM_NSIS_INCLUDE_PATH}\translations\english.nsh" |
|---|
| 155 | |
|---|
| 156 | !include "${GAIM_NSIS_INCLUDE_PATH}\langmacros.nsh" |
|---|
| 157 | |
|---|
| 158 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "ALBANIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\albanian.nsh" |
|---|
| 159 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "BULGARIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\bulgarian.nsh" |
|---|
| 160 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "CATALAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\catalan.nsh" |
|---|
| 161 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "CZECH" "${GAIM_NSIS_INCLUDE_PATH}\translations\czech.nsh" |
|---|
| 162 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "DANISH" "${GAIM_NSIS_INCLUDE_PATH}\translations\danish.nsh" |
|---|
| 163 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "DUTCH" "${GAIM_NSIS_INCLUDE_PATH}\translations\dutch.nsh" |
|---|
| 164 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "ENGLISH" "${GAIM_NSIS_INCLUDE_PATH}\translations\english.nsh" |
|---|
| 165 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "FINNISH" "${GAIM_NSIS_INCLUDE_PATH}\translations\finnish.nsh" |
|---|
| 166 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "FRENCH" "${GAIM_NSIS_INCLUDE_PATH}\translations\french.nsh" |
|---|
| 167 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "GERMAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\german.nsh" |
|---|
| 168 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "HEBREW" "${GAIM_NSIS_INCLUDE_PATH}\translations\hebrew.nsh" |
|---|
| 169 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "HUNGARIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\hungarian.nsh" |
|---|
| 170 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "ITALIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\italian.nsh" |
|---|
| 171 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "JAPANESE" "${GAIM_NSIS_INCLUDE_PATH}\translations\japanese.nsh" |
|---|
| 172 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "KOREAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\korean.nsh" |
|---|
| 173 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "NORWEGIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\norwegian.nsh" |
|---|
| 174 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "POLISH" "${GAIM_NSIS_INCLUDE_PATH}\translations\polish.nsh" |
|---|
| 175 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "PORTUGUESE" "${GAIM_NSIS_INCLUDE_PATH}\translations\portuguese.nsh" |
|---|
| 176 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "PORTUGUESEBR" "${GAIM_NSIS_INCLUDE_PATH}\translations\portuguese-br.nsh" |
|---|
| 177 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "ROMANIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\romanian.nsh" |
|---|
| 178 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "RUSSIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\russian.nsh" |
|---|
| 179 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "SERBIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\serbian-latin.nsh" |
|---|
| 180 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "SIMPCHINESE" "${GAIM_NSIS_INCLUDE_PATH}\translations\simp-chinese.nsh" |
|---|
| 181 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "SLOVAK" "${GAIM_NSIS_INCLUDE_PATH}\translations\slovak.nsh" |
|---|
| 182 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "SLOVENIAN" "${GAIM_NSIS_INCLUDE_PATH}\translations\slovenian.nsh" |
|---|
| 183 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "SPANISH" "${GAIM_NSIS_INCLUDE_PATH}\translations\spanish.nsh" |
|---|
| 184 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "SWEDISH" "${GAIM_NSIS_INCLUDE_PATH}\translations\swedish.nsh" |
|---|
| 185 | !insertmacro GAIM_MACRO_INCLUDE_LANGFILE "TRADCHINESE" "${GAIM_NSIS_INCLUDE_PATH}\translations\trad-chinese.nsh" |
|---|
| 186 | |
|---|
| 187 | ;-------------------------------- |
|---|
| 188 | ;Reserve Files |
|---|
| 189 | ; Only need this if using bzip2 compression |
|---|
| 190 | |
|---|
| 191 | !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS |
|---|
| 192 | !insertmacro MUI_RESERVEFILE_LANGDLL |
|---|
| 193 | ReserveFile "${NSISDIR}\Plugins\UserInfo.dll" |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|---|
| 197 | ;; Start Install Sections ;; |
|---|
| 198 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|---|
| 199 | |
|---|
| 200 | ;-------------------------------- |
|---|
| 201 | ;Uninstall any old version of Gaim |
|---|
| 202 | |
|---|
| 203 | Section -SecUninstallOldGaim |
|---|
| 204 | ; Check install rights.. |
|---|
| 205 | Call CheckUserInstallRights |
|---|
| 206 | Pop $R0 |
|---|
| 207 | |
|---|
| 208 | ;If gaim is currently set to run on startup, |
|---|
| 209 | ; save the section of the Registry where the setting is before uninstalling, |
|---|
| 210 | ; so we can put it back after installing the new version |
|---|
| 211 | ClearErrors |
|---|
| 212 | ReadRegStr $STARTUP_RUN_KEY HKCU "${GAIM_STARTUP_RUN_KEY}" "Gaim" |
|---|
| 213 | IfErrors +3 |
|---|
| 214 | StrCpy $STARTUP_RUN_KEY "HKCU" |
|---|
| 215 | Goto +4 |
|---|
| 216 | ReadRegStr $STARTUP_RUN_KEY HKLM "${GAIM_STARTUP_RUN_KEY}" "Gaim" |
|---|
| 217 | IfErrors +2 |
|---|
| 218 | StrCpy $STARTUP_RUN_KEY "HKLM" |
|---|
| 219 | |
|---|
| 220 | StrCmp $R0 "HKLM" gaim_hklm |
|---|
| 221 | StrCmp $R0 "HKCU" gaim_hkcu done |
|---|
| 222 | |
|---|
| 223 | gaim_hkcu: |
|---|
| 224 | ReadRegStr $R1 HKCU ${GAIM_REG_KEY} "" |
|---|
| 225 | ReadRegStr $R2 HKCU ${GAIM_REG_KEY} "Version" |
|---|
| 226 | ReadRegStr $R3 HKCU "${GAIM_UNINSTALL_KEY}" "UninstallString" |
|---|
| 227 | Goto try_uninstall |
|---|
| 228 | |
|---|
| 229 | gaim_hklm: |
|---|
| 230 | ReadRegStr $R1 HKLM ${GAIM_REG_KEY} "" |
|---|
| 231 | ReadRegStr $R2 HKLM ${GAIM_REG_KEY} "Version" |
|---|
| 232 | ReadRegStr $R3 HKLM "${GAIM_UNINSTALL_KEY}" "UninstallString" |
|---|
| 233 | |
|---|
| 234 | ; If previous version exists .. remove |
|---|
| 235 | try_uninstall: |
|---|
| 236 | StrCmp $R1 "" done |
|---|
| 237 | ; Version key started with 0.60a3. Prior versions can't be |
|---|
| 238 | ; automaticlly uninstalled. |
|---|
| 239 | StrCmp $R2 "" uninstall_problem |
|---|
| 240 | ; Check if we have uninstall string.. |
|---|
| 241 | IfFileExists $R3 0 uninstall_problem |
|---|
| 242 | ; Have uninstall string.. go ahead and uninstall. |
|---|
| 243 | SetOverwrite on |
|---|
| 244 | ; Need to copy uninstaller outside of the install dir |
|---|
| 245 | ClearErrors |
|---|
| 246 | CopyFiles /SILENT $R3 "$TEMP\${GAIM_UNINST_EXE}" |
|---|
| 247 | SetOverwrite off |
|---|
| 248 | IfErrors uninstall_problem |
|---|
| 249 | ; Ready to uninstall.. |
|---|
| 250 | ClearErrors |
|---|
| 251 | ExecWait '"$TEMP\${GAIM_UNINST_EXE}" /S _?=$R1' |
|---|
| 252 | IfErrors exec_error |
|---|
| 253 | Delete "$TEMP\${GAIM_UNINST_EXE}" |
|---|
| 254 | Goto done |
|---|
| 255 | |
|---|
| 256 | exec_error: |
|---|
| 257 | Delete "$TEMP\${GAIM_UNINST_EXE}" |
|---|
| 258 | Goto uninstall_problem |
|---|
| 259 | |
|---|
| 260 | uninstall_problem: |
|---|
| 261 | ; In this case just wipe out previous Gaim install dir.. |
|---|
| 262 | ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry |
|---|
| 263 | ; and versions 0.60 and lower did not correctly set the uninstall reg string |
|---|
| 264 | ; (the string was set in quotes) |
|---|
| 265 | IfSilent do_wipeout |
|---|
| 266 | MessageBox MB_YESNO $(GAIM_PROMPT_WIPEOUT) IDYES do_wipeout IDNO cancel_install |
|---|
| 267 | cancel_install: |
|---|
| 268 | Quit |
|---|
| 269 | |
|---|
| 270 | do_wipeout: |
|---|
| 271 | StrCmp $R0 "HKLM" gaim_del_lm_reg gaim_del_cu_reg |
|---|
| 272 | gaim_del_cu_reg: |
|---|
| 273 | DeleteRegKey HKCU ${GAIM_REG_KEY} |
|---|
| 274 | Goto uninstall_prob_cont |
|---|
| 275 | gaim_del_lm_reg: |
|---|
| 276 | DeleteRegKey HKLM ${GAIM_REG_KEY} |
|---|
| 277 | |
|---|
| 278 | uninstall_prob_cont: |
|---|
| 279 | RMDir /r "$R1" |
|---|
| 280 | |
|---|
| 281 | done: |
|---|
| 282 | SectionEnd |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | ;-------------------------------- |
|---|
| 286 | ;GTK+ Runtime Install Section |
|---|
| 287 | |
|---|
| 288 | !ifdef WITH_GTK |
|---|
| 289 | Section $(GTK_SECTION_TITLE) SecGtk |
|---|
| 290 | SectionIn 1 RO |
|---|
| 291 | |
|---|
| 292 | Call CheckUserInstallRights |
|---|
| 293 | Pop $R1 |
|---|
| 294 | |
|---|
| 295 | SetOutPath $TEMP |
|---|
| 296 | SetOverwrite on |
|---|
| 297 | File /oname=gtk-runtime.exe ${GTK_RUNTIME_INSTALLER} |
|---|
| 298 | SetOverwrite off |
|---|
| 299 | |
|---|
| 300 | ; This keeps track whether we install GTK+ or not.. |
|---|
| 301 | StrCpy $R5 "0" |
|---|
| 302 | |
|---|
| 303 | Call DoWeNeedGtk |
|---|
| 304 | Pop $R0 |
|---|
| 305 | Pop $R6 |
|---|
| 306 | |
|---|
| 307 | StrCmp $R0 "0" have_gtk |
|---|
| 308 | StrCmp $R0 "1" upgrade_gtk |
|---|
| 309 | StrCmp $R0 "2" no_gtk no_gtk |
|---|
| 310 | |
|---|
| 311 | no_gtk: |
|---|
| 312 | StrCmp $R1 "NONE" gtk_no_install_rights |
|---|
| 313 | ClearErrors |
|---|
| 314 | ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT /D=$GTK_FOLDER' |
|---|
| 315 | Goto gtk_install_cont |
|---|
| 316 | |
|---|
| 317 | upgrade_gtk: |
|---|
| 318 | StrCpy $GTK_FOLDER $R6 |
|---|
| 319 | IfSilent skip_mb |
|---|
| 320 | MessageBox MB_YESNO $(GTK_UPGRADE_PROMPT) IDNO done |
|---|
| 321 | skip_mb: |
|---|
| 322 | ClearErrors |
|---|
| 323 | ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT' |
|---|
| 324 | Goto gtk_install_cont |
|---|
| 325 | |
|---|
| 326 | gtk_install_cont: |
|---|
| 327 | IfErrors gtk_install_error |
|---|
| 328 | StrCpy $R5 "1" ; marker that says we installed... |
|---|
| 329 | Goto done |
|---|
| 330 | |
|---|
| 331 | gtk_install_error: |
|---|
| 332 | Delete "$TEMP\gtk-runtime.exe" |
|---|
| 333 | IfSilent skip_mb1 |
|---|
| 334 | MessageBox MB_OK $(GTK_INSTALL_ERROR) IDOK |
|---|
| 335 | skip_mb1: |
|---|
| 336 | Quit |
|---|
| 337 | |
|---|
| 338 | have_gtk: |
|---|
| 339 | StrCpy $GTK_FOLDER $R6 |
|---|
| 340 | StrCmp $R1 "NONE" done ; If we have no rights.. can't re-install.. |
|---|
| 341 | ; Even if we have a sufficient version of GTK+, we give user choice to re-install. |
|---|
| 342 | ClearErrors |
|---|
| 343 | ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT' |
|---|
| 344 | IfErrors gtk_install_error |
|---|
| 345 | Goto done |
|---|
| 346 | |
|---|
| 347 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|---|
| 348 | ; end got_install rights |
|---|
| 349 | |
|---|
| 350 | gtk_no_install_rights: |
|---|
| 351 | ; Install GTK+ to Gaim install dir |
|---|
| 352 | StrCpy $GTK_FOLDER $INSTDIR |
|---|
| 353 | ClearErrors |
|---|
| 354 | ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT /D=$GTK_FOLDER' |
|---|
| 355 | IfErrors gtk_install_error |
|---|
| 356 | SetOverwrite on |
|---|
| 357 | ClearErrors |
|---|
| 358 | CopyFiles /FILESONLY "$GTK_FOLDER\bin\*.dll" $GTK_FOLDER |
|---|
| 359 | SetOverwrite off |
|---|
| 360 | IfErrors gtk_install_error |
|---|
| 361 | Delete "$GTK_FOLDER\bin\*.dll" |
|---|
| 362 | Goto done |
|---|
| 363 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|---|
| 364 | ; end gtk_no_install_rights |
|---|
| 365 | |
|---|
| 366 | done: |
|---|
| 367 | Delete "$TEMP\gtk-runtime.exe" |
|---|
| 368 | SectionEnd ; end of GTK+ section |
|---|
| 369 | !endif |
|---|
| 370 | |
|---|
| 371 | ;-------------------------------- |
|---|
| 372 | ;Gaim Install Section |
|---|
| 373 | |
|---|
| 374 | Section $(GAIM_SECTION_TITLE) SecGaim |
|---|
| 375 | SectionIn 1 RO |
|---|
| 376 | |
|---|
| 377 | ; Check install rights.. |
|---|
| 378 | Call CheckUserInstallRights |
|---|
| 379 | Pop $R0 |
|---|
| 380 | |
|---|
| 381 | ; Get GTK+ lib dir if we have it.. |
|---|
| 382 | |
|---|
| 383 | StrCmp $R0 "NONE" gaim_none |
|---|
| 384 | StrCmp $R0 "HKLM" gaim_hklm gaim_hkcu |
|---|
| 385 | |
|---|
| 386 | gaim_hklm: |
|---|
| 387 | ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path" |
|---|
| 388 | WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "" "$INSTDIR\gaim.exe" |
|---|
| 389 | WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R1\bin" |
|---|
| 390 | WriteRegStr HKLM ${GAIM_REG_KEY} "" "$INSTDIR" |
|---|
| 391 | WriteRegStr HKLM ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}" |
|---|
| 392 | WriteRegStr HKLM "${GAIM_UNINSTALL_KEY}" "DisplayName" $(GAIM_UNINSTALL_DESC) |
|---|
| 393 | WriteRegStr HKLM "${GAIM_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GAIM_UNINST_EXE}" |
|---|
| 394 | ; Sets scope of the desktop and Start Menu entries for all users. |
|---|
| 395 | SetShellVarContext "all" |
|---|
| 396 | Goto gaim_install_files |
|---|
| 397 | |
|---|
| 398 | gaim_hkcu: |
|---|
| 399 | ReadRegStr $R1 HKCU ${GTK_REG_KEY} "Path" |
|---|
| 400 | StrCmp $R1 "" 0 gaim_hkcu1 |
|---|
| 401 | ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path" |
|---|
| 402 | gaim_hkcu1: |
|---|
| 403 | WriteRegStr HKCU ${GAIM_REG_KEY} "" "$INSTDIR" |
|---|
| 404 | WriteRegStr HKCU ${GAIM_REG_KEY} "Version" "${GAIM_VERSION}" |
|---|
| 405 | WriteRegStr HKCU "${GAIM_UNINSTALL_KEY}" "DisplayName" $(GAIM_UNINSTALL_DESC) |
|---|
| 406 | WriteRegStr HKCU "${GAIM_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GAIM_UNINST_EXE}" |
|---|
| 407 | Goto gaim_install_files |
|---|
| 408 | |
|---|
| 409 | gaim_none: |
|---|
| 410 | ReadRegStr $R1 HKLM ${GTK_REG_KEY} "Path" |
|---|
| 411 | |
|---|
| 412 | gaim_install_files: |
|---|
| 413 | SetOutPath "$INSTDIR" |
|---|
| 414 | ; Gaim files |
|---|
| 415 | SetOverwrite on |
|---|
| 416 | File /r .\win32-install-dir\*.* |
|---|
| 417 | !ifdef DEBUG |
|---|
| 418 | File "${GAIM_INSTALLER_DEPS}\exchndl.dll" |
|---|
| 419 | !endif |
|---|
| 420 | |
|---|
| 421 | ; Install shfolder.dll if need be.. |
|---|
| 422 | SearchPath $R4 "shfolder.dll" |
|---|
| 423 | StrCmp $R4 "" 0 got_shfolder |
|---|
| 424 | SetOutPath "$SYSDIR" |
|---|
| 425 | File "${GAIM_INSTALLER_DEPS}\shfolder.dll" |
|---|
| 426 | SetOutPath "$INSTDIR" |
|---|
| 427 | got_shfolder: |
|---|
| 428 | |
|---|
| 429 | ; Check if Perl is installed, If not remove perl plugin |
|---|
| 430 | ReadRegStr $R2 HKLM ${PERL_REG_KEY} "" |
|---|
| 431 | StrCmp $R2 "" 0 perl_exists |
|---|
| 432 | ReadRegStr $R2 HKCU ${PERL_REG_KEY} "" |
|---|
| 433 | StrCmp $R2 "" perl_remove perl_exists |
|---|
| 434 | |
|---|
| 435 | perl_remove: |
|---|
| 436 | Delete "$INSTDIR\plugins\perl.dll" |
|---|
| 437 | RMDir /r "$INSTDIR\perlmod" |
|---|
| 438 | Goto perl_done |
|---|
| 439 | |
|---|
| 440 | perl_exists: |
|---|
| 441 | IfFileExists "$R2\bin\${PERL_DLL}" 0 perl_remove |
|---|
| 442 | StrCmp $R0 "HKLM" 0 perl_done |
|---|
| 443 | ReadRegStr $R3 HKLM "${HKLM_APP_PATHS_KEY}" "Path" |
|---|
| 444 | WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R3;$R2\bin" |
|---|
| 445 | |
|---|
| 446 | perl_done: |
|---|
| 447 | |
|---|
| 448 | ; If this is under NT4, delete the SILC support stuff |
|---|
| 449 | ; there is a bug that will prevent any account from connecting |
|---|
| 450 | ; See https://lists.silcnet.org/pipermail/silc-devel/2005-January/001588.html |
|---|
| 451 | Call GetWindowsVersion |
|---|
| 452 | Pop $R2 |
|---|
| 453 | StrCmp $R2 "NT 4.0" 0 nt4_done |
|---|
| 454 | Delete "$INSTDIR\plugins\libsilc.dll" |
|---|
| 455 | Delete "$INSTDIR\silcclient.dll" |
|---|
| 456 | Delete "$INSTDIR\silc.dll" |
|---|
| 457 | |
|---|
| 458 | nt4_done: |
|---|
| 459 | |
|---|
| 460 | SetOutPath "$INSTDIR" |
|---|
| 461 | |
|---|
| 462 | ; If we don't have install rights.. we're done |
|---|
| 463 | StrCmp $R0 "NONE" done |
|---|
| 464 | SetOverwrite off |
|---|
| 465 | |
|---|
| 466 | ; Write out installer language |
|---|
| 467 | WriteRegStr HKCU "${GAIM_REG_KEY}" "${GAIM_REG_LANG}" "$LANGUAGE" |
|---|
| 468 | |
|---|
| 469 | ; write out uninstaller |
|---|
| 470 | SetOverwrite on |
|---|
| 471 | WriteUninstaller "$INSTDIR\${GAIM_UNINST_EXE}" |
|---|
| 472 | SetOverwrite off |
|---|
| 473 | |
|---|
| 474 | ; If we previously had gaim setup to run on startup, make it do so again |
|---|
| 475 | StrCmp $STARTUP_RUN_KEY "HKCU" +1 +2 |
|---|
| 476 | WriteRegStr HKCU "${GAIM_STARTUP_RUN_KEY}" "Gaim" "$INSTDIR\gaim.exe" |
|---|
| 477 | StrCmp $STARTUP_RUN_KEY "HKLM" +1 +2 |
|---|
| 478 | WriteRegStr HKLM "${GAIM_STARTUP_RUN_KEY}" "Gaim" "$INSTDIR\gaim.exe" |
|---|
| 479 | |
|---|
| 480 | done: |
|---|
| 481 | SectionEnd ; end of default Gaim section |
|---|
| 482 | |
|---|
| 483 | ;-------------------------------- |
|---|
| 484 | ;Shortcuts |
|---|
| 485 | |
|---|
| 486 | SubSection /e $(GAIM_SHORTCUTS_SECTION_TITLE) SecShortcuts |
|---|
| 487 | Section /o $(GAIM_DESKTOP_SHORTCUT_SECTION_TITLE) SecDesktopShortcut |
|---|
| 488 | SetOverwrite on |
|---|
| 489 | CreateShortCut "$DESKTOP\Gaim.lnk" "$INSTDIR\gaim.exe" |
|---|
| 490 | SetOverwrite off |
|---|
| 491 | SectionEnd |
|---|
| 492 | Section $(GAIM_STARTMENU_SHORTCUT_SECTION_TITLE) SecStartMenuShortcut |
|---|
| 493 | SetOverwrite on |
|---|
| 494 | CreateDirectory "$SMPROGRAMS\Gaim" |
|---|
| 495 | CreateShortCut "$SMPROGRAMS\Gaim\Gaim.lnk" "$INSTDIR\gaim.exe" |
|---|
| 496 | SetOverwrite off |
|---|
| 497 | SectionEnd |
|---|
| 498 | SubSectionEnd |
|---|
| 499 | |
|---|
| 500 | ;-------------------------------- |
|---|
| 501 | ;GTK+ Themes |
|---|
| 502 | |
|---|
| 503 | SubSection /e $(GTK_THEMES_SECTION_TITLE) SecGtkThemes |
|---|
| 504 | Section /o $(GTK_NOTHEME_SECTION_TITLE) SecGtkNone |
|---|
| 505 | Call CanWeInstallATheme |
|---|
| 506 | Pop $R0 |
|---|
| 507 | StrCmp $R0 "" done |
|---|
| 508 | SetOverwrite on |
|---|
| 509 | Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old |
|---|
| 510 | CopyFiles $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.plain $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc |
|---|
| 511 | SetOverwrite off |
|---|
| 512 | done: |
|---|
| 513 | SectionEnd |
|---|
| 514 | |
|---|
| 515 | Section $(GTK_WIMP_SECTION_TITLE) SecGtkWimp |
|---|
| 516 | Call CanWeInstallATheme |
|---|
| 517 | Pop $R0 |
|---|
| 518 | StrCmp $R0 "" done |
|---|
| 519 | SetOverwrite on |
|---|
| 520 | Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old |
|---|
| 521 | SetOutPath $R0\${GTK_DEFAULT_THEME_ENGINE_DIR} |
|---|
| 522 | File ${GTK_THEME_DIR}\engines\libwimp.dll |
|---|
| 523 | SetOutPath $R0\${GTK_DEFAULT_THEME_GTKRC_DIR} |
|---|
| 524 | File ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp |
|---|
| 525 | File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.gtkwimp |
|---|
| 526 | SetOverwrite off |
|---|
| 527 | done: |
|---|
| 528 | SectionEnd |
|---|
| 529 | |
|---|
| 530 | Section /o $(GTK_BLUECURVE_SECTION_TITLE) SecGtkBluecurve |
|---|
| 531 | Call CanWeInstallATheme |
|---|
| 532 | Pop $R0 |
|---|
| 533 | StrCmp $R0 "" done |
|---|
| 534 | SetOverwrite on |
|---|
| 535 | Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old |
|---|
| 536 | SetOutPath $R0\${GTK_DEFAULT_THEME_ENGINE_DIR} |
|---|
| 537 | File ${GTK_THEME_DIR}\engines\libbluecurve.dll |
|---|
| 538 | SetOutPath $R0\${GTK_DEFAULT_THEME_GTKRC_DIR} |
|---|
| 539 | File ${GTK_THEME_DIR}\themes\gtkrc.bluecurve |
|---|
| 540 | File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.bluecurve |
|---|
| 541 | SetOverwrite off |
|---|
| 542 | done: |
|---|
| 543 | SectionEnd |
|---|
| 544 | |
|---|
| 545 | Section /o $(GTK_LIGHTHOUSEBLUE_SECTION_TITLE) SecGtkLighthouseblue |
|---|
| 546 | Call CanWeInstallATheme |
|---|
| 547 | Pop $R0 |
|---|
| 548 | StrCmp $R0 "" done |
|---|
| 549 | SetOverwrite on |
|---|
| 550 | Rename $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc $R0\${GTK_DEFAULT_THEME_GTKRC_DIR}\gtkrc.old |
|---|
| 551 | SetOutPath $R0\${GTK_DEFAULT_THEME_ENGINE_DIR} |
|---|
| 552 | File ${GTK_THEME_DIR}\engines\liblighthouseblue.dll |
|---|
| 553 | SetOutPath $R0\${GTK_DEFAULT_THEME_GTKRC_DIR} |
|---|
| 554 | File ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue |
|---|
| 555 | File /oname=gtkrc ${GTK_THEME_DIR}\themes\gtkrc.lighthouseblue |
|---|
| 556 | SetOverwrite off |
|---|
| 557 | done: |
|---|
| 558 | SectionEnd |
|---|
| 559 | SubSectionEnd |
|---|
| 560 | |
|---|
| 561 | ;-------------------------------- |
|---|
| 562 | ;Uninstaller Section |
|---|
| 563 | |
|---|
| 564 | |
|---|
| 565 | Section Uninstall |
|---|
| 566 | Call un.CheckUserInstallRights |
|---|
| 567 | Pop $R0 |
|---|
| 568 | StrCmp $R0 "NONE" no_rights |
|---|
| 569 | StrCmp $R0 "HKCU" try_hkcu try_hklm |
|---|
| 570 | |
|---|
| 571 | try_hkcu: |
|---|
| 572 | ReadRegStr $R0 HKCU ${GAIM_REG_KEY} "" |
|---|
| 573 | StrCmp $R0 $INSTDIR 0 cant_uninstall |
|---|
| 574 | ; HKCU install path matches our INSTDIR.. so uninstall |
|---|
| 575 | DeleteRegKey HKCU ${GAIM_REG_KEY} |
|---|
| 576 | DeleteRegKey HKCU "${GAIM_UNINSTALL_KEY}" |
|---|
| 577 | Goto cont_uninstall |
|---|
| 578 | |
|---|
| 579 | try_hklm: |
|---|
| 580 | ReadRegStr $R0 HKLM ${GAIM_REG_KEY} "" |
|---|
| 581 | StrCmp $R0 $INSTDIR 0 try_hkcu |
|---|
| 582 | ; HKLM install path matches our INSTDIR.. so uninstall |
|---|
| 583 | DeleteRegKey HKLM ${GAIM_REG_KEY} |
|---|
| 584 | DeleteRegKey HKLM "${GAIM_UNINSTALL_KEY}" |
|---|
| 585 | DeleteRegKey HKLM "${HKLM_APP_PATHS_KEY}" |
|---|
| 586 | ; Sets start menu and desktop scope to all users.. |
|---|
| 587 | SetShellVarContext "all" |
|---|
| 588 | |
|---|
| 589 | cont_uninstall: |
|---|
| 590 | ; The WinPrefs plugin may have left this behind.. |
|---|
| 591 | DeleteRegValue HKCU "${GAIM_STARTUP_RUN_KEY}" "Gaim" |
|---|
| 592 | DeleteRegValue HKLM "${GAIM_STARTUP_RUN_KEY}" "Gaim" |
|---|
| 593 | ; Remove Language preference info |
|---|
| 594 | DeleteRegKey HKCU ${GAIM_REG_KEY} ;${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY} |
|---|
| 595 | |
|---|
| 596 | RMDir /r "$INSTDIR\locale" |
|---|
| 597 | RMDir /r "$INSTDIR\pixmaps" |
|---|
| 598 | RMDir /r "$INSTDIR\perlmod" |
|---|
| 599 | Delete "$INSTDIR\plugins\autorecon.dll" |
|---|
| 600 | Delete "$INSTDIR\plugins\docklet.dll" |
|---|
| 601 | Delete "$INSTDIR\plugins\extplacement.dll" |
|---|
| 602 | Delete "$INSTDIR\plugins\history.dll" |
|---|
| 603 | Delete "$INSTDIR\plugins\iconaway.dll" |
|---|
| 604 | Delete "$INSTDIR\plugins\idle.dll" |
|---|
| 605 | Delete "$INSTDIR\plugins\libgg.dll" |
|---|
| 606 | Delete "$INSTDIR\plugins\libirc.dll" |
|---|
| 607 | Delete "$INSTDIR\plugins\libjabber.dll" |
|---|
| 608 | Delete "$INSTDIR\plugins\libmsn.dll" |
|---|
| 609 | Delete "$INSTDIR\plugins\libnapster.dll" |
|---|
| 610 | Delete "$INSTDIR\plugins\libnovell.dll" |
|---|
| 611 | Delete "$INSTDIR\plugins\liboscar.dll" |
|---|
| 612 | Delete "$INSTDIR\plugins\libtoc.dll" |
|---|
| 613 | Delete "$INSTDIR\plugins\libyahoo.dll" |
|---|
| 614 | Delete "$INSTDIR\plugins\libsilc.dll" |
|---|
| 615 | Delete "$INSTDIR\plugins\perl.dll" |
|---|
| 616 | Delete "$INSTDIR\plugins\relnot.dll" |
|---|
| 617 | Delete "$INSTDIR\plugins\spellchk.dll" |
|---|
| 618 | Delete "$INSTDIR\plugins\ssl-nss.dll" |
|---|
| 619 | Delete "$INSTDIR\plugins\ssl.dll" |
|---|
| 620 | Delete "$INSTDIR\plugins\statenotify.dll" |
|---|
| 621 | Delete "$INSTDIR\plugins\tcl.dll" |
|---|
| 622 | Delete "$INSTDIR\plugins\ticker.dll" |
|---|
| 623 | Delete "$INSTDIR\plugins\timestamp.dll" |
|---|
| 624 | Delete "$INSTDIR\plugins\win2ktrans.dll" |
|---|
| 625 | Delete "$INSTDIR\plugins\winprefs.dll" |
|---|
| 626 | RMDir "$INSTDIR\plugins" |
|---|
| 627 | Delete "$INSTDIR\sounds\gaim\arrive.wav" |
|---|
| 628 | Delete "$INSTDIR\sounds\gaim\leave.wav" |
|---|
| 629 | Delete "$INSTDIR\sounds\gaim\receive.wav" |
|---|
| 630 | Delete "$INSTDIR\sounds\gaim\redalert.wav" |
|---|
| 631 | Delete "$INSTDIR\sounds\gaim\send.wav" |
|---|
| 632 | RMDir "$INSTDIR\sounds\gaim" |
|---|
| 633 | RMDir "$INSTDIR\sounds" |
|---|
| 634 | Delete "$INSTDIR\gaim.dll" |
|---|
| 635 | Delete "$INSTDIR\gaim.exe" |
|---|
| 636 | Delete "$INSTDIR\idletrack.dll" |
|---|
| 637 | Delete "$INSTDIR\libgtkspell.dll" |
|---|
| 638 | Delete "$INSTDIR\nspr4.dll" |
|---|
| 639 | Delete "$INSTDIR\nss3.dll" |
|---|
| 640 | Delete "$INSTDIR\nssckbi.dll" |
|---|
| 641 | Delete "$INSTDIR\plc4.dll" |
|---|
| 642 | Delete "$INSTDIR\plds4.dll" |
|---|
| 643 | Delete "$INSTDIR\silc.dll" |
|---|
| 644 | Delete "$INSTDIR\silcclient.dll" |
|---|
| 645 | Delete "$INSTDIR\softokn3.dll" |
|---|
| 646 | Delete "$INSTDIR\ssl3.dll" |
|---|
| 647 | Delete "$INSTDIR\${GAIM_UNINST_EXE}" |
|---|
| 648 | !ifdef DEBUG |
|---|
| 649 | Delete "$INSTDIR\exchndl.dll" |
|---|
| 650 | !endif |
|---|
| 651 | |
|---|
| 652 | ;Try to remove Gaim install dir .. if empty |
|---|
| 653 | RMDir "$INSTDIR" |
|---|
| 654 | |
|---|
| 655 | ; Shortcuts.. |
|---|
| 656 | RMDir /r "$SMPROGRAMS\Gaim" |
|---|
| 657 | Delete "$DESKTOP\Gaim.lnk" |
|---|
| 658 | |
|---|
| 659 | Goto done |
|---|
| 660 | |
|---|
| 661 | cant_uninstall: |
|---|
| 662 | IfSilent skip_mb |
|---|
| 663 | MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_1) IDOK |
|---|
| 664 | skip_mb: |
|---|
| 665 | Quit |
|---|
| 666 | |
|---|
| 667 | no_rights: |
|---|
| 668 | IfSilent skip_mb1 |
|---|
| 669 | MessageBox MB_OK $(un.GAIM_UNINSTALL_ERROR_2) IDOK |
|---|
| 670 | skip_mb1: |
|---|
| 671 | Quit |
|---|
| 672 | |
|---|
| 673 | done: |
|---|
| 674 | SectionEnd ; end of uninstall section |
|---|
| 675 | |
|---|
| 676 | ;-------------------------------- |
|---|
| 677 | ;Descriptions |
|---|
| 678 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
|---|
| 679 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGaim} \ |
|---|
| 680 | $(GAIM_SECTION_DESCRIPTION) |
|---|
| 681 | !ifdef WITH_GTK |
|---|
| 682 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGtk} \ |
|---|
| 683 | $(GTK_SECTION_DESCRIPTION) |
|---|
| 684 | !endif |
|---|
| 685 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkThemes} \ |
|---|
| 686 | $(GTK_THEMES_SECTION_DESCRIPTION) |
|---|
| 687 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkNone} \ |
|---|
| 688 | $(GTK_NO_THEME_DESC) |
|---|
| 689 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkWimp} \ |
|---|
| 690 | $(GTK_WIMP_THEME_DESC) |
|---|
| 691 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkBluecurve} \ |
|---|
| 692 | $(GTK_BLUECURVE_THEME_DESC) |
|---|
| 693 | !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkLighthouseblue} \ |
|---|
| 694 | $(GTK_LIGHTHOUSEBLUE_THEME_DESC) |
|---|
| 695 | |
|---|
| 696 | |
|---|
| 697 | !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} \ |
|---|
| 698 | $(GAIM_SHORTCUTS_SECTION_DESCRIPTION) |
|---|
| 699 | !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} \ |
|---|
| 700 | $(GAIM_DESKTOP_SHORTCUT_DESC) |
|---|
| 701 | !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} \ |
|---|
| 702 | $(GAIM_STARTMENU_SHORTCUT_DESC) |
|---|
| 703 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
|---|
| 704 | |
|---|
| 705 | ;-------------------------------- |
|---|
| 706 | ;Functions |
|---|
| 707 | |
|---|
| 708 | ; |
|---|
| 709 | ; Usage: |
|---|
| 710 | ; |
|---|
| 711 | ; Call CanWeInstallATheme |
|---|
| 712 | ; Pop $R0 |
|---|
| 713 | ; |
|---|
| 714 | ; Return: |
|---|
| 715 | ; "" - If no |
|---|
| 716 | ; "root path of GTK+ installation" - if yes |
|---|
| 717 | ; |
|---|
| 718 | Function CanWeInstallATheme |
|---|
| 719 | Push $1 |
|---|
| 720 | Push $0 |
|---|
| 721 | |
|---|
| 722 | ; Set default.. no rights |
|---|
| 723 | StrCpy $1 "" |
|---|
| 724 | |
|---|
| 725 | Call CheckUserInstallRights |
|---|
| 726 | Pop $0 |
|---|
| 727 | |
|---|
| 728 | ; If no rights check if gtk was installed to gaim dir.. |
|---|
| 729 | StrCmp $0 "NONE" 0 themes_cont |
|---|
| 730 | StrCmp $GTK_FOLDER $INSTDIR 0 no_rights |
|---|
| 731 | StrCpy $1 $INSTDIR |
|---|
| 732 | Goto done |
|---|
| 733 | themes_cont: |
|---|
| 734 | |
|---|
| 735 | StrCmp $0 "HKCU" hkcu hklm |
|---|
| 736 | |
|---|
| 737 | hkcu: |
|---|
| 738 | ReadRegStr $1 HKCU ${GTK_REG_KEY} "Path" |
|---|
| 739 | StrCmp $1 "" no_rights done |
|---|
| 740 | |
|---|
| 741 | hklm: |
|---|
| 742 | ReadRegStr $1 HKLM ${GTK_REG_KEY} "Path" |
|---|
| 743 | Goto done |
|---|
| 744 | |
|---|
| 745 | no_rights: |
|---|
| 746 | IfSilent skip_mb |
|---|
| 747 | MessageBox MB_OK $(GTK_NO_THEME_INSTALL_RIGHTS) IDOK |
|---|
| 748 | skip_mb: |
|---|
| 749 | StrCpy $1 "" |
|---|
| 750 | |
|---|
| 751 | done: |
|---|
| 752 | Pop $0 |
|---|
| 753 | Exch $1 |
|---|
| 754 | FunctionEnd |
|---|
| 755 | |
|---|
| 756 | |
|---|
| 757 | Function CheckUserInstallRights |
|---|
| 758 | ClearErrors |
|---|
| 759 | UserInfo::GetName |
|---|
| 760 | IfErrors Win9x |
|---|
| 761 | Pop $0 |
|---|
| 762 | UserInfo::GetAccountType |
|---|
| 763 | Pop $1 |
|---|
| 764 | |
|---|
| 765 | StrCmp $1 "Admin" 0 +3 |
|---|
| 766 | StrCpy $1 "HKLM" |
|---|
| 767 | Goto done |
|---|
| 768 | StrCmp $1 "Power" 0 +3 |
|---|
| 769 | StrCpy $1 "HKLM" |
|---|
| 770 | Goto done |
|---|
| 771 | StrCmp $1 "User" 0 +3 |
|---|
| 772 | StrCpy $1 "HKCU" |
|---|
| 773 | Goto done |
|---|
| 774 | StrCmp $1 "Guest" 0 +3 |
|---|
| 775 | StrCpy $1 "NONE" |
|---|
| 776 | Goto done |
|---|
| 777 | ; Unknown error |
|---|
| 778 | StrCpy $1 "NONE" |
|---|
| 779 | Goto done |
|---|
| 780 | |
|---|
| 781 | Win9x: |
|---|
| 782 | StrCpy $1 "HKLM" |
|---|
| 783 | |
|---|
| 784 | done: |
|---|
| 785 | Push $1 |
|---|
| 786 | FunctionEnd |
|---|
| 787 | |
|---|
| 788 | Function un.CheckUserInstallRights |
|---|
| 789 | ClearErrors |
|---|
| 790 | UserInfo::GetName |
|---|
| 791 | IfErrors Win9x |
|---|
| 792 | Pop $0 |
|---|
| 793 | UserInfo::GetAccountType |
|---|
| 794 | Pop $1 |
|---|
| 795 | |
|---|
| 796 | StrCmp $1 "Admin" 0 +3 |
|---|
| 797 | StrCpy $1 "HKLM" |
|---|
| 798 | Goto done |
|---|
| 799 | StrCmp $1 "Power" 0 +3 |
|---|
| 800 | StrCpy $1 "HKLM" |
|---|
| 801 | Goto done |
|---|
| 802 | StrCmp $1 "User" 0 +3 |
|---|
| 803 | StrCpy $1 "HKCU" |
|---|
| 804 | Goto done |
|---|
| 805 | StrCmp $1 "Guest" 0 +3 |
|---|
| 806 | StrCpy $1 "NONE" |
|---|
| 807 | Goto done |
|---|
| 808 | ; Unknown error |
|---|
| 809 | StrCpy $1 "NONE" |
|---|
| 810 | Goto done |
|---|
| 811 | |
|---|
| 812 | Win9x: |
|---|
| 813 | StrCpy $1 "HKLM" |
|---|
| 814 | |
|---|
| 815 | done: |
|---|
| 816 | Push $1 |
|---|
| 817 | FunctionEnd |
|---|
| 818 | |
|---|
| 819 | ; |
|---|
| 820 | ; Usage: |
|---|
| 821 | ; Push $0 ; Path string |
|---|
| 822 | ; Call VerifyDir |
|---|
| 823 | ; Pop $0 ; 0 - Bad path 1 - Good path |
|---|
| 824 | ; |
|---|
| 825 | Function VerifyDir |
|---|
| 826 | Pop $0 |
|---|
| 827 | Loop: |
|---|
| 828 | IfFileExists $0 dir_exists |
|---|
| 829 | StrCpy $1 $0 ; save last |
|---|
| 830 | Push $0 |
|---|
| 831 | Call GetParent |
|---|
| 832 | Pop $0 |
|---|
| 833 | StrLen $2 $0 |
|---|
| 834 | ; IfFileExists "C:" on xp returns true and on win2k returns false |
|---|
| 835 | ; So we're done in such a case.. |
|---|
| 836 | IntCmp $2 2 loop_done |
|---|
| 837 | ; GetParent of "C:" returns "" |
|---|
| 838 | IntCmp $2 0 loop_done |
|---|
| 839 | Goto Loop |
|---|
| 840 | |
|---|
| 841 | loop_done: |
|---|
| 842 | StrCpy $1 "$0\GaImFooB" |
|---|
| 843 | ; Check if we can create dir on this drive.. |
|---|
| 844 | ClearErrors |
|---|
| 845 | CreateDirectory $1 |
|---|
| 846 | IfErrors DirBad DirGood |
|---|
| 847 | |
|---|
| 848 | dir_exists: |
|---|
| 849 | ClearErrors |
|---|
| 850 | FileOpen $1 "$0\gaimfoo.bar" w |
|---|
| 851 | IfErrors PathBad PathGood |
|---|
| 852 | |
|---|
| 853 | DirGood: |
|---|
| 854 | RMDir $1 |
|---|
| 855 | Goto PathGood1 |
|---|
| 856 | |
|---|
| 857 | DirBad: |
|---|
| 858 | RMDir $1 |
|---|
| 859 | Goto PathBad1 |
|---|
| 860 | |
|---|
| 861 | PathBad: |
|---|
| 862 | FileClose $1 |
|---|
| 863 | Delete "$0\gaimfoo.bar" |
|---|
| 864 | PathBad1: |
|---|
| 865 | StrCpy $0 "0" |
|---|
| 866 | Push $0 |
|---|
| 867 | Return |
|---|
| 868 | |
|---|
| 869 | PathGood: |
|---|
| 870 | FileClose $1 |
|---|
| 871 | Delete "$0\gaimfoo.bar" |
|---|
| 872 | PathGood1: |
|---|
| 873 | StrCpy $0 "1" |
|---|
| 874 | Push $0 |
|---|
| 875 | FunctionEnd |
|---|
| 876 | |
|---|
| 877 | Function .onVerifyInstDir |
|---|
| 878 | Push $INSTDIR |
|---|
| 879 | Call VerifyDir |
|---|
| 880 | Pop $0 |
|---|
| 881 | StrCmp $0 "0" 0 dir_good |
|---|
| 882 | Abort |
|---|
| 883 | dir_good: |
|---|
| 884 | FunctionEnd |
|---|
| 885 | |
|---|
| 886 | ; GetParent |
|---|
| 887 | ; input, top of stack (e.g. C:\Program Files\Poop) |
|---|
| 888 | ; output, top of stack (replaces, with e.g. C:\Program Files) |
|---|
| 889 | ; modifies no other variables. |
|---|
| 890 | ; |
|---|
| 891 | ; Usage: |
|---|
| 892 | ; Push "C:\Program Files\Directory\Whatever" |
|---|
| 893 | ; Call GetParent |
|---|
| 894 | ; Pop $R0 |
|---|
| 895 | ; ; at this point $R0 will equal "C:\Program Files\Directory" |
|---|
| 896 | Function GetParent |
|---|
| 897 | Exch $0 ; old $0 is on top of stack |
|---|
| 898 | Push $1 |
|---|
| 899 | Push $2 |
|---|
| 900 | StrCpy $1 -1 |
|---|
| 901 | loop: |
|---|
| 902 | StrCpy $2 $0 1 $1 |
|---|
| 903 | StrCmp $2 "" exit |
|---|
| 904 | StrCmp $2 "\" exit |
|---|
| 905 | IntOp $1 $1 - 1 |
|---|
| 906 | Goto loop |
|---|
| 907 | exit: |
|---|
| 908 | StrCpy $0 $0 $1 |
|---|
| 909 | Pop $2 |
|---|
| 910 | Pop $1 |
|---|
| 911 | Exch $0 ; put $0 on top of stack, restore $0 to original value |
|---|
| 912 | FunctionEnd |
|---|
| 913 | |
|---|
| 914 | |
|---|
| 915 | ; CheckGtkVersion |
|---|
| 916 | ; inputs: Push 2 GTK+ version strings to check. The major value needs to |
|---|
| 917 | ; be equal and the minor value needs to be greater or equal. |
|---|
| 918 | ; |
|---|
| 919 | ; Usage: |
|---|
| 920 | ; Push "2.1.0" ; Refrence version |
|---|
| 921 | ; Push "2.2.1" ; Version to check |
|---|
| 922 | ; Call CheckGtkVersion |
|---|
| 923 | ; Pop $R0 |
|---|
| 924 | ; $R0 will now equal "1", because 2.2 is greater than 2.1 |
|---|
| 925 | ; |
|---|
| 926 | Function CheckGtkVersion |
|---|
| 927 | ; Version we want to check |
|---|
| 928 | Pop $6 |
|---|
| 929 | ; Reference version |
|---|
| 930 | Pop $8 |
|---|
| 931 | |
|---|
| 932 | ; Check that the string to check is at least 5 chars long (i.e. x.x.x) |
|---|
| 933 | StrLen $7 $6 |
|---|
| 934 | IntCmp $7 5 0 bad_version |
|---|
| 935 | |
|---|
| 936 | ; Major version check |
|---|
| 937 | StrCpy $7 $6 1 |
|---|
| 938 | StrCpy $9 $8 1 |
|---|
| 939 | IntCmp $7 $9 check_minor bad_version bad_version |
|---|
| 940 | |
|---|
| 941 | check_minor: |
|---|
| 942 | StrCpy $7 $6 1 2 |
|---|
| 943 | StrCpy $9 $8 1 2 |
|---|
| 944 | IntCmp $7 $9 good_version bad_version good_version |
|---|
| 945 | |
|---|
| 946 | bad_version: |
|---|
| 947 | StrCpy $6 "0" |
|---|
| 948 | Push $6 |
|---|
| 949 | Goto done |
|---|
| 950 | |
|---|
| 951 | good_version: |
|---|
| 952 | StrCpy $6 "1" |
|---|
| 953 | Push $6 |
|---|
| 954 | done: |
|---|
| 955 | FunctionEnd |
|---|
| 956 | |
|---|
| 957 | ; |
|---|
| 958 | ; Usage: |
|---|
| 959 | ; Call DoWeNeedGtk |
|---|
| 960 | ; First Pop: |
|---|
| 961 | ; 0 - We have the correct version |
|---|
| 962 | ; Second Pop: Key where Version was found |
|---|
| 963 | ; 1 - We have an old version that needs to be upgraded |
|---|
| 964 | ; Second Pop: HKLM or HKCU depending on where GTK was found. |
|---|
| 965 | ; 2 - We don't have Gtk+ at all |
|---|
| 966 | ; Second Pop: "NONE, HKLM or HKCU" depending on our rights.. |
|---|
| 967 | ; |
|---|
| 968 | Function DoWeNeedGtk |
|---|
| 969 | ; Logic should be: |
|---|
| 970 | ; - Check what user rights we have (HKLM or HKCU) |
|---|
| 971 | ; - If HKLM rights.. |
|---|
| 972 | ; - Only check HKLM key for GTK+ |
|---|
| 973 | ; - If installed to HKLM, check it and return. |
|---|
| 974 | ; - If HKCU rights.. |
|---|
| 975 | ; - First check HKCU key for GTK+ |
|---|
| 976 | ; - if good or bad exists stop and ret. |
|---|
| 977 | ; - If no hkcu gtk+ install, check HKLM |
|---|
| 978 | ; - If HKLM ver exists but old, return as if no ver exits. |
|---|
| 979 | ; - If no rights |
|---|
| 980 | ; - Check HKLM |
|---|
| 981 | |
|---|
| 982 | Call CheckUserInstallRights |
|---|
| 983 | Pop $3 |
|---|
| 984 | StrCmp $3 "HKLM" check_hklm |
|---|
| 985 | StrCmp $3 "HKCU" check_hkcu check_hklm |
|---|
| 986 | check_hkcu: |
|---|
| 987 | ReadRegStr $0 HKCU ${GTK_REG_KEY} "Version" |
|---|
| 988 | StrCpy $5 "HKCU" |
|---|
| 989 | StrCmp $0 "" check_hklm have_gtk |
|---|
| 990 | |
|---|
| 991 | check_hklm: |
|---|
| 992 | ReadRegStr $0 HKLM ${GTK_REG_KEY} "Version" |
|---|
| 993 | StrCpy $5 "HKLM" |
|---|
| 994 | StrCmp $0 "" no_gtk have_gtk |
|---|
| 995 | |
|---|
| 996 | |
|---|
| 997 | have_gtk: |
|---|
| 998 | ; GTK+ is already installed.. check version. |
|---|
| 999 | StrCpy $1 ${GTK_VERSION} ; Minimum GTK+ version needed |
|---|
| 1000 | Push $1 |
|---|
| 1001 | Push $0 |
|---|
| 1002 | Call CheckGtkVersion |
|---|
| 1003 | Pop $2 |
|---|
| 1004 | StrCmp $2 "1" good_version bad_version |
|---|
| 1005 | bad_version: |
|---|
| 1006 | ; Bad version. If hklm ver and we have hkcu or no rights.. return no gtk |
|---|
| 1007 | StrCmp $3 "NONE" no_gtk ; if no rights.. can't upgrade |
|---|
| 1008 | StrCmp $3 "HKCU" 0 upgrade_gtk ; if HKLM can upgrade.. |
|---|
| 1009 | StrCmp $5 "HKLM" no_gtk upgrade_gtk ; have hkcu rights.. if found hklm ver can't upgrade.. |
|---|
| 1010 | |
|---|
| 1011 | upgrade_gtk: |
|---|
| 1012 | StrCpy $2 "1" |
|---|
| 1013 | Push $5 |
|---|
| 1014 | Push $2 |
|---|
| 1015 | Goto done |
|---|
| 1016 | |
|---|
| 1017 | good_version: |
|---|
| 1018 | StrCmp $5 "HKLM" have_hklm_gtk have_hkcu_gtk |
|---|
| 1019 | have_hkcu_gtk: |
|---|
| 1020 | ; Have HKCU version |
|---|
| 1021 | ReadRegStr $4 HKCU ${GTK_REG_KEY} "Path" |
|---|
| 1022 | Goto good_version_cont |
|---|
| 1023 | |
|---|
| 1024 | have_hklm_gtk: |
|---|
| 1025 | ReadRegStr $4 HKLM ${GTK_REG_KEY} "Path" |
|---|
| 1026 | Goto good_version_cont |
|---|
| 1027 | |
|---|
| 1028 | good_version_cont: |
|---|
| 1029 | StrCpy $2 "0" |
|---|
| 1030 | Push $4 ; The path to existing GTK+ |
|---|
| 1031 | Push $2 |
|---|
| 1032 | Goto done |
|---|
| 1033 | |
|---|
| 1034 | no_gtk: |
|---|
| 1035 | StrCpy $2 "2" |
|---|
| 1036 | Push $3 ; our rights |
|---|
| 1037 | Push $2 |
|---|
| 1038 | Goto done |
|---|
| 1039 | |
|---|
| 1040 | done: |
|---|
| 1041 | FunctionEnd |
|---|
| 1042 | |
|---|
| 1043 | Function RunCheck |
|---|
| 1044 | System::Call 'kernel32::OpenMutex(i 2031617, b 0, t "gaim_is_running") i .R0' |
|---|
| 1045 | IntCmp $R0 0 done |
|---|
| 1046 | MessageBox MB_OK|MB_ICONEXCLAMATION $(GAIM_IS_RUNNING) IDOK |
|---|
| 1047 | Abort |
|---|
| 1048 | done: |
|---|
| 1049 | FunctionEnd |
|---|
| 1050 | |
|---|
| 1051 | Function un.RunCheck |
|---|
| 1052 | System::Call 'kernel32::OpenMutex(i 2031617, b 0, t "gaim_is_running") i .R0' |
|---|
| 1053 | IntCmp $R0 0 done |
|---|
| 1054 | MessageBox MB_OK|MB_ICONEXCLAMATION $(GAIM_IS_RUNNING) IDOK |
|---|
| 1055 | Abort |
|---|
| 1056 | done: |
|---|
| 1057 | FunctionEnd |
|---|
| 1058 | |
|---|
| 1059 | Function .onInit |
|---|
| 1060 | System::Call 'kernel32::CreateMutexA(i 0, i 0, t "gaim_installer_running") i .r1 ?e' |
|---|
| 1061 | Pop $R0 |
|---|
| 1062 | StrCmp $R0 0 +3 |
|---|
| 1063 | MessageBox MB_OK|MB_ICONEXCLAMATION $(INSTALLER_IS_RUNNING) |
|---|
| 1064 | Abort |
|---|
| 1065 | Call RunCheck |
|---|
| 1066 | StrCpy $name "Gaim ${GAIM_VERSION}" |
|---|
| 1067 | StrCpy $GTK_THEME_SEL ${SecGtkWimp} |
|---|
| 1068 | StrCpy $ISSILENT "/NOUI" |
|---|
| 1069 | |
|---|
| 1070 | ; GTK installer has two silent states.. one with Message boxes, one without |
|---|
| 1071 | ; If gaim installer was run silently, we want to supress gtk installer msg boxes. |
|---|
| 1072 | IfSilent 0 set_gtk_normal |
|---|
| 1073 | StrCpy $ISSILENT "/S" |
|---|
| 1074 | set_gtk_normal: |
|---|
| 1075 | |
|---|
| 1076 | Call ParseParameters |
|---|
| 1077 | |
|---|
| 1078 | ; Select Language |
|---|
| 1079 | IntCmp $LANG_IS_SET 1 skip_lang |
|---|
| 1080 | ; Display Language selection dialog |
|---|
| 1081 | !insertmacro MUI_LANGDLL_DISPLAY |
|---|
| 1082 | skip_lang: |
|---|
| 1083 | |
|---|
| 1084 | ; If install path was set on the command, use it. |
|---|
| 1085 | StrCmp $INSTDIR "" 0 instdir_done |
|---|
| 1086 | |
|---|
| 1087 | ; If gaim is currently intalled, we should default to where it is currently installed |
|---|
| 1088 | ClearErrors |
|---|
| 1089 | ReadRegStr $INSTDIR HKCU "${GAIM_REG_KEY}" "" |
|---|
| 1090 | IfErrors +2 |
|---|
| 1091 | StrCmp $INSTDIR "" 0 instdir_done |
|---|
| 1092 | ReadRegStr $INSTDIR HKLM "${GAIM_REG_KEY}" "" |
|---|
| 1093 | IfErrors +2 |
|---|
| 1094 | StrCmp $INSTDIR "" 0 instdir_done |
|---|
| 1095 | |
|---|
| 1096 | Call CheckUserInstallRights |
|---|
| 1097 | Pop $0 |
|---|
| 1098 | |
|---|
| 1099 | StrCmp $0 "HKLM" 0 user_dir |
|---|
| 1100 | StrCpy $INSTDIR "$PROGRAMFILES\Gaim" |
|---|
| 1101 | Goto instdir_done |
|---|
| 1102 | user_dir: |
|---|
| 1103 | StrCpy $2 "$SMPROGRAMS" |
|---|
| 1104 | Push $2 |
|---|
| 1105 | Call GetParent |
|---|
| 1106 | Call GetParent |
|---|
| 1107 | Pop $2 |
|---|
| 1108 | StrCpy $INSTDIR "$2\Gaim" |
|---|
| 1109 | |
|---|
| 1110 | instdir_done: |
|---|
| 1111 | |
|---|
| 1112 | FunctionEnd |
|---|
| 1113 | |
|---|
| 1114 | Function un.onInit |
|---|
| 1115 | Call un.RunCheck |
|---|
| 1116 | StrCpy $name "Gaim ${GAIM_VERSION}" |
|---|
| 1117 | |
|---|
| 1118 | ; Get stored language prefrence |
|---|
| 1119 | ReadRegStr $LANGUAGE HKCU ${GAIM_REG_KEY} "${GAIM_REG_LANG}" |
|---|
| 1120 | |
|---|
| 1121 | FunctionEnd |
|---|
| 1122 | |
|---|
| 1123 | Function .onSelChange |
|---|
| 1124 | Push $0 |
|---|
| 1125 | Push $2 |
|---|
| 1126 | |
|---|
| 1127 | StrCpy $2 ${SF_SELECTED} |
|---|
| 1128 | SectionGetFlags ${SecGtkNone} $0 |
|---|
| 1129 | IntOp $2 $2 & $0 |
|---|
| 1130 | SectionGetFlags ${SecGtkWimp} $0 |
|---|
| 1131 | IntOp $2 $2 & $0 |
|---|
| 1132 | SectionGetFlags ${SecGtkBluecurve} $0 |
|---|
| 1133 | IntOp $2 $2 & $0 |
|---|
| 1134 | SectionGetFlags ${SecGtkLighthouseblue} $0 |
|---|
| 1135 | IntOp $2 $2 & $0 |
|---|
| 1136 | StrCmp $2 0 skip |
|---|
| 1137 | SectionSetFlags ${SecGtkNone} 0 |
|---|
| 1138 | SectionSetFlags ${SecGtkWimp} 0 |
|---|
| 1139 | SectionSetFlags ${SecGtkBluecurve} 0 |
|---|
| 1140 | SectionSetFlags ${SecGtkLighthouseblue} 0 |
|---|
| 1141 | skip: |
|---|
| 1142 | |
|---|
| 1143 | !insertmacro UnselectSection $GTK_THEME_SEL |
|---|
| 1144 | |
|---|
| 1145 | ; Remember old selection |
|---|
| 1146 | StrCpy $2 $GTK_THEME_SEL |
|---|
| 1147 | |
|---|
| 1148 | ; Now go through and see who is checked.. |
|---|
| 1149 | SectionGetFlags ${SecGtkNone} $0 |
|---|
| 1150 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 1151 | IntCmp $0 ${SF_SELECTED} 0 +2 +2 |
|---|
| 1152 | StrCpy $GTK_THEME_SEL ${SecGtkNone} |
|---|
| 1153 | SectionGetFlags ${SecGtkWimp} $0 |
|---|
| 1154 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 1155 | IntCmp $0 ${SF_SELECTED} 0 +2 +2 |
|---|
| 1156 | StrCpy $GTK_THEME_SEL ${SecGtkWimp} |
|---|
| 1157 | SectionGetFlags ${SecGtkBluecurve} $0 |
|---|
| 1158 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 1159 | IntCmp $0 ${SF_SELECTED} 0 +2 +2 |
|---|
| 1160 | StrCpy $GTK_THEME_SEL ${SecGtkBluecurve} |
|---|
| 1161 | SectionGetFlags ${SecGtkLighthouseblue} $0 |
|---|
| 1162 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 1163 | IntCmp $0 ${SF_SELECTED} 0 +2 +2 |
|---|
| 1164 | StrCpy $GTK_THEME_SEL ${SecGtkLighthouseblue} |
|---|
| 1165 | |
|---|
| 1166 | StrCmp $2 $GTK_THEME_SEL 0 +2 ; selection hasn't changed |
|---|
| 1167 | !insertmacro SelectSection $GTK_THEME_SEL |
|---|
| 1168 | |
|---|
| 1169 | Pop $2 |
|---|
| 1170 | Pop $0 |
|---|
| 1171 | FunctionEnd |
|---|
| 1172 | |
|---|
| 1173 | ; Page enter and exit functions.. |
|---|
| 1174 | |
|---|
| 1175 | Function preWelcomePage |
|---|
| 1176 | ; If this installer dosn't have GTK, check whether we need it. |
|---|
| 1177 | ; We do this here an not in .onInit because language change in |
|---|
| 1178 | ; .onInit doesn't take effect until it is finished. |
|---|
| 1179 | !ifndef WITH_GTK |
|---|
| 1180 | Call DoWeNeedGtk |
|---|
| 1181 | Pop $0 |
|---|
| 1182 | Pop $GTK_FOLDER |
|---|
| 1183 | |
|---|
| 1184 | StrCmp $0 "0" have_gtk need_gtk |
|---|
| 1185 | need_gtk: |
|---|
| 1186 | IfSilent skip_mb |
|---|
| 1187 | MessageBox MB_OK $(GTK_INSTALLER_NEEDED) IDOK |
|---|
| 1188 | skip_mb: |
|---|
| 1189 | Quit |
|---|
| 1190 | have_gtk: |
|---|
| 1191 | !endif |
|---|
| 1192 | FunctionEnd |
|---|
| 1193 | |
|---|
| 1194 | !ifdef WITH_GTK |
|---|
| 1195 | Function preGtkDirPage |
|---|
| 1196 | Call DoWeNeedGtk |
|---|
| 1197 | Pop $0 |
|---|
| 1198 | Pop $1 |
|---|
| 1199 | |
|---|
| 1200 | StrCmp $0 "0" have_gtk |
|---|
| 1201 | StrCmp $0 "1" upgrade_gtk |
|---|
| 1202 | StrCmp $0 "2" no_gtk no_gtk |
|---|
| 1203 | |
|---|
| 1204 | ; Don't show dir selector.. Upgrades are done to existing path.. |
|---|
| 1205 | have_gtk: |
|---|
| 1206 | upgrade_gtk: |
|---|
| 1207 | Abort |
|---|
| 1208 | |
|---|
| 1209 | no_gtk: |
|---|
| 1210 | StrCmp $1 "NONE" 0 no_gtk_cont |
|---|
| 1211 | ; Got no install rights.. |
|---|
| 1212 | Abort |
|---|
| 1213 | no_gtk_cont: |
|---|
| 1214 | ; Suggest path.. |
|---|
| 1215 | StrCmp $1 "HKCU" 0 hklm1 |
|---|
| 1216 | StrCpy $2 "$SMPROGRAMS" |
|---|
| 1217 | Push $2 |
|---|
| 1218 | Call GetParent |
|---|
| 1219 | Call GetParent |
|---|
| 1220 | Pop $2 |
|---|
| 1221 | StrCpy $2 "$2\GTK\2.0" |
|---|
| 1222 | Goto got_path |
|---|
| 1223 | hklm1: |
|---|
| 1224 | StrCpy $2 "${GTK_DEFAULT_INSTALL_PATH}" |
|---|
| 1225 | |
|---|
| 1226 | got_path: |
|---|
| 1227 | StrCpy $name "GTK+ ${GTK_VERSION}" |
|---|
| 1228 | StrCpy $GTK_FOLDER $2 |
|---|
| 1229 | FunctionEnd |
|---|
| 1230 | |
|---|
| 1231 | Function postGtkDirPage |
|---|
| 1232 | StrCpy $name "Gaim ${GAIM_VERSION}" |
|---|
| 1233 | Push $GTK_FOLDER |
|---|
| 1234 | Call VerifyDir |
|---|
| 1235 | Pop $0 |
|---|
| 1236 | StrCmp $0 "0" 0 done |
|---|
| 1237 | IfSilent skip_mb |
|---|
| 1238 | MessageBox MB_OK $(GTK_BAD_INSTALL_PATH) IDOK |
|---|
| 1239 | skip_mb: |
|---|
| 1240 | Abort |
|---|
| 1241 | done: |
|---|
| 1242 | FunctionEnd |
|---|
| 1243 | !endif |
|---|
| 1244 | |
|---|
| 1245 | ; GetParameters |
|---|
| 1246 | ; input, none |
|---|
| 1247 | ; output, top of stack (replaces, with e.g. whatever) |
|---|
| 1248 | ; modifies no other variables. |
|---|
| 1249 | |
|---|
| 1250 | Function GetParameters |
|---|
| 1251 | |
|---|
| 1252 | Push $R0 |
|---|
| 1253 | Push $R1 |
|---|
| 1254 | Push $R2 |
|---|
| 1255 | Push $R3 |
|---|
| 1256 | |
|---|
| 1257 | StrCpy $R2 1 |
|---|
| 1258 | StrLen $R3 $CMDLINE |
|---|
| 1259 | |
|---|
| 1260 | ;Check for quote or space |
|---|
| 1261 | StrCpy $R0 $CMDLINE $R2 |
|---|
| 1262 | StrCmp $R0 '"' 0 +3 |
|---|
| 1263 | StrCpy $R1 '"' |
|---|
| 1264 | Goto loop |
|---|
| 1265 | StrCpy $R1 " " |
|---|
| 1266 | |
|---|
| 1267 | loop: |
|---|
| 1268 | IntOp $R2 $R2 + 1 |
|---|
| 1269 | StrCpy $R0 $CMDLINE 1 $R2 |
|---|
| 1270 | StrCmp $R0 $R1 get |
|---|
| 1271 | StrCmp $R2 $R3 get |
|---|
| 1272 | Goto loop |
|---|
| 1273 | |
|---|
| 1274 | get: |
|---|
| 1275 | IntOp $R2 $R2 + 1 |
|---|
| 1276 | StrCpy $R0 $CMDLINE 1 $R2 |
|---|
| 1277 | StrCmp $R0 " " get |
|---|
| 1278 | StrCpy $R0 $CMDLINE "" $R2 |
|---|
| 1279 | |
|---|
| 1280 | Pop $R3 |
|---|
| 1281 | Pop $R2 |
|---|
| 1282 | Pop $R1 |
|---|
| 1283 | Exch $R0 |
|---|
| 1284 | |
|---|
| 1285 | FunctionEnd |
|---|
| 1286 | |
|---|
| 1287 | ; StrStr |
|---|
| 1288 | ; input, top of stack = string to search for |
|---|
| 1289 | ; top of stack-1 = string to search in |
|---|
| 1290 | ; output, top of stack (replaces with the portion of the string remaining) |
|---|
| 1291 | ; modifies no other variables. |
|---|
| 1292 | ; |
|---|
| 1293 | ; Usage: |
|---|
| 1294 | ; Push "this is a long ass string" |
|---|
| 1295 | ; Push "ass" |
|---|
| 1296 | ; Call StrStr |
|---|
| 1297 | ; Pop $R0 |
|---|
| 1298 | ; ($R0 at this point is "ass string") |
|---|
| 1299 | |
|---|
| 1300 | Function StrStr |
|---|
| 1301 | Exch $R1 ; st=haystack,old$R1, $R1=needle |
|---|
| 1302 | Exch ; st=old$R1,haystack |
|---|
| 1303 | Exch $R2 ; st=old$R1,old$R2, $R2=haystack |
|---|
| 1304 | Push $R3 |
|---|
| 1305 | Push $R4 |
|---|
| 1306 | Push $R5 |
|---|
| 1307 | StrLen $R3 $R1 |
|---|
| 1308 | StrCpy $R4 0 |
|---|
| 1309 | ; $R1=needle |
|---|
| 1310 | ; $R2=haystack |
|---|
| 1311 | ; $R3=len(needle) |
|---|
| 1312 | ; $R4=cnt |
|---|
| 1313 | ; $R5=tmp |
|---|
| 1314 | loop: |
|---|
| 1315 | StrCpy $R5 $R2 $R3 $R4 |
|---|
| 1316 | StrCmp $R5 $R1 done |
|---|
| 1317 | StrCmp $R5 "" done |
|---|
| 1318 | IntOp $R4 $R4 + 1 |
|---|
| 1319 | Goto loop |
|---|
| 1320 | done: |
|---|
| 1321 | StrCpy $R1 $R2 "" $R4 |
|---|
| 1322 | Pop $R5 |
|---|
| 1323 | Pop $R4 |
|---|
| 1324 | Pop $R3 |
|---|
| 1325 | Pop $R2 |
|---|
| 1326 | Exch $R1 |
|---|
| 1327 | FunctionEnd |
|---|
| 1328 | |
|---|
| 1329 | ; |
|---|
| 1330 | ; Parse the Command line |
|---|
| 1331 | ; |
|---|
| 1332 | ; Unattended install command line parameters |
|---|
| 1333 | ; /L=Language e.g.: /L=1033 |
|---|
| 1334 | ; |
|---|
| 1335 | Function ParseParameters |
|---|
| 1336 | IntOp $LANG_IS_SET 0 + 0 |
|---|
| 1337 | Call GetParameters |
|---|
| 1338 | Pop $R0 |
|---|
| 1339 | Push $R0 |
|---|
| 1340 | Push "L=" |
|---|
| 1341 | Call StrStr |
|---|
| 1342 | Pop $R1 |
|---|
| 1343 | StrCmp $R1 "" next |
|---|
| 1344 | StrCpy $R1 $R1 4 2 ; Strip first 2 chars of string |
|---|
| 1345 | StrCpy $LANGUAGE $R1 |
|---|
| 1346 | IntOp $LANG_IS_SET 0 + 1 |
|---|
| 1347 | next: |
|---|
| 1348 | FunctionEnd |
|---|
| 1349 | |
|---|
| 1350 | ; GetWindowsVersion |
|---|
| 1351 | ; |
|---|
| 1352 | ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ |
|---|
| 1353 | ; Updated by Joost Verburg |
|---|
| 1354 | ; |
|---|
| 1355 | ; Returns on top of stack |
|---|
| 1356 | ; |
|---|
| 1357 | ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003) |
|---|
| 1358 | ; or |
|---|
| 1359 | ; '' (Unknown Windows Version) |
|---|
| 1360 | ; |
|---|
| 1361 | ; Usage: |
|---|
| 1362 | ; Call GetWindowsVersion |
|---|
| 1363 | ; Pop $R0 |
|---|
| 1364 | ; |
|---|
| 1365 | ; at this point $R0 is "NT 4.0" or whatnot |
|---|
| 1366 | Function GetWindowsVersion |
|---|
| 1367 | |
|---|
| 1368 | Push $R0 |
|---|
| 1369 | Push $R1 |
|---|
| 1370 | |
|---|
| 1371 | ReadRegStr $R0 HKLM \ |
|---|
| 1372 | "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion |
|---|
| 1373 | |
|---|
| 1374 | IfErrors 0 lbl_winnt |
|---|
| 1375 | |
|---|
| 1376 | ; we are not NT |
|---|
| 1377 | ReadRegStr $R0 HKLM \ |
|---|
| 1378 | "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber |
|---|
| 1379 | |
|---|
| 1380 | StrCpy $R1 $R0 1 |
|---|
| 1381 | StrCmp $R1 '4' 0 lbl_error |
|---|
| 1382 | |
|---|
| 1383 | StrCpy $R1 $R0 3 |
|---|
| 1384 | |
|---|
| 1385 | StrCmp $R1 '4.0' lbl_win32_95 |
|---|
| 1386 | StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 |
|---|
| 1387 | |
|---|
| 1388 | lbl_win32_95: |
|---|
| 1389 | StrCpy $R0 '95' |
|---|
| 1390 | Goto lbl_done |
|---|
| 1391 | |
|---|
| 1392 | lbl_win32_98: |
|---|
| 1393 | StrCpy $R0 '98' |
|---|
| 1394 | Goto lbl_done |
|---|
| 1395 | |
|---|
| 1396 | lbl_win32_ME: |
|---|
| 1397 | StrCpy $R0 'ME' |
|---|
| 1398 | Goto lbl_done |
|---|
| 1399 | |
|---|
| 1400 | lbl_winnt: |
|---|
| 1401 | StrCpy $R1 $R0 1 |
|---|
| 1402 | |
|---|
| 1403 | StrCmp $R1 '3' lbl_winnt_x |
|---|
| 1404 | StrCmp $R1 '4' lbl_winnt_x |
|---|
| 1405 | |
|---|
| 1406 | StrCpy $R1 $R0 3 |
|---|
| 1407 | |
|---|
| 1408 | StrCmp $R1 '5.0' lbl_winnt_2000 |
|---|
| 1409 | StrCmp $R1 '5.1' lbl_winnt_XP |
|---|
| 1410 | StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error |
|---|
| 1411 | |
|---|
| 1412 | lbl_winnt_x: |
|---|
| 1413 | StrCpy $R0 "NT $R0" 6 |
|---|
| 1414 | Goto lbl_done |
|---|
| 1415 | |
|---|
| 1416 | lbl_winnt_2000: |
|---|
| 1417 | Strcpy $R0 '2000' |
|---|
| 1418 | Goto lbl_done |
|---|
| 1419 | |
|---|
| 1420 | lbl_winnt_XP: |
|---|
| 1421 | Strcpy $R0 'XP' |
|---|
| 1422 | Goto lbl_done |
|---|
| 1423 | |
|---|
| 1424 | lbl_winnt_2003: |
|---|
| 1425 | Strcpy $R0 '2003' |
|---|
| 1426 | Goto lbl_done |
|---|
| 1427 | |
|---|
| 1428 | lbl_error: |
|---|
| 1429 | Strcpy $R0 '' |
|---|
| 1430 | lbl_done: |
|---|
| 1431 | |
|---|
| 1432 | Pop $R1 |
|---|
| 1433 | Exch $R0 |
|---|
| 1434 | FunctionEnd |
|---|
| 1435 | |
|---|