Statistiques
| Révision :

root / tmp / org.txm.setups / nsis-2.5 / Examples / example2.nsi @ 3095

Historique | Voir | Annoter | Télécharger (2,57 ko)

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