root / tmp / org.txm.setups / nsis-2.5 / Examples / example2.nsi @ 3099
Historique | Voir | Annoter | Télécharger (2,57 ko)
1 |
; example2.nsi |
---|---|
2 |
; |
3 |
; This script is based on example1.nsi, but it remember the directory, |
4 |
; has uninstall support and (optionally) installs start menu shortcuts. |
5 |
; |
6 |
; It will install example2.nsi into a directory that the user selects, |
7 |
|
8 |
;-------------------------------- |
9 |
|
10 |
; The name of the installer |
11 |
Name "Example2" |
12 |
|
13 |
; The file to write |
14 |
OutFile "example2.exe" |
15 |
|
16 |
; The default installation directory |
17 |
InstallDir $PROGRAMFILES\Example2 |
18 |
|
19 |
; Registry key to check for directory (so if you install again, it will |
20 |
; overwrite the old one automatically) |
21 |
InstallDirRegKey HKLM "Software\NSIS_Example2" "Install_Dir" |
22 |
|
23 |
; Request application privileges for Windows Vista |
24 |
RequestExecutionLevel admin |
25 |
|
26 |
;-------------------------------- |
27 |
|
28 |
; Pages |
29 |
|
30 |
Page components |
31 |
Page directory |
32 |
Page instfiles |
33 |
|
34 |
UninstPage uninstConfirm |
35 |
UninstPage instfiles |
36 |
|
37 |
;-------------------------------- |
38 |
|
39 |
; The stuff to install |
40 |
Section "Example2 (required)" |
41 |
|
42 |
SectionIn RO |
43 |
|
44 |
; Set output path to the installation directory. |
45 |
SetOutPath $INSTDIR |
46 |
|
47 |
; Put file there |
48 |
File "example2.nsi" |
49 |
|
50 |
; Write the installation path into the registry |
51 |
WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR" |
52 |
|
53 |
; Write the uninstall keys for Windows |
54 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2" |
55 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"' |
56 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoModify" 1 |
57 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoRepair" 1 |
58 |
WriteUninstaller "uninstall.exe" |
59 |
|
60 |
SectionEnd |
61 |
|
62 |
; Optional section (can be disabled by the user) |
63 |
Section "Start Menu Shortcuts" |
64 |
|
65 |
CreateDirectory "$SMPROGRAMS\Example2" |
66 |
CreateShortCut "$SMPROGRAMS\Example2\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
67 |
CreateShortCut "$SMPROGRAMS\Example2\Example2 (MakeNSISW).lnk" "$INSTDIR\example2.nsi" "" "$INSTDIR\example2.nsi" 0 |
68 |
|
69 |
SectionEnd |
70 |
|
71 |
;-------------------------------- |
72 |
|
73 |
; Uninstaller |
74 |
|
75 |
Section "Uninstall" |
76 |
|
77 |
; Remove registry keys |
78 |
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" |
79 |
DeleteRegKey HKLM SOFTWARE\NSIS_Example2 |
80 |
|
81 |
; Remove files and uninstaller |
82 |
Delete $INSTDIR\example2.nsi |
83 |
Delete $INSTDIR\uninstall.exe |
84 |
|
85 |
; Remove shortcuts, if any |
86 |
Delete "$SMPROGRAMS\Example2\*.*" |
87 |
|
88 |
; Remove directories used |
89 |
RMDir "$SMPROGRAMS\Example2" |
90 |
RMDir "$INSTDIR" |
91 |
|
92 |
SectionEnd |