; NSIS Script For Guifications Plugin ; Author Daniel A. Atallah ; Based on the Gaim installer by Herman Bloggs and the Gaim-Encryption installer by Bill Tompkins Name "Guifications ${GUIFICATIONS_VERSION}" !define GUIFICATIONS_REG_KEY
"SOFTWARE\gaim-guifications" !define GUIFICATIONS_UNINSTALL_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gaim-guifications" !define GUIFICATIONS_UNINST_EXE
"guifications-uninst.exe" !define GUIFICATIONS_DLL
"guifications.dll" !define GUIFICATIONS_UNINSTALL_LNK
"Guifications Uninstall.lnk" OutFile "guifications-${GUIFICATIONS_VERSION}.exe" !include "nsis\translations\english.nsh" ; Modern UI Configuration !define MUI_ICON
.
\nsis
\install.ico
!define MUI_UNICON
.
\nsis
\install.ico
!define MUI_HEADERIMAGE_BITMAP
"nsis\header.bmp" !define MUI_WELCOMEPAGE_TITLE
$(WELCOME_TITLE
) !define MUI_WELCOMEPAGE_TEXT
$(WELCOME_TEXT
) !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
".\COPYING" !define MUI_DIRECTORYPAGE_TEXT_TOP
$(DIR_SUBTITLE
) !define MUI_DIRECTORYPAGE_TEXT_DESTINATION
$(DIR_INNERTEXT
) !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE
$(FINISH_TITLE
) !define MUI_FINISHPAGE_TEXT
$(FINISH_TEXT
) !insertmacro MUI_PAGE_FINISH
!define MUI_CUSTOMFUNCTION_INSTFILESPRE
checkGaimVersion
!define MUI_PROGRESSBAR
smooth !define MUI_INSTALLCOLORS
/windows !insertmacro MUI_LANGUAGE
"English" !define MUI_LICENSEPAGE_RADIOBUTTONS
;The Default Installation Directory InstallDir "$PROGRAMFILES\gaim" InstallDirRegKey HKLM SOFTWARE
\gaim
"" Section -SecUninstallOldPlugin
Call CheckUserInstallRights
StrCmp $R0 "HKLM" rights_hklm
StrCmp $R0 "HKCU" rights_hkcu
done
ReadRegStr $R1 HKCU "${GUIFICATIONS_REG_KEY}" "" ReadRegStr $R2 HKCU "${GUIFICATIONS_REG_KEY}" "Version" ReadRegStr $R3 HKCU "${GUIFICATIONS_UNINSTALL_KEY}" "UninstallString" ReadRegStr $R1 HKLM "${GUIFICATIONS_REG_KEY}" "" ReadRegStr $R2 HKLM "${GUIFICATIONS_REG_KEY}" "Version" ReadRegStr $R3 HKLM "${GUIFICATIONS_UNINSTALL_KEY}" "UninstallString" ; If previous version exists .. remove StrCmp $R2 "" uninstall_problem
IfFileExists $R3 0
uninstall_problem
; Have uninstall string.. go ahead and uninstall. ; Need to copy uninstaller outside of the install dir CopyFiles /SILENT $R3 "$TEMP\${GUIFICATIONS_UNINST_EXE}" IfErrors uninstall_problem
ExecWait '"$TEMP\${GUIFICATIONS_UNINST_EXE}" /S _?=$R1' Delete "$TEMP\${GUIFICATIONS_UNINST_EXE}" Delete "$TEMP\${GUIFICATIONS_UNINST_EXE}" ; Just delete the plugin and uninstaller, and remove Registry key MessageBox MB_YESNO $(GUIFICATIONS_PROMPT_WIPEOUT
) IDYES do_wipeout
IDNO cancel_install
StrCmp $R0 "HKLM" del_lm_reg
del_cu_reg
DeleteRegKey HKCU ${GUIFICATIONS_REG_KEY} DeleteRegKey HKLM ${GUIFICATIONS_REG_KEY} Delete "$R1\plugins\${GUIFICATIONS_DLL}" RMDir /r "$R1\pixmaps\gaim\guifications" Call CheckUserInstallRights
StrCmp $R0 "NONE" instrights_none
StrCmp $R0 "HKLM" instrights_hklm
instrights_hkcu
; Write the version registry keys: WriteRegStr HKLM ${GUIFICATIONS_REG_KEY} "" "$INSTDIR" WriteRegStr HKLM ${GUIFICATIONS_REG_KEY} "Version" "${GUIFICATIONS_VERSION}" ; Write the uninstall keys for Windows WriteRegStr HKLM ${GUIFICATIONS_UNINSTALL_KEY} "DisplayName" "$(GUIFICATIONS_UNINSTALL_DESC)" WriteRegStr HKLM ${GUIFICATIONS_UNINSTALL_KEY} "UninstallString" "$INSTDIR\${GUIFICATIONS_UNINST_EXE}" ; Write the version registry keys: WriteRegStr HKCU ${GUIFICATIONS_REG_KEY} "" "$INSTDIR" WriteRegStr HKCU ${GUIFICATIONS_REG_KEY} "Version" "${GUIFICATIONS_VERSION}" ; Write the uninstall keys for Windows WriteRegStr HKCU ${GUIFICATIONS_UNINSTALL_KEY} "DisplayName" "$(GUIFICATIONS_UNINSTALL_DESC)" WriteRegStr HKCU ${GUIFICATIONS_UNINSTALL_KEY} "UninstallString" "$INSTDIR\${GUIFICATIONS_UNINST_EXE}" ; No registry keys for us... SetOutPath "$INSTDIR\plugins" File "src\${GUIFICATIONS_DLL}" SetOutPath "$INSTDIR\pixmaps\gaim\guifications\conf" File "pixmaps\icon_size_huge.png" File "pixmaps\icon_size_large.png" File "pixmaps\icon_size_normal.png" File "pixmaps\icon_size_small.png" File "pixmaps\icon_size_tiny.png" File "pixmaps\item_position_center.png" File "pixmaps\item_position_east.png" File "pixmaps\item_position_north.png" File "pixmaps\item_position_north_east.png" File "pixmaps\item_position_north_west.png" File "pixmaps\item_position_south.png" File "pixmaps\item_position_south_east.png" File "pixmaps\item_position_south_west.png" File "pixmaps\item_position_west.png" File "pixmaps\text_clipping_elipse_end.png" File "pixmaps\text_clipping_elipse_middle.png" File "pixmaps\text_clipping_elipse_start.png" File "pixmaps\text_clipping_truncate.png" File "pixmaps\window_position_north_east.png" File "pixmaps\window_position_north_west.png" File "pixmaps\window_position_south_east.png" File "pixmaps\window_position_south_west.png" File "pixmaps\window_zoom_in.png" File "pixmaps\window_zoom_normal.png" File "pixmaps\window_zoom_out.png" SetOutPath "$INSTDIR\pixmaps\gaim\guifications\backgrounds" File "pixmaps\background_default.png" CreateShortCut "$SMPROGRAMS\Gaim\${GUIFICATIONS_UNINSTALL_LNK}" "$INSTDIR\${GUIFICATIONS_UNINST_EXE}" WriteUninstaller "$INSTDIR\${GUIFICATIONS_UNINST_EXE}" Call un.CheckUserInstallRights
StrCmp $R0 "NONE" no_rights
StrCmp $R0 "HKCU" try_hkcu
try_hklm
ReadRegStr $R0 HKCU "${GUIFICATIONS_REG_KEY}" "" StrCmp $R0 $INSTDIR 0
cant_uninstall
; HKCU install path matches our INSTDIR.. so uninstall DeleteRegKey HKCU "${GUIFICATIONS_REG_KEY}" DeleteRegKey HKCU "${GUIFICATIONS_UNINSTALL_KEY}" ReadRegStr $R0 HKLM "${GUIFICATIONS_REG_KEY}" "" StrCmp $R0 $INSTDIR 0
try_hkcu
; HKLM install path matches our INSTDIR.. so uninstall DeleteRegKey HKLM "${GUIFICATIONS_REG_KEY}" DeleteRegKey HKLM "${GUIFICATIONS_UNINSTALL_KEY}" ; Sets start menu and desktop scope to all users.. Delete "$INSTDIR\plugins\${GUIFICATIONS_DLL}" RMDir /r "$INSTDIR\pixmaps\gaim\guifications" Delete "$INSTDIR\${GUIFICATIONS_UNINST_EXE}" Delete "$SMPROGRAMS\Gaim\${GUIFICATIONS_UNINSTALL_LNK}" ; try to delete the Gaim directories, in case it has already uninstalled MessageBox MB_OK $(un.GUIFICATIONS_UNINSTALL_ERROR_1
) IDOK MessageBox MB_OK $(un.GUIFICATIONS_UNINSTALL_ERROR_2
) IDOK Function .onVerifyInstDir
IfFileExists $INSTDIR\gaim.exe
Good1
Function checkGaimVersion
ReadRegStr $R1 HKLM "SOFTWARE\gaim" "version" StrCmp $R1 ${GAIM_VERSION} Good2
MessageBox MB_OK|MB_ICONSTOP "$(BAD_GAIM_VERSION_1) $R1 $(BAD_GAIM_VERSION_2)" Function CheckUserInstallRights
Function un.CheckUserInstallRights