|
1
|
; example2.nsi |
|
2
|
; |
|
3
|
; This script is based on example1.nsi, but adds uninstall support |
|
4
|
; and (optionally) start menu shortcuts. |
|
5
|
; |
|
6
|
; It will install notepad.exe into a directory that the user selects, |
|
7
|
; |
|
8
|
|
|
9
|
; The name of the installer |
|
10
|
Name "Fossil" |
|
11
|
|
|
12
|
; The file to write |
|
13
|
OutFile "fossil-setup.exe" |
|
14
|
|
|
15
|
; The default installation directory |
|
16
|
InstallDir $PROGRAMFILES\Fossil |
|
17
|
; Registry key to check for directory (so if you install again, it will |
|
18
|
; overwrite the old one automatically) |
|
19
|
InstallDirRegKey HKLM SOFTWARE\Fossil "Install_Dir" |
|
20
|
|
|
21
|
; The text to prompt the user to enter a directory |
|
22
|
ComponentText "This will install fossil on your computer." |
|
23
|
; The text to prompt the user to enter a directory |
|
24
|
DirText "Choose a directory to install in to:" |
|
25
|
|
|
26
|
; The stuff to install |
|
27
|
Section "Fossil (required)" |
|
28
|
; Set output path to the installation directory. |
|
29
|
SetOutPath $INSTDIR |
|
30
|
; Put file there |
|
31
|
File "..\fossil.exe" |
|
32
|
; Write the installation path into the registry |
|
33
|
WriteRegStr HKLM SOFTWARE\Fossil "Install_Dir" "$INSTDIR" |
|
34
|
; Write the uninstall keys for Windows |
|
35
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Fossil" "DisplayName" "Fossil (remove only)" |
|
36
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Fossil" "UninstallString" '"$INSTDIR\uninstall.exe"' |
|
37
|
WriteUninstaller "uninstall.exe" |
|
38
|
SectionEnd |
|
39
|
|
|
40
|
|
|
41
|
; uninstall stuff |
|
42
|
|
|
43
|
UninstallText "This will uninstall fossil. Hit next to continue." |
|
44
|
|
|
45
|
; special uninstall section. |
|
46
|
Section "Uninstall" |
|
47
|
; remove registry keys |
|
48
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Fossil" |
|
49
|
DeleteRegKey HKLM SOFTWARE\Fossil |
|
50
|
; remove files |
|
51
|
Delete $INSTDIR\fossil.exe |
|
52
|
; MUST REMOVE UNINSTALLER, too |
|
53
|
Delete $INSTDIR\uninstall.exe |
|
54
|
; remove shortcuts, if any. |
|
55
|
RMDir "$SMPROGRAMS\Fossil" |
|
56
|
RMDir "$INSTDIR" |
|
57
|
SectionEnd |
|
58
|
|
|
59
|
; eof |
|
60
|
|