~ubuntu-branches/debian/sid/gsmartcontrol/sid

« back to all changes in this revision

Viewing changes to data/nsis/gsmartcontrol.nsi.in

  • Committer: Bazaar Package Importer
  • Author(s): Giuseppe Iuculano
  • Date: 2011-07-15 14:59:29 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110715145929-2o1o4phm5w1rwttz
Tags: 0.8.6-1
* [dbb993d] Updated my email address and removed DM-Upload-Allowed
  control field
* [b681b5b] Imported Upstream version 0.8.6
* [ab9bb7a] Refreshed patches
* [a909506] Bump to Standards-Version 3.9.2, no changes needed
* [48dd13d] Switch to dpkg-source 3.0 (quilt) format

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
; NSIS2 Script
3
 
; Compatible with NSIS 2.40
4
 
 
 
3
; by Alexander Shaduri <ashaduri 'at' gmail.com>.
 
4
; Compatible with NSIS Unicode 2.45.
 
5
; Public Domain
 
6
 
 
7
; pass /DNO_GTK to makensis to disable inclusion of gtk.
 
8
 
 
9
; gtk installer name for embedding
 
10
!define GTK_INSTALLER_EXE "@GTK_INSTALLER_NAME@.exe"
5
11
 
6
12
!define PRODUCT_VERSION "@VERSION@"
7
13
!define PRODUCT_NAME "GSmartControl"
16
22
!define REGISTRY_APP_PATHS "Software\Microsoft\Windows\CurrentVersion\App Paths"
17
23
 
18
24
 
 
25
!include "FileFunc.nsh"  ; GetOptions
 
26
 
19
27
 
20
28
 
21
29
; --------------- General Settings
22
30
 
23
31
 
 
32
; This is needed for proper start menu item manipulation (for all users) in vista
 
33
RequestExecutionLevel admin
 
34
 
24
35
; This compressor gives us the best results
25
36
SetCompressor /SOLID lzma
26
37
 
31
42
Name "${PRODUCT_NAME}"  ;  ${PRODUCT_VERSION}
32
43
 
33
44
; Output File Name
34
 
OutFile "${PRODUCT_NAME_SMALL}-${PRODUCT_VERSION}.exe"
35
 
 
36
 
 
37
 
 
38
 
;The Default Installation Directory
39
 
; try to install to the same directory as runtime.
40
 
InstallDir "$PROGRAMFILES\${PRODUCT_NAME_SMALL}"
 
45
!ifdef NO_GTK
 
46
        OutFile "${PRODUCT_NAME_SMALL}-${PRODUCT_VERSION}-nogtk.exe"
 
47
!else
 
48
        OutFile "${PRODUCT_NAME_SMALL}-${PRODUCT_VERSION}.exe"
 
49
!endif
 
50
 
 
51
 
 
52
; The Default Installation Directory:
 
53
; Try to install to the same directory as runtime.
 
54
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
41
55
; If already installed, try here
42
56
InstallDirRegKey HKLM "SOFTWARE\${PRODUCT_NAME}" "InstallationDirectory"
43
57
 
53
67
 
54
68
; MUI 2.0 compatible install
55
69
!include "MUI2.nsh"
 
70
!include "InstallOptions.nsh"  ; section description macros
56
71
 
57
 
;Backgound Colors. uncomment to enable fullscreen.
 
72
; Backgound Colors. uncomment to enable fullscreen.
58
73
; BGGradient 0000FF 000000 FFFFFF
59
74
 
60
75
; MUI Settings
63
78
!define MUI_UNICON "nsi_uninstall.ico"
64
79
 
65
80
 
66
 
;Things that need to be extracted on first (keep these lines before any File command!)
67
 
;Only useful for BZIP2 compression
68
 
!insertmacro MUI_RESERVEFILE_LANGDLL
 
81
; Things that need to be extracted on first (keep these lines before any File command!).
 
82
; Only useful for BZIP2 compression.
 
83
;!insertmacro MUI_RESERVEFILE_LANGDLL
69
84
;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
70
85
 
71
86
 
72
87
; Language Selection Dialog Settings
73
 
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
74
 
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
75
 
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
 
88
;!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
 
89
;!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
 
90
;!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
76
91
 
 
92
!ifdef NO_GTK
 
93
        !define LICENSE_FILE "doc\distribution-nogtk.txt"
 
94
!else
 
95
        !define LICENSE_FILE "doc\distribution.txt"
 
96
!endif
77
97
 
78
98
; Pages to show during installation
79
99
!insertmacro MUI_PAGE_WELCOME
80
 
!insertmacro MUI_PAGE_LICENSE "doc\distribution.txt"
81
 
;!insertmacro MUI_PAGE_COMPONENTS
 
100
!insertmacro MUI_PAGE_LICENSE "${LICENSE_FILE}"
 
101
!ifndef NO_GTK
 
102
        !define MUI_PAGE_CUSTOMFUNCTION_LEAVE on_components_page_leave
 
103
        !insertmacro MUI_PAGE_COMPONENTS
 
104
!endif
82
105
!insertmacro MUI_PAGE_DIRECTORY
83
106
!insertmacro MUI_PAGE_INSTFILES
84
107
 
106
129
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "GSmartControl"
107
130
 
108
131
 
109
 
 
110
 
; --------------- START INSTALLATION
111
 
 
112
 
 
113
 
Function .onInit
114
 
 
115
 
  !insertmacro MUI_LANGDLL_DISPLAY
116
 
 
117
 
  Push 2 ;F ;22 = number of languages, F = change font
118
 
 
119
 
  ;Language selection
120
 
  LangDLL::LangDialog "Installer Language" "Please select a language."
121
 
 
122
 
  Pop $LANGUAGE
123
 
  StrCmp $LANGUAGE "cancel" 0 +2
124
 
  Abort
125
 
 
126
 
    ; detect previous installation
127
 
        ReadRegStr $R0 HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
128
 
        StrCmp $R0 "" no_prev
129
 
 
130
 
        MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
131
 
                "${PRODUCT_NAME} is already installed. $\n$\nClick 'OK' to remove the \
132
 
                previous version or 'Cancel' to continue anyway." \
133
 
                IDOK uninst_product
134
 
                ; Abort
135
 
        goto no_prev ; if cancel was pressed, continue as if no old installation.
136
 
 
137
 
    ;Run the uninstaller
138
 
    uninst_product:
139
 
    ClearErrors
140
 
    ExecWait '$R0 _?=$INSTDIR'  ;Do not copy the uninstaller to a temp file
141
 
 
142
 
    IfErrors cannot_uninst_product
143
 
 
144
 
    ;You can either use Delete /REBOOTOK in the uninstaller or add some code
145
 
    ;here to remove the uninstaller. Use a registry key to check
146
 
    ;whether the user has chosen to uninstall. If you are using an uninstaller
147
 
    ;components page, make sure all sections are uninstalled.
148
 
    cannot_uninst_product:
149
 
 
150
 
    no_prev: ; no old installation found, all ok
151
 
 
152
 
 
153
 
 
154
 
 
155
 
        ; detect GTK installation (any of available versions)
156
 
        ReadRegStr $R0 HKLM "SOFTWARE\GTK\2.0" "DllPath"
157
 
        StrCmp $R0 "" no_gtk
158
 
 
159
 
        goto have_gtk
160
 
 
161
 
        no_gtk:
162
 
        MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
163
 
        "GTK2-Runtime is not installed. This product needs it to function properly.$\n\
164
 
        Please install GTK2-Runtime from http://gtk-win.sf.net/ first.$\n$\n\
165
 
        Click 'Cancel' to abort the installation \
166
 
        or 'OK' to continue anyway." \
167
 
        IDOK have_gtk
168
 
        Abort
169
 
 
170
 
        have_gtk:
171
 
        ; do nothing
172
 
 
173
 
 
174
 
 
175
 
FunctionEnd
176
 
 
 
132
var install_option_removeold  ; uninstall the old version first (if present): yes (default), no.
177
133
 
178
134
 
179
135
 
180
136
; ----------------- INSTALLATION TYPES
181
137
 
182
138
; InstType "Recommended"
183
 
InstType "Full"
184
 
;InstType "Minimal"
185
 
 
186
 
 
187
 
 
188
 
 
189
 
 
190
 
 
191
 
Section "Main" SecMain
192
 
SectionIn 1
193
 
  SetOutPath "$INSTDIR"
194
 
 
195
 
  SetOverwrite Off ; don't overwrite the config file
196
 
;  File "gsmartcontrol.conf"
197
 
 
198
 
  SetOverwrite On
199
 
  File gsmartcontrol.exe
200
 
  File gsmartcontrol.ico
201
 
  File icon_*.png
202
 
;  File *.dll
203
 
  File smartctl-nc.exe
204
 
  File smartctl.exe
205
 
 
206
 
  File /r doc
207
 
 
208
 
  ; set a special path for this exe, as GTK may not be in a global path.
209
 
  ReadRegStr $R3 HKLM "SOFTWARE\GTK\2.0" "DllPath"
210
 
  WriteRegStr HKLM "${REGISTRY_APP_PATHS}\gsmartcontrol.exe" "Path" "$R3"
211
 
 
212
 
  ;Add Shortcuts
213
 
  CreateShortCut "$SMPROGRAMS\GSmartControl.lnk" "$INSTDIR\gsmartcontrol.exe" "" "$INSTDIR\gsmartcontrol.ico" 0
214
 
 
215
 
SectionEnd
216
 
 
 
139
; InstType "Full"
 
140
; InstType "Minimal"
 
141
 
 
142
 
 
143
 
 
144
 
 
145
Section "!GSmartControl" SecMain
 
146
SectionIn 1 RO
 
147
        SetShellVarContext all  ; use all user variables as opposed to current user
 
148
        SetOutPath "$INSTDIR"
 
149
 
 
150
        SetOverwrite Off ; don't overwrite the config file
 
151
        ; File "gsmartcontrol.conf"
 
152
 
 
153
        SetOverwrite On
 
154
        File gsmartcontrol.exe
 
155
        File gsmartcontrol.exe.manifest
 
156
        File gsmartcontrol.ico
 
157
        File icon_*.png
 
158
        ; File *.dll
 
159
        File smartctl-nc.exe
 
160
        File smartctl.exe
 
161
        File update-smart-drivedb.exe
 
162
 
 
163
        ; Include the "doc" directory completely, excluding the file we're not using (e.g. the -nogtk file in gtk installer).
 
164
!ifdef NO_GTK
 
165
        File /r /x distribution.txt doc
 
166
!else
 
167
        File /r /x distribution-nogtk.txt doc
 
168
!endif
 
169
 
 
170
        ; Add Shortcuts (this inherits the exe's run permissions)
 
171
        CreateShortCut "$SMPROGRAMS\GSmartControl.lnk" "$INSTDIR\gsmartcontrol.exe" "" \
 
172
                "$INSTDIR\gsmartcontrol.ico" "" SW_SHOWNORMAL "" "GSmartControl - Hard disk drive health inspection tool"
 
173
 
 
174
SectionEnd
 
175
 
 
176
 
 
177
 
 
178
!ifndef NO_GTK
 
179
 
 
180
; The SecGtkPrivate and SecGtkPublic sections are mutually exclusive.
 
181
 
 
182
Section "GTK+ (for this program only)" SecGtkPrivate
 
183
        SectionIn 1
 
184
        SetShellVarContext all  ; use all user variables as opposed to current user
 
185
        AddSize 12200  ; ~ size of unpacked gtk
 
186
        SetOutPath "$INSTDIR"
 
187
        File "${GTK_INSTALLER_EXE}"
 
188
        ; TODO: in the future, when we have translations for this program,
 
189
        ; make the GTK+ translations installation dependent on their installation status.
 
190
        ExecWait '"${GTK_INSTALLER_EXE}" /sideeffects=no /dllpath=root /translations=no /compatdlls=no /S /D=$INSTDIR'
 
191
        Delete "$INSTDIR\${GTK_INSTALLER_EXE}"
 
192
SectionEnd
 
193
 
 
194
; disabled by default
 
195
Section /o "GTK+ (shared installation)" SecGtkPublic
 
196
        SectionIn 1
 
197
        SetShellVarContext all  ; use all user variables as opposed to current user
 
198
        AddSize 12200  ; ~ size of unpacked gtk
 
199
        SetOutPath "$INSTDIR"
 
200
        File "${GTK_INSTALLER_EXE}"
 
201
        ExecWait '"${GTK_INSTALLER_EXE}"'
 
202
        Delete "$INSTDIR\${GTK_INSTALLER_EXE}"
 
203
SectionEnd
 
204
 
 
205
!endif  ; !NO_GTK
 
206
 
 
207
 
 
208
!ifndef NO_GTK
 
209
var gtk_mode  ; "public", "private" or "none"
 
210
var gtk_tmp  ; temporary variable
 
211
!endif
 
212
 
 
213
 
 
214
; Executed on installation start
 
215
Function .onInit
 
216
        SetShellVarContext all  ; use all user variables as opposed to current user
 
217
 
 
218
        ${GetOptions} "$CMDLINE" "/removeold=" $install_option_removeold
 
219
 
 
220
        Call PreventMultipleInstances
 
221
 
 
222
        Call DetectPrevInstallation
 
223
 
 
224
; ask for gtk only if it's a non-gtk installer.
 
225
!ifdef NO_GTK
 
226
        Call AskForGtk
 
227
!endif
 
228
 
 
229
!ifndef NO_GTK
 
230
        StrCpy $gtk_mode "private" ; default
 
231
!endif
 
232
 
 
233
FunctionEnd
 
234
 
 
235
 
 
236
 
 
237
function .onselchange
 
238
 
 
239
!ifndef NO_GTK
 
240
        ; Remember which gtk section was selected.
 
241
        ; Deselect the other section.
 
242
 
 
243
        ; If it was private, we check if public is checked and uncheck private.
 
244
 
 
245
        StrCmp $gtk_mode "private" check_public  ; old selection
 
246
        StrCmp $gtk_mode "public" check_private  ; old selection
 
247
        goto check_exit
 
248
 
 
249
        check_public:
 
250
                SectionGetFlags ${SecGtkPublic} $gtk_tmp  ; see if it's checked
 
251
                IntOp $gtk_tmp $gtk_tmp & ${SF_SELECTED}
 
252
                IntCmp $gtk_tmp ${SF_SELECTED} "" check_exit check_exit
 
253
                SectionGetFlags ${SecGtkPrivate} $gtk_tmp  ; unselect the other one
 
254
                IntOp $gtk_tmp $gtk_tmp & ${SECTION_OFF}
 
255
                SectionSetFlags ${SecGtkPrivate} $gtk_tmp
 
256
                goto check_exit
 
257
 
 
258
        check_private:
 
259
                SectionGetFlags ${SecGtkPrivate} $gtk_tmp  ; see if it's checked
 
260
                IntOp $gtk_tmp $gtk_tmp & ${SF_SELECTED}
 
261
                IntCmp $gtk_tmp ${SF_SELECTED} "" check_exit check_exit
 
262
                SectionGetFlags ${SecGtkPublic} $gtk_tmp  ; unselect the other one
 
263
                IntOp $gtk_tmp $gtk_tmp & ${SECTION_OFF}
 
264
                SectionSetFlags ${SecGtkPublic} $gtk_tmp
 
265
 
 
266
        check_exit:
 
267
 
 
268
 
 
269
        ; store the current mode
 
270
        StrCpy $gtk_mode "none"
 
271
 
 
272
        SectionGetFlags ${SecGtkPrivate} $gtk_tmp
 
273
        IntOp $gtk_tmp $gtk_tmp & ${SF_SELECTED}
 
274
        IntCmp $gtk_tmp ${SF_SELECTED} "" mode_end_private mode_end_private
 
275
        StrCpy $gtk_mode "private"
 
276
        mode_end_private:
 
277
 
 
278
        SectionGetFlags ${SecGtkPublic} $gtk_tmp
 
279
        IntOp $gtk_tmp $gtk_tmp & ${SF_SELECTED}
 
280
        IntCmp $gtk_tmp ${SF_SELECTED} "" mode_end_public mode_end_public
 
281
        StrCpy $gtk_mode "public"
 
282
        mode_end_public:
 
283
 
 
284
        ; MessageBox MB_ICONINFORMATION|MB_OK "gtk_mode: $gtk_mode" /SD IDOK
 
285
!endif  ; !NO_GTK
 
286
 
 
287
functionend
 
288
 
 
289
 
 
290
!ifndef NO_GTK
 
291
Function on_components_page_leave
 
292
        StrCmp $gtk_mode "none" "" noabort
 
293
                Call AskForGtk
 
294
        noabort:
 
295
FunctionEnd
 
296
!endif  ; !NO_GTK
 
297
 
 
298
 
 
299
 
 
300
 
 
301
; Section descriptions
 
302
!ifndef NO_GTK  ; this page is shown only when using gtk
 
303
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
304
        !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} "GSmartControl - hard disk drive health inspection tool"
 
305
        !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkPrivate} "GTK+ libraries, needed by GSmartControl. \
 
306
                This will install a private version of GTK+, usable only by GSmartControl."
 
307
        !insertmacro MUI_DESCRIPTION_TEXT ${SecGtkPublic} "GTK+ libraries, needed by GSmartControl. \
 
308
                This will install a system-wide version of GTK+, shareable with other programs."
 
309
!insertmacro MUI_FUNCTION_DESCRIPTION_END
 
310
!endif
217
311
 
218
312
 
219
313
; ------------------ POST INSTALL
220
314
 
221
315
 
222
 
!define TEMP $R0
 
316
var gtk_dll_abs_path
223
317
 
224
318
Section -post
225
 
 
226
 
  WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "InstallationDirectory" "$INSTDIR"
227
 
  WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "Vendor" "Alexander Shaduri"
228
 
 
229
 
  WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
230
 
  WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\gsmartcontrol_uninst.exe"
231
 
 
232
 
  ; We don't need this, MUI takes care for us
233
 
  WriteRegStr HKCU "Software\${PRODUCT_NAME}" "Installer Language" $LANGUAGE
234
 
 
235
 
  ; uninstall shortcut
236
 
;  CreateDirectory "$SMPROGRAMS\GSmartControl"
237
 
;  CreateShortCut "$SMPROGRAMS\GSmartControl\Uninstall GSmartControl.lnk" "$INSTDIR\gsmartcontrol_uninst.exe" "" ""
238
 
 
239
 
 
240
 
  ; write out uninstaller
241
 
  WriteUninstaller "$INSTDIR\gsmartcontrol_uninst.exe"
 
319
        SetShellVarContext all  ; use all user variables as opposed to current user
 
320
 
 
321
        ; Don't set any paths for this exe if it has a private GTK+ installation.
 
322
!ifndef NO_GTK
 
323
        StrCmp $gtk_mode "private" skip_exe_PATH
 
324
!endif
 
325
        ; set a special path for this exe, as GTK may not be in a global path.
 
326
        ReadRegStr $gtk_dll_abs_path HKLM "SOFTWARE\GTK\2.0" "DllPath"
 
327
        WriteRegStr HKLM "${REGISTRY_APP_PATHS}\gsmartcontrol.exe" "Path" "$gtk_dll_abs_path"
 
328
!ifndef NO_GTK
 
329
        skip_exe_PATH:
 
330
!endif
 
331
 
 
332
!ifndef NO_GTK
 
333
        WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "GtkInstalledMode" "$gtk_mode"
 
334
!endif
 
335
 
 
336
        WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "InstallationDirectory" "$INSTDIR"
 
337
        WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "Vendor" "${PRODUCT_PUBLISHER}"
 
338
 
 
339
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
 
340
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\gsmartcontrol_uninst.exe"
 
341
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
 
342
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
 
343
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\gsmartcontrol.ico"
 
344
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
 
345
        WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
 
346
        WriteRegDWORD HKLM "${PRODUCT_UNINST_KEY}" "NoModify" 1
 
347
        WriteRegDWORD HKLM "${PRODUCT_UNINST_KEY}" "NoRepair" 1
 
348
 
 
349
        ; We don't need this, MUI takes care for us
 
350
        ; WriteRegStr HKCU "Software\${PRODUCT_NAME}" "Installer Language" $sUAGE
 
351
 
 
352
        ; write out uninstaller
 
353
        WriteUninstaller "$INSTDIR\gsmartcontrol_uninst.exe"
 
354
 
 
355
        ; uninstall shortcut
 
356
        ;CreateDirectory "$SMPROGRAMS\GSmartControl"
 
357
        ;CreateShortCut "$SMPROGRAMS\GSmartControl\Uninstall GSmartControl.lnk" "$INSTDIR\gsmartcontrol_uninst.exe" "" ""
242
358
 
243
359
SectionEnd ; post
244
360
 
251
367
 
252
368
 
253
369
Function un.onUninstSuccess
254
 
  HideWindow
255
 
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
 
370
        HideWindow
 
371
        MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK
256
372
FunctionEnd
257
373
 
258
374
 
259
375
 
260
376
 
261
377
Section Uninstall
262
 
 
263
 
  SetAutoClose false
264
 
 
265
 
  ; add delete commands to delete whatever files/registry keys/etc you installed here.
266
 
  Delete "$INSTDIR\gsmartcontrol_uninst.exe"
267
 
 
268
 
  DeleteRegKey HKLM "SOFTWARE\${PRODUCT_NAME}"
269
 
  DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}"
270
 
 
271
 
  Delete "$INSTDIR\gsmartcontrol.exe"
272
 
  Delete "$INSTDIR\gsmartcontrol.ico"
273
 
  Delete "$INSTDIR\icon_*.png"
274
 
;  Delete "$INSTDIR\*.dll"
275
 
  Delete "$INSTDIR\smartctl-nc.exe"
276
 
  Delete "$INSTDIR\smartctl.exe"
277
 
 
278
 
  RMDir /r "$INSTDIR\doc"
279
 
 
280
 
  RMDir "$INSTDIR"  ; only if empty
281
 
 
282
 
  DeleteRegKey HKLM "${REGISTRY_APP_PATHS}\gsmartcontrol.exe"
283
 
 
284
 
  Delete "$SMPROGRAMS\GSmartControl.lnk"
285
 
;  Delete "$SMPROGRAMS\GSmartControl\Uninstall GSmartControl.lnk"
286
 
 
 
378
        SetShellVarContext all  ; use all user variables as opposed to current user
 
379
        SetAutoClose false
 
380
 
 
381
!ifndef NO_GTK
 
382
        ReadRegStr $gtk_mode HKLM "SOFTWARE\${PRODUCT_NAME}" "GtkInstalledMode"
 
383
        StrCmp $gtk_mode "private" "" skip_gtk_remove
 
384
                ; remove private GTK+, specify the same custom options are during installation
 
385
                ExecWait "$INSTDIR\gtk2_runtime_uninst.exe /remove_config=yes /sideeffects=no /dllpath=root /translations=no /compatdlls=no /S"
 
386
                ; _?=$INSTDIR
 
387
                ; Delete "$INSTDIR\gtk2_runtime_uninst.exe"  ; If using _? flag, it won't get deleted automatically, do it manually.
 
388
        skip_gtk_remove:
 
389
!endif
 
390
 
 
391
        ; add delete commands to delete whatever files/registry keys/etc you installed here.
 
392
        Delete "$INSTDIR\gsmartcontrol_uninst.exe"
 
393
 
 
394
        DeleteRegKey HKLM "SOFTWARE\${PRODUCT_NAME}"
 
395
        DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}"
 
396
 
 
397
        Delete "$INSTDIR\gsmartcontrol.exe"
 
398
        Delete "$INSTDIR\gsmartcontrol.exe.manifest"
 
399
        Delete "$INSTDIR\gsmartcontrol.ico"
 
400
        Delete "$INSTDIR\icon_*.png"
 
401
        ; Delete "$INSTDIR\*.dll"
 
402
        Delete "$INSTDIR\smartctl-nc.exe"
 
403
        Delete "$INSTDIR\smartctl.exe"
 
404
        Delete "$INSTDIR\update-smart-drivedb.exe"
 
405
 
 
406
        RMDir /r "$INSTDIR\doc"
 
407
 
 
408
        ; clean up generated stuff
 
409
        Delete "$INSTDIR\*stdout.txt"
 
410
        Delete "$INSTDIR\*stderr.txt"
 
411
 
 
412
        RMDir "$INSTDIR"  ; only if empty
 
413
 
 
414
!ifndef NO_GTK
 
415
        StrCmp $gtk_mode "private" skip_exe_PATH_remove
 
416
!endif
 
417
        DeleteRegKey HKLM "${REGISTRY_APP_PATHS}\gsmartcontrol.exe"
 
418
!ifndef NO_GTK
 
419
        skip_exe_PATH_remove:
 
420
!endif
 
421
 
 
422
        Delete "$SMPROGRAMS\GSmartControl.lnk"
 
423
        ;Delete "$SMPROGRAMS\GSmartControl\Uninstall GSmartControl.lnk"
287
424
 
288
425
SectionEnd ; end of uninstall section
289
426
 
290
427
 
291
428
 
292
 
 
293
 
; eof
 
 
b'\\ No newline at end of file'
 
429
; --------------- Helpers
 
430
 
 
431
; Detect previous installation
 
432
Function DetectPrevInstallation
 
433
        ; if /removeold=no option is given, don't check anything.
 
434
        StrCmp $install_option_removeold "no" old_detect_done
 
435
 
 
436
        SetShellVarContext all  ; use all user variables as opposed to current user
 
437
        push $R0
 
438
 
 
439
        ; detect previous installation
 
440
        ReadRegStr $R0 HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
 
441
        StrCmp $R0 "" old_detect_done
 
442
 
 
443
        MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
 
444
                "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
 
445
                previous version or `Cancel` to continue anyway." \
 
446
                /SD IDOK IDOK old_uninst
 
447
                ; Abort
 
448
                goto old_detect_done
 
449
 
 
450
        ; Run the old uninstaller
 
451
        old_uninst:
 
452
                ClearErrors
 
453
                IfSilent old_silent_uninst old_nosilent_uninst
 
454
 
 
455
                old_nosilent_uninst:
 
456
                        ExecWait '$R0'
 
457
                        goto old_uninst_continue
 
458
 
 
459
                old_silent_uninst:
 
460
                        ExecWait '$R0 /S _?=$INSTDIR'
 
461
 
 
462
                old_uninst_continue:
 
463
 
 
464
                IfErrors old_no_remove_uninstaller
 
465
 
 
466
                ; You can either use Delete /REBOOTOK in the uninstaller or add some code
 
467
                ; here to remove to remove the uninstaller. Use a registry key to check
 
468
                ; whether the user has chosen to uninstall. If you are using an uninstaller
 
469
                ; components page, make sure all sections are uninstalled.
 
470
                old_no_remove_uninstaller:
 
471
 
 
472
        old_detect_done: ; old installation not found, all ok
 
473
 
 
474
        pop $R0
 
475
FunctionEnd
 
476
 
 
477
 
 
478
 
 
479
; detect GTK installation (any of available versions)
 
480
Function AskForGtk
 
481
        SetShellVarContext all  ; use all user variables as opposed to current user
 
482
        push $R0
 
483
 
 
484
        ReadRegStr $R0 HKLM "SOFTWARE\GTK\2.0" "DllPath"
 
485
        StrCmp $R0 "" no_gtk have_gtk
 
486
 
 
487
        no_gtk:
 
488
                MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
 
489
                "GTK2-Runtime is not installed. This product needs it to function properly.$\n\
 
490
                Please install GTK2-Runtime from http://gtk-win.sf.net/ first.$\n$\n\
 
491
                Click 'Cancel' to abort the installation \
 
492
                or 'OK' to continue anyway." \
 
493
                /SD IDOK IDOK have_gtk
 
494
                ;Abort  ; Abort has different meaning from onpage callbacks, so use Quit
 
495
                Quit
 
496
                goto end_gtk_check
 
497
 
 
498
        have_gtk:
 
499
                ; do nothing
 
500
 
 
501
        end_gtk_check:
 
502
 
 
503
        pop $R0
 
504
FunctionEnd
 
505
 
 
506
 
 
507
 
 
508
; Prevent running multiple instances of the installer
 
509
Function PreventMultipleInstances
 
510
        Push $R0
 
511
        System::Call 'kernel32::CreateMutexA(i 0, i 0, t ${PRODUCT_NAME}) ?e'
 
512
        Pop $R0
 
513
        StrCmp $R0 0 +3
 
514
                MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." /SD IDOK
 
515
                Abort
 
516
        Pop $R0
 
517
FunctionEnd
 
518
 
 
519
 
 
520
 
 
521
; eof