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