1
; Script based on generated HM NIS Edit Script Wizard.
2
; Forgive me, i am new at this. -- paul@cypherpunks.ca
4
; known issue. installer induced uninstaller abortion causes overwrite by installer without
6
; v3.0.1 - Version for gaim-2.0.0 beta5
7
; v3.0.0 - Bump version number.
8
; v2.0.2 - Bump version number.
9
; v2.0.1 - Bump version number.
10
; v2.0.0-2 - linking to libotr-2.0.1
11
; v2.0.0 - Bump version number. Fixed upgrading gaim2-otr (it didn't overwrite the dll)
12
; bug reported by Aldert Hazenberg <aldert@xelerance.com>
13
; - Added many safeguards and fixed conditions of failures when gaim is running
14
; during install, or failed to (un)install previously.
15
; - Removed popup signifying gaim is found
16
; v1.99.0-1 - Bump version number, install Protocol.txt file
17
; v1.0.3-2 - Fix for detecting gaim if not installed by Administrator
18
; bug report by Joanna Rutkowska <joanna@mailsnare.net>
19
; - Fix for uninstalling the dll when not installed as Administrator
20
; v1.0.3 - Initial version
23
; todo: SetBrandingImage
24
; HM NIS Edit Wizard helper defines
25
!define PRODUCT_NAME "gaim-otr"
26
!define PRODUCT_VERSION "3.0.1"
27
!define PRODUCT_PUBLISHER "Cypherpunks CA"
28
!define PRODUCT_WEB_SITE "http://www.cypherpunks.ca/otr/"
29
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
30
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
32
; MUI 1.67 compatible ------
36
!define MUI_ABORTWARNING
37
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
38
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
41
!insertmacro MUI_PAGE_WELCOME
43
!insertmacro MUI_PAGE_LICENSE "c:\otr\COPYING.txt"
45
!insertmacro MUI_PAGE_DIRECTORY
47
!insertmacro MUI_PAGE_INSTFILES
49
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
50
!insertmacro MUI_PAGE_FINISH
53
!insertmacro MUI_UNPAGE_INSTFILES
56
!insertmacro MUI_LANGUAGE "English"
60
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
61
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
62
InstallDir "$PROGRAMFILES\gaim2-otr"
63
InstallDirRegKey HKEY_LOCAL_MACHINE SOFTWARE\gaim-otr "Install_Dir"
64
;WriteRegStr HKLM "SOFTWARE\gaim2-otr" "gaimdir" ""
69
ShowUnInstDetails show
71
Section "MainSection" SEC01
72
;InstallDir "$PROGRAMFILES\Gaim\plugins"
74
; uninstall previous gaim2-otr install if found.
76
;Check for gaim installation
78
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\gaim2-otr" "gaimdir" "$GaimDir"
82
File "c:\otr\gaim2-otr.dll"
83
; move to gaim plugin directory, check if not busy (gaim is running)
85
; hard part is done, do the rest now.
87
File "c:\otr\README.Toolkit.txt"
88
File "c:\otr\README.txt"
89
File "c:\otr\Protocol-v2.html"
90
File "c:\otr\COPYING.txt"
91
File "c:\otr\COPYING.LIB.txt"
92
File "c:\otr\otr_mackey.exe"
93
File "c:\otr\otr_modify.exe"
94
File "c:\otr\otr_parse.exe"
95
File "c:\otr\otr_readforge.exe"
96
File "c:\otr\otr_remac.exe"
97
File "c:\otr\otr_sesskeys.exe"
98
File "c:\otr\gaim-otr.nsi"
101
Section -AdditionalIcons
102
CreateDirectory "$SMPROGRAMS\gaim2-otr"
103
CreateShortCut "$SMPROGRAMS\gaim2-otr\Uninstall.lnk" "$INSTDIR\gaim2-otr-uninst.exe"
107
WriteUninstaller "$INSTDIR\gaim2-otr-uninst.exe"
108
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
109
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\gaim2-otr-uninst.exe"
110
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
111
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
112
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
116
Function un.onUninstSuccess
118
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
122
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
127
Delete "$INSTDIR\gaim2-otr-uninst.exe"
128
Delete "$INSTDIR\README.Toolkit.txt"
129
Delete "$INSTDIR\README.txt"
130
Delete "$INSTDIR\Protocol-v2.txt"
131
Delete "$INSTDIR\COPYING.txt"
132
Delete "$INSTDIR\COPYING.LIB.txt"
133
Delete "$INSTDIR\otr_mackey.exe"
134
Delete "$INSTDIR\otr_modify.exe"
135
Delete "$INSTDIR\otr_parse.exe"
136
Delete "$INSTDIR\otr_readforge.exe"
137
Delete "$INSTDIR\otr_remac.exe"
138
Delete "$INSTDIR\otr_sesskeys.exe"
139
Delete "$INSTDIR\gaim2-otr.nsi"
140
Delete "$SMPROGRAMS\gaim2-otr\Uninstall.lnk"
141
RMDir "$SMPROGRAMS\gaim2-otr"
144
ReadRegStr $GaimDir HKLM Software\gaim-otr "gaimdir"
145
IfFileExists "$GaimDir\plugins\gaim-otr.dll" dodelete
146
ReadRegStr $GaimDir HKCU Software\gaim-otr "gaimdir"
147
IfFileExists "$GaimDir\plugins\gaim-otr.dll" dodelete
149
ReadRegStr $GaimDir HKLM Software\gaim2-otr "gaimdir"
150
IfFileExists "$GaimDir\plugins\gaim2-otr.dll" dodelete
151
ReadRegStr $GaimDir HKCU Software\gaim2-otr "gaimdir"
152
IfFileExists "$GaimDir\plugins\gaim2-otr.dll" dodelete
153
MessageBox MB_OK|MB_ICONINFORMATION "Could not find gaim plugin directory, gaim2-otr.dll not uninstalled!" IDOK ok
155
Delete "$GaimDir\plugins\gaim-otr.dll"
156
Delete "$GaimDir\plugins\gaim2-otr.dll"
158
IfFileExists "$GaimDir\plugins\gaim2-otr.dll" 0 +2
159
MessageBox MB_OK|MB_ICONINFORMATION "gaim2-otr.dll is busy. Probably Gaim is still running. Please delete $GaimDir\plugins\gaim2-otr.dll manually."
160
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
161
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\gaim2-otr\gaimdir"
165
Function GetGaimInstPath
167
ReadRegStr $0 HKLM "Software\gaim" ""
168
IfFileExists "$0\gaim.exe" cont
169
ReadRegStr $0 HKCU "Software\gaim" ""
170
IfFileExists "$0\gaim.exe" cont
171
MessageBox MB_OK|MB_ICONINFORMATION "Failed to find GAIM installation."
172
Abort "Failed to find GAIM installation. Please install GAIM first."
175
;MessageBox MB_OK|MB_ICONINFORMATION "Gaim plugin directory found at $GaimDir\plugins ."
176
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\gaim2-otr" "gaimdir" "$GaimDir"
181
ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
182
IfFileExists "$0" deinst cont
184
MessageBox MB_OK|MB_ICONEXCLAMATION "gaim2-otr was already found on your system and will first be uninstalled"
185
; the uninstaller copies itself to temp and execs itself there, so it can delete
186
; everything including its own original file location. To prevent the installer and
187
; uninstaller racing you can't simply ExecWait.
188
; We hide the uninstall because otherwise it gets really confusing window-wise
191
ExecWait '"$0" _?=$INSTDIR'
193
MessageBox MB_OK|MB_ICONEXCLAMATION "Uninstall failed or aborted"
194
Abort "Uninstalling of the previous version gave an error. Install aborted."
198
;MessageBox MB_OK|MB_ICONINFORMATION "No old gaim2-otr found, continuing."
205
; 3 hours wasted so you guys don't need a reboot!
206
; Rename /REBOOTOK "$INSTDIR\gaim2-otr.dll" "$GaimDir\plugins\gaim2-otr.dll"
207
IfFileExists "$GaimDir\plugins\gaim2-otr.dll" 0 copy ; remnant or uninstall prev version failed
208
Delete "$GaimDir\plugins\gaim2-otr.dll"
211
Rename "$INSTDIR\gaim2-otr.dll" "$GaimDir\plugins\gaim2-otr.dll"
215
MessageBox MB_RETRYCANCEL "gaim2-otr.dll is busy. Please close Gaim (including tray icon) and try again" IDCANCEL cancel
216
Delete "$GaimDir\plugins\gaim2-otr.dll"
220
Abort "Installation of gaim2-otr aborted"