~ubuntu-branches/ubuntu/lucid/pidgin-otr/lucid-security

« back to all changes in this revision

Viewing changes to packaging/windows/gaim-otr.nsi

  • Committer: Bazaar Package Importer
  • Author(s): Thibaut VARENE
  • Date: 2008-07-10 17:34:32 UTC
  • mfrom: (2.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080710173432-aqx359odj7cp182a
Tags: 3.2.0-2
Make key generation use /dev/urandom (Closes: #489523)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
; Script based on generated HM NIS Edit Script Wizard.
2
 
; Forgive me, i am new at this. -- paul@cypherpunks.ca
3
 
;
4
 
; known issue. installer induced uninstaller abortion causes overwrite by installer without
5
 
; uninstall.
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
21
 
 
22
 
 
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"
31
 
 
32
 
; MUI 1.67 compatible ------
33
 
!include "MUI.nsh"
34
 
 
35
 
; MUI Settings
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"
39
 
 
40
 
; Welcome page
41
 
!insertmacro MUI_PAGE_WELCOME
42
 
; License page
43
 
!insertmacro MUI_PAGE_LICENSE "c:\otr\COPYING.txt"
44
 
; Directory page
45
 
!insertmacro MUI_PAGE_DIRECTORY
46
 
; Instfiles page
47
 
!insertmacro MUI_PAGE_INSTFILES
48
 
; Finish page
49
 
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
50
 
!insertmacro MUI_PAGE_FINISH
51
 
 
52
 
; Uninstaller pages
53
 
!insertmacro MUI_UNPAGE_INSTFILES
54
 
 
55
 
; Language files
56
 
!insertmacro MUI_LANGUAGE "English"
57
 
 
58
 
; MUI end ------
59
 
 
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" ""
65
 
 
66
 
Var "GaimDir"
67
 
 
68
 
ShowInstDetails show
69
 
ShowUnInstDetails show
70
 
 
71
 
Section "MainSection" SEC01
72
 
;InstallDir "$PROGRAMFILES\Gaim\plugins"
73
 
 
74
 
; uninstall previous gaim2-otr install if found.
75
 
Call UnInstOld
76
 
 ;Check for gaim installation
77
 
Call GetGaimInstPath
78
 
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\gaim2-otr" "gaimdir" "$GaimDir"
79
 
 
80
 
        SetOutPath "$INSTDIR"
81
 
  SetOverwrite on
82
 
  File "c:\otr\gaim2-otr.dll"
83
 
  ; move to gaim plugin directory, check if not busy (gaim is running)
84
 
        call CopyDLL
85
 
  ; hard part is done, do the rest now.
86
 
  SetOverwrite on         
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"
99
 
SectionEnd
100
 
 
101
 
Section -AdditionalIcons
102
 
  CreateDirectory "$SMPROGRAMS\gaim2-otr"
103
 
  CreateShortCut "$SMPROGRAMS\gaim2-otr\Uninstall.lnk" "$INSTDIR\gaim2-otr-uninst.exe"
104
 
SectionEnd
105
 
 
106
 
Section -Post
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}"
113
 
 
114
 
SectionEnd
115
 
 
116
 
Function un.onUninstSuccess
117
 
  HideWindow
118
 
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
119
 
FunctionEnd
120
 
 
121
 
Function un.onInit
122
 
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
123
 
  Abort
124
 
FunctionEnd
125
 
 
126
 
Section Uninstall
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"
142
 
  RMDir "$INSTDIR"
143
 
  
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
148
 
        
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
154
 
dodelete:
155
 
        Delete "$GaimDir\plugins\gaim-otr.dll"
156
 
        Delete "$GaimDir\plugins\gaim2-otr.dll"
157
 
        
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"
162
 
ok:
163
 
SetAutoClose true
164
 
SectionEnd
165
 
Function GetGaimInstPath
166
 
  Push $0
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."
173
 
cont:
174
 
        StrCpy $GaimDir $0
175
 
        ;MessageBox MB_OK|MB_ICONINFORMATION "Gaim plugin directory found at $GaimDir\plugins ."
176
 
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\gaim2-otr" "gaimdir" "$GaimDir"
177
 
FunctionEnd
178
 
 
179
 
Function UnInstOld
180
 
          Push $0
181
 
          ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
182
 
                IfFileExists "$0" deinst cont
183
 
        deinst:
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
189
 
                ;HideWindow
190
 
                  ClearErrors
191
 
                        ExecWait '"$0" _?=$INSTDIR'
192
 
                        IfErrors 0 cont
193
 
                                MessageBox MB_OK|MB_ICONEXCLAMATION  "Uninstall failed or aborted"
194
 
                                Abort "Uninstalling of the previous version gave an error. Install aborted."
195
 
                        
196
 
                ;BringToFront
197
 
        cont:
198
 
                ;MessageBox MB_OK|MB_ICONINFORMATION "No old gaim2-otr found, continuing."
199
 
                
200
 
FunctionEnd
201
 
 
202
 
Function CopyDLL
203
 
SetOverwrite try
204
 
ClearErrors
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"
209
 
copy:
210
 
ClearErrors
211
 
Rename "$INSTDIR\gaim2-otr.dll" "$GaimDir\plugins\gaim2-otr.dll"
212
 
IfErrors dllbusy
213
 
        Return
214
 
dllbusy:
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"
217
 
        Goto copy
218
 
        Return
219
 
cancel:
220
 
        Abort "Installation of gaim2-otr aborted"
221
 
FunctionEnd